diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..00a51af --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# These are explicitly windows files and should use crlf +*.bat text eol=crlf + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0f770f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Ignore Gradle project-specific cache directory +.gradle + +# Ignore Gradle build output directories +**/build/ +!src/**/build/ + +# Screws up the MC dev plugin for IntelliJ.. +src/btw/** + +# Ignore local Minecraft folder +run +release +reobfuscated + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +.idea/jarRepositories.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..9b814f3 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Better Terrain Addon \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/libraries-with-intellij-classes.xml b/.idea/libraries-with-intellij-classes.xml new file mode 100644 index 0000000..9fa3156 --- /dev/null +++ b/.idea/libraries-with-intellij-classes.xml @@ -0,0 +1,65 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d56db2d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Minecraft_Client.xml b/.idea/runConfigurations/Minecraft_Client.xml new file mode 100644 index 0000000..2e0d284 --- /dev/null +++ b/.idea/runConfigurations/Minecraft_Client.xml @@ -0,0 +1,12 @@ + + + + diff --git a/.idea/runConfigurations/Minecraft_Server.xml b/.idea/runConfigurations/Minecraft_Server.xml new file mode 100644 index 0000000..eb6ceed --- /dev/null +++ b/.idea/runConfigurations/Minecraft_Server.xml @@ -0,0 +1,12 @@ + + + + diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..1113585 --- /dev/null +++ b/build.gradle @@ -0,0 +1,177 @@ +import net.fabricmc.loom.task.RunClientTask +import net.fabricmc.loom.task.RunServerTask + +buildscript { + dependencies { + classpath fileTree(dir: "libs", include: "fabric-loom-0.7.local.jar") + } +} + +plugins { + id 'maven-publish' + id 'fabric-loom' version "0.7-SNAPSHOT" +} + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +archivesBaseName = project.archives_base_name +version = project.mod_version +group = project.maven_group + +repositories { + maven { + name = 'legacy-fabric' + url = 'https://maven.legacyfabric.net' + } + maven { + url 'https://jitpack.io' + } + maven { + name 'HalfOf2' + url 'https://storage.googleapis.com/devan-maven/' + } +} + +sourceSets { + btw { + java { + srcDirs = ['src/btw/java'] + } + resources { + srcDirs = ['src/btw/resources'] + } + } +} + +def lwjglVersion = System.getProperty("os.name").toLowerCase().contains("mac") ? "2.9.1" : "2.9.0" + +dependencies { + minecraft "com.mojang:minecraft:${project.minecraft_version}" + implementation 'org.apache.logging.log4j:log4j-core:2.17.0' + implementation 'org.apache.logging.log4j:log4j-api:2.17.0' + + implementation "org.lwjgl.lwjgl:lwjgl_util:${lwjglVersion}" + implementation "org.lwjgl.lwjgl:lwjgl:${lwjglVersion}" + implementation "org.lwjgl.lwjgl:lwjgl-platform:${lwjglVersion}" + + compileOnly fileTree(dir: "libs", include: "Deco-Addon-4.0.0-alpha.jar") + + implementation fileTree(dir: "libs", include: "**.zip") + compileOnly fileTree(dir: "$buildDir/BTW_dev", include: "**.jar") + runtimeClasspath fileTree(dir: "$buildDir/dev_run", include: "dev.jar") + + mappings fileTree(dir: "custom_mappings", include: "**.zip") + modImplementation("io.github.minecraft-cursed-legacy:cursed-fabric-loader:${loader_version}") { + transitive false + } +} + +loom { + accessWidener = file("src/main/resources/betterterrain.accesswidener") +} + +configurations { + btwCompileClasspath.extendsFrom implementation, modImplementation +} + +configurations.all { + resolutionStrategy { + dependencySubstitution { + substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.1-nightly-20130708-debug3') with module("org.lwjgl.lwjgl:lwjgl_util:${lwjglVersion}") + substitute module('org.lwjgl.lwjgl:lwjgl:2.9.1-nightly-20130708-debug3') with module("org.lwjgl.lwjgl:lwjgl:${lwjglVersion}") + } + force "org.lwjgl.lwjgl:lwjgl-platform:${lwjglVersion}" + } +} + +processResources { + inputs.property "version", project.version + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +tasks.withType(JavaCompile).configureEach { + it.options.encoding = "UTF-8" + if (JavaVersion.current().isJava9Compatible()) it.options.release = 8 +} + +java { + withSourcesJar() +} + +compileJava { + dependsOn('btwJar') +} + +task devPackMod(type:Copy) { + dependsOn('jar') + from sourceSets.main.output.classesDirs + into file("$buildDir/classes/java/btw") +} + +task devPackBTW(type:Copy) { + dependsOn('devPackMod') + dependsOn('btwJar') +} + +task devPackRun(type:Jar) { + dependsOn('devPackBTW') + from fileTree("$buildDir/classes/java/btw") + from sourceSets.btw.output.resourcesDir + destinationDirectory = file("$buildDir/dev_run") + archiveFileName = "dev.jar" +} + +jar { + from sourceSets.main.output.resourcesDir + from sourceSets.main.output.classesDirs + from("LICENSE") { + rename { "${it}_${project.archivesBaseName}"} + } +} + +task btwJar(type:Jar) { + from sourceSets.btw.output.resourcesDir + from sourceSets.btw.output.classesDirs + destinationDirectory = file("$buildDir/BTW_dev") + archiveFileName = "BTW_dev.jar" +} + +remapJar { + dependsOn(jar) + input.set jar.archiveFile.get() + destinationDirectory = file("$rootDir/release") +} + +reobfuscateJar { + dependsOn(jar) + input.set jar.archiveFile.get() + destinationDirectory = file("$rootDir/reobfuscated") +} + +task safeRunClient(type:RunClientTask) { + mustRunAfter('clean') + dependsOn('clean') + dependsOn('devPackRun') +} + +task safeRunServer(type:RunServerTask) { + mustRunAfter('clean') + dependsOn('clean') + dependsOn('devPackRun') +} + +runClient { + dependsOn('devPackRun') +} + +runServer { + dependsOn('devPackRun') +} + +clean.doFirst { + delete "$buildDir/dev_run" + delete "$buildDir/BTW_dev" +} diff --git a/changelog.txt b/changelog.txt index 6c15900..83607a0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -12,6 +12,14 @@ Version 3.X.0 [*]Changed black stone to be able to spawn nether mobs. [/list] +Version 3.1.0 +- Updated to CE 2.0.0 +- Refactored the mod to use fabric mixins, so it can now be installed through the mods folder +- Added hazel trees to woods when deco is enabled. +- Added the ability for new deco stones to generate. +- Changed stone variants to only generate within their respective strata according to the changes in deco. +- Fixed an issue where some biomes were not generating sugar cane when they were supposed to. + Version 3.0.0 [list] [*]Updated to CE 1.4.1 diff --git a/changelog_betterbiomes.txt b/changelog_betterbiomes.txt index 02745a6..f43f0a5 100644 --- a/changelog_betterbiomes.txt +++ b/changelog_betterbiomes.txt @@ -1,3 +1,13 @@ +Version 3.1.0 +- Updated to CE 2.0.0 +- Refactored the mod to use fabric mixins, so it can now be installed through the mods folder +- Revamped the mangrove forest biome +- Added hazel trees to many forested biomes when deco is enabled. +- Added fir trees to many taiga biomes when deco is enabled. +- Added mahogany trees to rainforests when deco is enabled. +- Changed (reduced) the number of bushes in temperate forests. +- Changed hot springs to generate calcite instead of diorite. + Version 3.0.0 [list] [*]Added Floral Forest as a new biome. diff --git a/common/net/minecraft/src/ExampleAddon.java b/common/net/minecraft/src/ExampleAddon.java deleted file mode 100644 index a618bfe..0000000 --- a/common/net/minecraft/src/ExampleAddon.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.minecraft.src; - -public class ExampleAddon extends FCAddOn { - public static ExampleAddon instance = new ExampleAddon(); - - private ExampleAddon() { - super("Example Name", "0.1.0", "Ex"); - } - - @Override - public void Initialize() { - - } -} \ No newline at end of file diff --git a/custom_mappings/mappings_152_converted_yarn_intermediates.zip b/custom_mappings/mappings_152_converted_yarn_intermediates.zip new file mode 100644 index 0000000..59145c6 Binary files /dev/null and b/custom_mappings/mappings_152_converted_yarn_intermediates.zip differ diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..d415184 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,12 @@ +# Project name (required) +name=Better Terrain Addon + +minecraft_version = 1.5.2 +yarn_mappings = 1.5.2+build.202201092137 +loader_version = 1.0.0 + +mod_version = 3.1.0 +maven_group = betterterrain +archives_base_name = Better-Terrain-Addon + +org.gradle.jvmargs=-Xmx4g diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7454180 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ffed3a2 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..c53aefa --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/libs/Deco-Addon-4.0.0-alpha.jar b/libs/Deco-Addon-4.0.0-alpha.jar new file mode 100644 index 0000000..3c2d9c0 Binary files /dev/null and b/libs/Deco-Addon-4.0.0-alpha.jar differ diff --git a/libs/fabric-loom-0.7.local.jar b/libs/fabric-loom-0.7.local.jar new file mode 100644 index 0000000..5c20e07 Binary files /dev/null and b/libs/fabric-loom-0.7.local.jar differ diff --git a/libs/paulscode.zip b/libs/paulscode.zip new file mode 100644 index 0000000..affe7de Binary files /dev/null and b/libs/paulscode.zip differ diff --git a/minecraft/betterbiomes/BetterBiomesMod.java b/minecraft/betterbiomes/BetterBiomesMod.java deleted file mode 100644 index d8a3081..0000000 --- a/minecraft/betterbiomes/BetterBiomesMod.java +++ /dev/null @@ -1,53 +0,0 @@ -package betterbiomes; - -import java.util.Set; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterbiomes.entity.BTAEntityCrystalGolem; -import betterbiomes.entity.BTARenderCrystalGolem; -import betterterrain.AddonVersion; -import betterterrain.BTAAddon; -import betterterrain.BTAMod; -import betterterrain.BTAVersion; -import betterterrain.DecoIntegration; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.block.BTABlockClay; -import betterterrain.item.BTAItemBloodMossSpores; -import betterterrain.item.BTAItemPileSoulSand; -import net.minecraft.src.Block; -import net.minecraft.src.FCAddOnHandler; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.Item; -import net.minecraft.src.ItemMultiTextureTile; -import net.minecraft.src.MapColor; -import net.minecraft.src.Material; -import net.minecraft.src.RenderManager; - -public class BetterBiomesMod extends BTAAddon { - private static BetterBiomesMod instance; - - public static final AddonVersion V3_0_0 = new AddonVersion(3, 0, 0, getInstance()); - - private BetterBiomesMod() { - super("Better Biomes", "betterbiomes", "3.0.0", "BB"); - } - - @Override - public void Initialize() { - FCAddOnHandler.LogMessage(this.getName() + " Version " + this.getVersionString() + " Initializing..."); - FCAddOnHandler.LogMessage(this.getName() + " Initialized"); - } - - public static BetterBiomesMod getInstance() { - if (instance == null) { - instance = new BetterBiomesMod(); - } - - return instance; - } - - @Override - public BiomeConfiguration getBiomeConfiguration() { - return BetterBiomesConfiguration.getInstance(); - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/BetterBiomesConfiguration.java b/minecraft/betterbiomes/biome/BetterBiomesConfiguration.java deleted file mode 100644 index d85b14c..0000000 --- a/minecraft/betterbiomes/biome/BetterBiomesConfiguration.java +++ /dev/null @@ -1,1232 +0,0 @@ -package betterbiomes.biome; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.Random; - -import betterbiomes.world.generate.surface.AlpineSurfaceBuilder; -import betterbiomes.world.generate.surface.AncientForestSurfaceBuilder; -import betterbiomes.world.generate.surface.AshFieldsSurfaceBuilder; -import betterbiomes.world.generate.surface.BadlandsPlateauSurfaceBuilder; -import betterbiomes.world.generate.surface.BasaltDeltasSurfaceBuilder; -import betterbiomes.world.generate.surface.ConiferousForestSurfaceBuilder; -import betterbiomes.world.generate.surface.CrystalCavernsSurfaceBuilder; -import betterbiomes.world.generate.surface.FirCanyonSurfaceBuilder; -import betterbiomes.world.generate.surface.HeathlandSurfaceBuilder; -import betterbiomes.world.generate.surface.HotSpringsSurfaceBuilder; -import betterbiomes.world.generate.surface.IvoryHillsSurfaceBuilder; -import betterbiomes.world.generate.surface.OrchardSurfaceBuilder; -import betterbiomes.world.generate.surface.OutbackSurfaceBuilder; -import betterbiomes.world.generate.surface.SoulSandValleySurfaceBuilder; -import betterbiomes.world.generate.surface.SteppeSurfaceBuilder; -import betterbiomes.world.generate.surface.TropicsSurfaceBuilder; -import betterbiomes.world.generate.surface.VolcanicBeachSurfaceBuilder; -import betterbiomes.world.generate.surface.VolcanicJungleSurfaceBuilder; -import betterterrain.BTAVersion; -import betterterrain.biome.BTABiome; -import betterterrain.biome.BTABiomeConfiguration; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.biome.BiomeHeight; -import betterterrain.biome.BiomeInfo; -import betterterrain.biome.Climate; -import betterterrain.biome.biomes.AridForestBiome; -import betterterrain.biome.biomes.BeachBiome; -import betterterrain.biome.biomes.DesertBiome; -import betterterrain.biome.biomes.DesertRiverBiome; -import betterterrain.biome.biomes.IcyPeaksBiome; -import betterterrain.biome.biomes.JungleBiome; -import betterterrain.biome.biomes.JungleEdgeBiome; -import betterterrain.biome.biomes.JungleRiverBiome; -import betterterrain.biome.biomes.MountainBiome; -import betterterrain.biome.biomes.NetherWastesBiome; -import betterterrain.biome.biomes.PlainsBiome; -import betterterrain.biome.biomes.RiverBiome; -import betterterrain.biome.biomes.SiberiaBiome; -import betterterrain.biome.biomes.TundraBiome; -import betterterrain.biome.biomes.WoodsBiome; -import betterterrain.biome.biomes.deprecated.ForestedIcyPeaksBiome; -import betterbiomes.biome.biomes.AlpineBiome; -import betterbiomes.biome.biomes.AncientForestBiome; -import betterbiomes.biome.biomes.AshFieldsBiome; -import betterbiomes.biome.biomes.AspenGroveBiome; -import betterbiomes.biome.biomes.AutmnForestBiome; -import betterbiomes.biome.biomes.BadlandsBiome; -import betterbiomes.biome.biomes.BadlandsPlateauBiome; -import betterbiomes.biome.biomes.BasaltDeltasBiome; -import betterbiomes.biome.biomes.RedSandBeachBiome; -import betterbiomes.biome.biomes.BirchForestBiome; -import betterbiomes.biome.biomes.BorealForestBiome; -import betterbiomes.biome.biomes.BrushlandBiome; -import betterbiomes.biome.biomes.ChapparalBiome; -import betterbiomes.biome.biomes.CherryForestBiome; -import betterbiomes.biome.biomes.ConiferousForestBiome; -import betterbiomes.biome.biomes.deprecated.ConiferousForestClearingBiome; -import betterbiomes.biome.biomes.CrystalCavernsBiome; -import betterbiomes.biome.biomes.DunesBiome; -import betterbiomes.biome.biomes.FirCanyonBiome; -import betterbiomes.biome.biomes.FloralForestBiome; -import betterbiomes.biome.biomes.FloralPlateauBiome; -import betterbiomes.biome.biomes.FrozenSpringsPondBiome; -import betterbiomes.biome.biomes.FrozenSpringsBiome; -import betterbiomes.biome.biomes.FungalForestBiome; -import betterbiomes.biome.biomes.GrasslandsBiome; -import betterbiomes.biome.biomes.GrasslandsLakeBiome; -import betterbiomes.biome.biomes.HeathlandBiome; -import betterbiomes.biome.biomes.deprecated.HeathlandWoodsBiome; -import betterbiomes.biome.biomes.HighlandsBiome; -import betterbiomes.biome.biomes.HotSpringsBiome; -import betterbiomes.biome.biomes.IvoryHillsBiome; -import betterbiomes.biome.biomes.LushDesertBiome; -import betterbiomes.biome.biomes.MangroveForestBiome; -import betterbiomes.biome.biomes.MeadowBiome; -import betterbiomes.biome.biomes.MysticValleyBiome; -import betterbiomes.biome.biomes.OasisBiome; -import betterbiomes.biome.biomes.deprecated.OldValleyBiome; -import betterbiomes.biome.biomes.OrchardBiome; -import betterbiomes.biome.biomes.deprecated.OrchardClearingBiome; -import betterbiomes.biome.biomes.OutbackBiome; -import betterbiomes.biome.biomes.PatagoniaBiome; -import betterbiomes.biome.biomes.PatagoniaMountainBiome; -import betterbiomes.biome.biomes.PetrifiedForestBiome; -import betterbiomes.biome.biomes.RainforestBiome; -import betterbiomes.biome.biomes.RainforestEdgeBiome; -import betterbiomes.biome.biomes.BadlandsRiverBiome; -import betterbiomes.biome.biomes.MysticRiverBiome; -import betterbiomes.biome.biomes.OrchardRiverBiome; -import betterbiomes.biome.biomes.OutbackRiverBiome; -import betterbiomes.biome.biomes.PatagoniaRiverBiome; -import betterbiomes.biome.biomes.RainforestRiverBiome; -import betterbiomes.biome.biomes.TropicsRiverBiome; -import betterbiomes.biome.biomes.WetlandsRiverBiome; -import betterbiomes.biome.biomes.WillowRiverBiome; -import betterbiomes.biome.biomes.SavannaBiome; -import betterbiomes.biome.biomes.ShieldBiome; -import betterbiomes.biome.biomes.SoulSandValleyBiome; -import betterbiomes.biome.biomes.SteppeBiome; -import betterbiomes.biome.biomes.TemperateForestBiome; -import betterbiomes.biome.biomes.TropicsBiome; -import betterbiomes.biome.biomes.ValleyBiome; -import betterbiomes.biome.biomes.VolcanicJungle; -import betterbiomes.biome.biomes.WetlandsBiome; -import betterbiomes.biome.biomes.WillowGroveBiome; -import betterbiomes.biome.biomes.deprecated.WoodedSteppeBiome; -import betterterrain.biome.layer.HillsLayer; -import betterterrain.structure.mapgen.BTAMapGenScatteredFeature; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.surface.IcyPeaksSurfaceBuilder; -import betterterrain.world.generate.surface.NetherSurfaceBuilder; -import betterterrain.world.generate.surface.NoShorelineSurfaceBuilder; -import betterterrain.world.generate.surface.StonySurfaceBuilder; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.ComponentVillageStartPiece; -import net.minecraft.src.FCUtilsHardcoreSpawn; -import net.minecraft.src.MapGenVillage; -import net.minecraft.src.StructureScatteredFeatureStart; -import net.minecraft.src.WorldGenPumpkin; -import net.minecraft.src.WorldGenReed; - -public class BetterBiomesConfiguration extends BiomeConfiguration { - public static final int - //Nether - NETHER_WASTES_ID = 90, - ASH_FIELDS_ID = 91, - BASALT_DELTAS_ID = 92, - SOUL_SAND_VALLEY_ID = 93, - OBSIDIAN_GROVE_ID = 94, - CRYSTAL_CAVERNS_ID = 95, - PETRIFIED_FOREST_ID = 96, - //Primary - WOODS_ID = 100, - DESERT_ID = 101, - LUSH_DESERT_ID = 102, - OASIS_ID = 103, - SAVANNA_ID = 104, - WETLANDS_ID = 105, - BIRCH_FOREST_ID = 106, - SNOWY_WOODS_ID = 107, - STEPPE_ID = 108, - WOODED_STEPPE_ID = 109, - CHAPPARAL_ID = 110, - ANCIENT_FOREST_ID = 111, - TROPICS_ID = 112, - JUNGLE_ID = 113, - ALPINE_ID = 114, - ASPEN_GROVE_ID = 115, - FUNGAL_FOREST_ID = 116, - CONIFEROUS_FOREST_ID = 117, - CONIFEROUS_FOREST_CLEARING_ID = 118, - SNOWY_CONIFEROUS_FOREST_ID = 119, - SNOWY_CONIFEROUS_FOREST_CLEARING_ID = 120, - MYSTIC_Valley_ID = 121, - RAINFOREST_ID = 122, - MEADOW_ID = 123, - ORCHARD_ID = 124, - MOUNTAINS_ID = 125, - DUNES_ID = 126, - HEATHLAND_ID = 127, - HEATHLAND_WOODS_ID = 128, - TEMPERATE_FOREST_ID = 129, - VALLEY_MOUNTAINS_ID = 130, - OLD_VALLEY_ID = 131, - TUNDRA_ID = 132, - WILLOW_GROVE_ID = 133, - ICY_PEAKS_ID = 134, - PATAGONIA_ID = 135, - GRASSLANDS_ID = 136, - SIBERIA_ID = 137, - PLAINS_ID = 138, - FROZEN_SPRINGS_ID = 139, - MANGROVE_FOREST_ID = 140, - BOREAL_FOREST_ID = 141, - ARID_FOREST_ID = 142, - SHIELD_ID = 143, - BRUSHLAND_ID = 144, - HIGHLANDS_ID = 145, - FLORAL_FOREST_ID = 146, - - //Sub biomes - WOODS_HILLS_ID = 150, - DESERT_HILLS_ID = 151, - SAVANNA_HILLS_ID = 152, - BIRCH_FOREST_HILLS_ID = 153, - SNOWY_WOODS_HILLS = 154, - CHAPPARAL_HILLS_ID = 155, - ANCIENT_FOREST_HILLS_ID = 156, - JUNGLE_HILLS_ID = 157, - FUNGAL_FOREST_FLAT_ID = 158, - WETLANDS_HILLS_ID = 159, - CHERRY_FOREST_HILLS_ID = 160, - AUTUMN_FOREST_HILLS_ID = 161, - VALLEY_ID = 162, - ORCHARD_CLEARING_ID = 163, - WILLOW_HILLS_ID = 164, - ICY_PEAKS_FORESTED_ID = 165, - PATAGONIA_MOUNTAINS_ID = 166, - GRASSLANDS_LAKE_ID = 167, - FROZEN_SPRINGS_POND_ID = 168, - MANGROVE_FOREST_ISLAND_ID = 169, - BOREAL_FOREST_HILLS_ID = 170, - SAVANNA_PLATEAU_ID = 171, - FIR_CANYON_VALLEY_ID = 172, - FLORAL_PLATEAU_ID = 173, - - //Deco only - OUTBACK_ID = 180, - CHERRY_FOREST_ID = 181, - BADLANDS_ID = 182, - BADLANDS_PLATEAU_ID = 183, - AUTUMN_FOREST_ID = 184, - IVORY_HILLS_ID = 185, - HOT_SPRINGS_ID = 186, - VOLCANIC_JUNGLE_ID = 187, - FIR_CANYON_ID = 188, - - //Rivers - DESERT_RIVER_ID = 200, - MYSTIC_RIVER_ID = 201, - RAINFOREST_RIVER_ID = 202, - OUTBACK_RIVER_ID = 203, - BADLANDS_RIVER_ID = 204, - TROPICS_RIVER_ID = 205, - ORCHARD_RIVER_ID = 206, - JUNGLE_RIVER_ID = 207, - WETLANDS_RIVER_ID = 208, - WILLOW_GROVE_RIVER_ID = 209, - PATAGONIA_RIVER_ID = 210, - RIVER_ID = 211, - FROZEN_RIVER_ID = 212, - VOLCANIC_RIVER_ID = 213, - - //Edges - ALPINE_EDGE_ID = 230, - MOUNTAIN_EDGE_ID = 231, - BADLANDS_EDGE_ID = 232, - ICY_PEAKS_EDGE_ID = 233, - HIGHLANDS_EDGE_OLD_ID = 234, - JUNGLE_EDGE_ID = 235, - RAINFOREST_EDGE_ID = 236, - TROPICS_EDGE_ID = 237, - HOT_SPRINGS_EDGE_ID = 238, - HIGHLANDS_EDGE_ID = 239, - //Beaches - RED_SAND_BEACH_ID = 240, - BEACH_ID = 241, - FROZEN_BEACH_ID = 242, - VOLCANIC_BEACH_ID = 243, - IVORY_BEACH_ID = 244, - - max_id = 256; - - // ------ Primary Biomes ------ // - //Temperate - public static final BTABiome ancientForest = new AncientForestBiome(ANCIENT_FOREST_ID, "betterbiomes:ancient_forest", Climate.TEMPERATE) - .setBiomeName("Ancient Forest") - .setSurfaceBuilder(new AncientForestSurfaceBuilder()) - .setTemperatureRainfall(0.7F, 0.8F) - .setMinMaxHeight(0.1F, 0.5F) - .setLegacyCompatible(); - - public static final BTABiome autumnForest = new AutmnForestBiome(AUTUMN_FOREST_ID, "betterbiomes:autumn_forest", Climate.TEMPERATE) - .setBiomeName("Autumn Forest") - .setTemperatureRainfall(0.9F, 0.2F) - .setMinMaxHeight(0.1F, 0.5F) - .setDecoOnly() - .setLegacyCompatible(); - - public static final BTABiome cherryForest = new CherryForestBiome(CHERRY_FOREST_ID, "betterbiomes:cherry_forest", Climate.TEMPERATE) - .setBiomeName("Cherry Forest") - .setTemperatureRainfall(0.9F, 0.8F) - .setMinMaxHeight(0.1F, 0.5F) - .setDecoOnly() - .setLegacyCompatible(); - - public static final BTABiome floralForest = new FloralForestBiome(FLORAL_FOREST_ID, "betterbiomes:floral_forest", Climate.TEMPERATE) - .setBiomeName("Floral Forest") - .setTemperatureRainfall(0.9F, 0.8F) - .setMinMaxHeight(0.2F, 0.5F); - - public static final BTABiome grasslands = new GrasslandsBiome(GRASSLANDS_ID, "betterbiomes:grasslands", Climate.TEMPERATE) - .setBiomeName("Grasslands") - .setSpawnsPumpkins() - .setSpawnsVillages(false) - .setTemperatureRainfall(0.5F, 0.6F); - - public static final BTABiome heathland = new HeathlandBiome(HEATHLAND_ID, "betterbiomes:heathland", Climate.TEMPERATE) - .setBiomeName("Heathland") - .setSurfaceBuilder(new HeathlandSurfaceBuilder()) - .setSpawnsPumpkins() - .setSpawnsVillages(false) - .setTemperatureRainfall(0.7F, 0.4F) - .setMinMaxHeight(0.1F, 0.5F) - .setLegacyCompatible(); - - public static final BTABiome highlands = new HighlandsBiome(HIGHLANDS_ID, "betterbiomes:highlands", Climate.TEMPERATE) - .setBiomeName("Highlands") - .setTemperatureRainfall(0.7F, 0.5F) - .setMinMaxHeight(0.8F, 2.5F); - - public static final BTABiome mangroveForest = new MangroveForestBiome(MANGROVE_FOREST_ID, "betterbiomes:mangrove_forest", Climate.TEMPERATE) - .setBiomeName("Mangal") - .setSpawnsSugarCane() - .setSpawnsJungleTemples() - .setTemperatureRainfall(0.8F, 0.9F) - .setMinMaxHeight(-0.3F, 0.2F); - - public static final BTABiome mysticValley = new MysticValleyBiome(MYSTIC_Valley_ID, "betterbiomes:mystic_valley", Climate.TEMPERATE) - .setBiomeName("Mystic Valley") - .setSpawnsSugarCane() - .setSpawnsWitchHuts() - .setTemperatureRainfall(0.9F, 1.0F) - .setMinMaxHeight(0.3F, 1.5F) - .setLegacyCompatible(); - - public static final BTABiome orchard = new OrchardBiome(ORCHARD_ID, "betterbiomes:orchard", Climate.TEMPERATE) - .setBiomeName("Orchard") - .setSurfaceBuilder(new OrchardSurfaceBuilder()) - .setSpawnsPumpkins() - .setSpawnsVillages(false) - .setTemperatureRainfall(0.7F, 0.5F) - .setLegacyCompatible(); - - public static final BTABiome steppe = new SteppeBiome(STEPPE_ID, "betterbiomes:steppe", Climate.TEMPERATE) - .setBiomeName("Steppe") - .setSurfaceBuilder(new SteppeSurfaceBuilder()) - .setSpawnsVillages(true) - .setSpawnsDesertTemples() - .setTemperatureRainfall(0.8F, 0.1F) - .setMinMaxHeight(0.3F, 0.5F) - .setLegacyCompatible() - .setNotSpawnable(); - - public static final BTABiome temperateForest = new TemperateForestBiome(TEMPERATE_FOREST_ID, "betterbiomes:temperate_forest", Climate.TEMPERATE) - .setBiomeName("Temperate Forest") - .setSpawnsSugarCane() - .setTemperatureRainfall(0.6F, 0.7F) - .setMinMaxHeight(0.2F, 1.0F) - .setLegacyCompatible(); - - //Arid - public static final BTABiome badlandsPlateau = new BadlandsPlateauBiome(BADLANDS_PLATEAU_ID, "betterbiomes:badlands_plateau", Climate.ARID) - .setBiomeName("Badlands Plateau") - .setSurfaceBuilder(new BadlandsPlateauSurfaceBuilder()) - .setDisableRain() - .setTemperatureRainfall(2.0F, 0.0F) - .setMinMaxHeight(0.8F, 2.0F) - .setPlateau() - .setDecoOnly() - .setLegacyCompatible(); - - public static final BTABiome chaparral = new ChapparalBiome(CHAPPARAL_ID, "betterbiomes:chapparal", Climate.ARID) - .setBiomeName("Chaparral") - .setSurfaceBuilder(new StonySurfaceBuilder()) - .setSpawnsPumpkins() - .setSpawnsVillages(true) - .setTemperatureRainfall(0.8F, 0.4F) - .setMinMaxHeight(0.3F, 0.6F) - .setLegacyCompatible(); - - public static final BTABiome dunes = new DunesBiome(DUNES_ID, "betterbiomes:dunes", Climate.ARID) - .setBiomeName("Dunes") - .setDisableRain() - .setSpawnsDesertTemples() - .setTemperatureRainfall(2.0F, 0.0F) - .setMinMaxHeight(0.5F, 1.5F) - .setNotSpawnable() - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setLegacyCompatible(); - - public static final BTABiome firCanyon = new FirCanyonBiome(FIR_CANYON_ID, "betterbiomes:fir_canyon", Climate.ARID) - .setBiomeName("Fir Canyon") - .setSurfaceBuilder(new FirCanyonSurfaceBuilder(true)) - .setTemperatureRainfall(1.0F, 0.1F) - .setMinMaxHeight(0.8F, 2.0F) - .setDecoOnly(); - - public static final BTABiome ivoryHills = new IvoryHillsBiome(IVORY_HILLS_ID, "betterbiomes:ivory_hills", Climate.ARID) - .setBiomeName("Ivory Hills") - .setSurfaceBuilder(new IvoryHillsSurfaceBuilder()) - .setDisableRain() - .setTemperatureRainfall(1.5F, 0.1F) - .setMinMaxHeight(0.8F, 2.0F) - .setPlateau() - .setDecoOnly(); - - public static final BTABiome outback = new OutbackBiome(OUTBACK_ID, "betterbiomes:outback", Climate.ARID) - .setBiomeName("Outback") - .setSurfaceBuilder(new OutbackSurfaceBuilder()) - .setSpawnsVillages(false) - .setSpawnsRedDesertTemples() - .setDisableRain() - .setTemperatureRainfall(2.0F, 0.0F) - .setMinMaxHeight(0.1F, 0.4F) - .setDecoOnly() - .setLegacyCompatible() - .setNotSpawnable(); - - public static final BTABiome savanna = new SavannaBiome(SAVANNA_ID, "betterbiomes:savanna", Climate.ARID) - .setBiomeName("Savanna") - .setSpawnsPumpkins() - .setSpawnsVillages(false) - .setTemperatureRainfall(1.5F, 0.1F) - .setMinMaxHeight(0.1F, 0.3F) - .setLegacyCompatible(); - - //Tropical - public static final BTABiome lushDesert = new LushDesertBiome(LUSH_DESERT_ID, "betterbiomes:lush_desert", Climate.TROPICAL) - .setBiomeName("Lush Desert") - .setSpawnsVillages(true) - .setSpawnsDesertTemples() - .setDisableRain() - .setTemperatureRainfall(0.9F, 1.0F) - .setMinMaxHeight(0.1F, 0.6F) - .setLegacyCompatible() - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setNotSpawnable(); - - public static final BTABiome meadow = new MeadowBiome(MEADOW_ID, "betterbiomes:meadow", Climate.TROPICAL) - .setBiomeName("Meadow") - .setSpawnsPumpkins() - .setSpawnsVillages(false) - .setTemperatureRainfall(0.7F, 1.0F) - .setMinMaxHeight(0.1F, 0.4F) - .setLegacyCompatible(); - - public static final BTABiome rainforest = new RainforestBiome(RAINFOREST_ID, "betterbiomes:rainforest", Climate.TROPICAL) - .setBiomeName("Rainforest") - .setSpawnsSugarCane() - .setSpawnsJungleTemples() - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(0.3F, 1.5F) - .setLegacyCompatible() - .setNotSpawnable(); - - public static final BTABiome tropics = new TropicsBiome(TROPICS_ID, "betterbiomes:tropics", Climate.TROPICAL) - .setBiomeName("Tropics") - .setSurfaceBuilder(new TropicsSurfaceBuilder()) - .setSpawnsSugarCane() - .setSpawnsJungleTemples() - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(-0.2F, 0.9F) - .setLegacyCompatible() - .setNotSpawnable(); - - public static final BTABiome valleyMountains = new ValleyBiome(VALLEY_MOUNTAINS_ID, "betterbiomes:valley_highlands", Climate.TROPICAL) - .setBiomeName("Valley Highlands") - .setSurfaceBuilder(new TropicsSurfaceBuilder()) - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(0.5F, 3.0F) - .setLegacyCompatible(); - - public static final BTABiome volcanicJungle = new VolcanicJungle(VOLCANIC_JUNGLE_ID, "betterbiomes:volcanic_jungle", Climate.TROPICAL) - .setBiomeName("Volcanic Jungle") - .setSpawnsSugarCane() - .setSpawnsJungleTemples() - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(0.2F, 1.0F) - .setSurfaceBuilder(new VolcanicJungleSurfaceBuilder()) - .setDecoOnly() - .setNotSpawnable(); - - public static final BTABiome wetlands = new WetlandsBiome(WETLANDS_ID, "betterbiomes:wetlands", Climate.TROPICAL) - .setBiomeName("Wetlands") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setSpawnsSugarCane() - .setSpawnsWitchHuts() - .setMinMaxHeight(-0.1F, 0.3F) - .setTemperatureRainfall(0.8F, 0.9F) - .setLegacyCompatible(); - - public static final BTABiome willowGrove = new WillowGroveBiome(WILLOW_GROVE_ID, "betterbiomes:willow_grove", Climate.TROPICAL) - .setBiomeName("Willow Grove") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setSpawnsSugarCane() - .setSpawnsWitchHuts() - .setMinMaxHeight(-0.1F, 0.3F) - .setTemperatureRainfall(0.8F, 0.8F); - - //Cold - public static final BTABiome alpine = new AlpineBiome(ALPINE_ID, "betterbiomes:alpine", Climate.COLD) - .setBiomeName("Alpine") - .setSurfaceBuilder(new AlpineSurfaceBuilder()) - .setTemperatureRainfall(0.2F, 0.8F) - .setMinMaxHeight(0.5F, 3.0F) - .setLegacyCompatible(); - - public static final BTABiome birchForest = new BirchForestBiome(BIRCH_FOREST_ID, "betterbiomes:birch_forest", Climate.COLD) - .setBiomeName("Birch Forest") - .setTemperatureRainfall(0.4F, 0.4F) - .setMinMaxHeight(0.1F, 0.5F) - .setLegacyCompatible(); - - public static final BTABiome borealForest = new BorealForestBiome(BOREAL_FOREST_ID, "betterbiomes:boreal_forest", Climate.COLD) - .setBiomeName("Boreal Forest") - .setTemperatureRainfall(0.5F, 0.4F) - .setMinMaxHeight(0.1F, 0.4F); - - public static final BTABiome brushland = new BrushlandBiome(BRUSHLAND_ID, "betterbiomes:brushland", Climate.COLD) - .setBiomeName("Brushland") - .setSpawnsPumpkins() - .setSpawnsVillages(false) - .setTemperatureRainfall(0.4F, 0.2F) - .setMinMaxHeight(0.3F, 0.5F); - - public static final BTABiome coniferousForest = new ConiferousForestBiome(CONIFEROUS_FOREST_ID, "betterbiomes:coniferous_forest", Climate.COLD) - .setBiomeName("Coniferous Forest") - .setSurfaceBuilder(new ConiferousForestSurfaceBuilder()) - .setTemperatureRainfall(0.5F, 0.4F) - .setMinMaxHeight(0.3F, 1.2F) - .setLegacyCompatible(); - - public static final BTABiome fungalForest = new FungalForestBiome(FUNGAL_FOREST_ID, "betterbiomes:fungal_forest", Climate.COLD) - .setBiomeName("Fungal Forest") - .setSpawnsSugarCane() - .setSpawnsWitchHuts() - .setTemperatureRainfall(0.4F, 1.0F) - .setMinMaxHeight(-0.1F, 1.2F) - .setLegacyCompatible(); - - public static final BTABiome hotSprings = new HotSpringsBiome(HOT_SPRINGS_ID, "betterbiomes:hot_springs", Climate.COLD) - .setBiomeName("Hot Springs") - .setSurfaceBuilder(new HotSpringsSurfaceBuilder(HOT_SPRINGS_ID, true)) - .setTemperatureRainfall(0.5F, 0.4F) - .setMinMaxHeight(0.8F, 1.2F) - .setDecoOnly(); - - public static final BTABiome patagonia = new PatagoniaBiome(PATAGONIA_ID, "betterbiomes:patagonia", Climate.COLD) - .setBiomeName("Patagonia") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setSpawnsPumpkins() - .setSpawnsSugarCane() - .setSpawnsVillages(false) - .setTemperatureRainfall(0.3F, 0.6F) - .setMinMaxHeight(0.0F, 0.5F); - - public static final BTABiome shield = new ShieldBiome(SHIELD_ID, "betterbiomes:shield", Climate.COLD) - .setBiomeName("Shield") - .setSurfaceBuilder(new StonySurfaceBuilder()) - .setTemperatureRainfall(0.5F, 0.4F) - .setMinMaxHeight(0.2F, 0.6F); - - //Snowy - public static final BTABiome frozenSprings = new FrozenSpringsBiome(FROZEN_SPRINGS_ID, "betterbiomes:frozen_springs", Climate.SNOWY) - .setBiomeName("Frozen Springs") - .setSpawnsSugarCane() - .setTemperatureRainfall(0.1F, 0.1F) - .setMinMaxHeight(0.2F, 0.6F) - .setEnableSnow(); - - public static final BTABiome snowyConiferousForest = new ConiferousForestBiome(SNOWY_CONIFEROUS_FOREST_ID, "betterbiomes:snowy_coniferous_forest", Climate.SNOWY) - .setBiomeName("Snowy Coniferous Forest") - .setSurfaceBuilder(new ConiferousForestSurfaceBuilder()) - .setTemperatureRainfall(0.1F, 0.4F) - .setMinMaxHeight(0.3F, 1.2F) - .setEnableSnow() - .setLegacyCompatible(); - - public static final BTABiome snowyWoods = new WoodsBiome(SNOWY_WOODS_ID, "betterbiomes:snowy_woods", Climate.SNOWY) - .setBiomeName("Snowy Woods") - .setTemperatureRainfall(0.1F, 0.5F) - .setMinMaxHeight(0.1F, 0.5F) - .setEnableSnow() - .setLegacyCompatible(); - - // ------ Secondary Biomes ------ // - //Variants - public static final BTABiome ancientForestHills = new AncientForestBiome(ANCIENT_FOREST_HILLS_ID, "betterbiomes:ancient_forest_hills", Climate.TEMPERATE) - .setBiomeName("Ancient Forest Hills") - .setTemperatureRainfall(0.7F, 0.8F) - .setMinMaxHeight(0.3F, 1.0F); - - public static final BTABiome autumnForestHills = new AutmnForestBiome(AUTUMN_FOREST_HILLS_ID, "betterbiomes:autumn_forest_hills", Climate.TEMPERATE) - .setBiomeName("Autumn Forest Hills") - .setTemperatureRainfall(0.9F, 0.2F) - .setMinMaxHeight(0.3F, 1.0F); - - public static final BTABiome badlands = new BadlandsBiome(BADLANDS_ID, "betterbiomes:badlands", Climate.ARID) - .setBiomeName("Badlands") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setSpawnsRedDesertTemples() - .setDisableRain() - .setTemperatureRainfall(2.0F, 0.0F) - .setMinMaxHeight(0.1F, 0.1F) - .setNotSpawnable(); - - public static final BTABiome birchForestHills = new BirchForestBiome(BIRCH_FOREST_HILLS_ID, "betterbiomes:birch_forest_hills", Climate.COLD) - .setBiomeName("Birch Forest Hills") - .setTemperatureRainfall(0.4F, 0.4F) - .setMinMaxHeight(0.3F, 1.0F); - - public static final BTABiome borealForestHills = new BorealForestBiome(BOREAL_FOREST_HILLS_ID, "betterbiomes:boreal_forest_hills", Climate.COLD) - .setBiomeName("Boreal Forest Hills") - .setTemperatureRainfall(0.5F, 0.4F) - .setMinMaxHeight(0.3F, 1.0F); - - public static final BTABiome chaparralHills = new ChapparalBiome(CHAPPARAL_HILLS_ID, "betterbiomes:chapparal_hills", Climate.ARID) - .setBiomeName("Chaparral Hills") - .setSurfaceBuilder(new StonySurfaceBuilder()) - .setSpawnsPumpkins() - .setTemperatureRainfall(0.8F, 0.4F) - .setMinMaxHeight(0.3F, 1.0F); - - public static final BTABiome cherryForestHills = new CherryForestBiome(CHERRY_FOREST_HILLS_ID, "betterbiomes:cherry_forest_hills", Climate.TEMPERATE) - .setBiomeName("Cherry Forest Hills") - .setTemperatureRainfall(0.7F, 0.8F) - .setMinMaxHeight(0.3F, 1.0F); - - public static final BTABiome firCanyonValley = new FirCanyonBiome(FIR_CANYON_VALLEY_ID, "betterbiomes:fir_canyon_valley", Climate.ARID) - .setBiomeName("Fir Canyon Valley") - .setSurfaceBuilder(new FirCanyonSurfaceBuilder(false)) - .setDisableRain() - .setTemperatureRainfall(1.0F, 0.1F) - .setMinMaxHeight(0.1F, 0.7F) - .setDecoOnly(); - - public static final BTABiome floralPlateau = new FloralPlateauBiome(FLORAL_PLATEAU_ID, "betterbiomes:floral_plateau", Climate.ARID) - .setBiomeName("Floral Plateau") - .setTemperatureRainfall(0.9F, 0.8F) - .setMinMaxHeight(0.8F, 2.0F) - .setPlateau(); - - public static final BTABiome frozenSpringsPond = new FrozenSpringsPondBiome(FROZEN_SPRINGS_POND_ID, "betterbiomes:frozen_springs", Climate.SNOWY) - .setBiomeName("Frozen Springs Pond") - .setSpawnsSugarCane() - .setTemperatureRainfall(0.2F, 0.1F) - .setMinMaxHeight(-0.3F, 0.0F); - - public static final BTABiome fungalForestFlat = new FungalForestBiome(FUNGAL_FOREST_FLAT_ID, "betterbiomes:fungal_forest", Climate.COLD) - .setBiomeName("Fungal Forest Lowlands") - .setSpawnsSugarCane() - .setSpawnsWitchHuts() - .setMinMaxHeight(-0.1F, 0.5F) - .setTemperatureRainfall(0.4F, 1.0F); - - public static final BTABiome grasslandsLake = new GrasslandsLakeBiome(GRASSLANDS_LAKE_ID, "betterbiomes:grasslands_lake", Climate.TEMPERATE) - .setBiomeName("Grasslands Lake") - .setTemperatureRainfall(0.5F, 0.6F) - .setMinMaxHeight(-0.3F, 0.0F); - - public static final BTABiome ivoryPlains = new SavannaBiome(IVORY_BEACH_ID, "betterbiomes:ivory_plains", Climate.ARID) - .setBiomeName("Ivory Plains") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setTemperatureRainfall(1.5F, 0.1F) - .setMinMaxHeight(0.1F, 0.3F) - .setBeach(); - - public static final BTABiome mangroveForestIsland = new MangroveForestBiome(MANGROVE_FOREST_ISLAND_ID, "betterbiomes:mangrove_forest", Climate.TEMPERATE) - .setBiomeName("Mangal Island") - .setSpawnsSugarCane() - .setSpawnsJungleTemples() - .setMinMaxHeight(0.0F, 0.3F) - .setTemperatureRainfall(0.8F, 0.9F) - .setNotSpawnable(); - - public static final BTABiome oasis = new OasisBiome(OASIS_ID, "betterbiomes:oasis", Climate.TROPICAL) - .setBiomeName("Oasis") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setSpawnsVillages(true) - .setDisableRain() - .setTemperatureRainfall(0.9F, 1.0F) - .setMinMaxHeight(-0.2F, 0.1F) - .setNotSpawnable(); - - public static final BTABiome patagoniaMountains = new PatagoniaMountainBiome(PATAGONIA_MOUNTAINS_ID, "betterbiomes:patagonia_mountains", Climate.COLD) - .setBiomeName("Patagonia Mountains") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setTemperatureRainfall(0.1F, 0.6F) - .setMinMaxHeight(2.0F, 4.0F) - .setEnableSnow(); - - public static final BTABiome savannaHills = new SavannaBiome(SAVANNA_HILLS_ID, "betterbiomes:savanna_hills", Climate.ARID) - .setBiomeName("Savanna Hills") - .setSpawnsPumpkins() - .setTemperatureRainfall(1.5F, 0.1F) - .setMinMaxHeight(0.3F, 0.8F); - - public static final BTABiome savannaPlateau = new SavannaBiome(SAVANNA_PLATEAU_ID, "betterbiomes:savanna_plateau", Climate.ARID) - .setBiomeName("Savanna Plateau") - .setTemperatureRainfall(1.5F, 0.1F) - .setMinMaxHeight(0.3F, 0.8F) - .setPlateau(); - - public static final BTABiome snowyWoodsHills = new WoodsBiome(SNOWY_WOODS_HILLS, "betterbiomes:snowy_woods_hills", Climate.SNOWY) - .setBiomeName("Snowy Woods Hills") - .setEnableSnow() - .setTemperatureRainfall(0.1F, 0.5F) - .setMinMaxHeight(0.3F, 1.0F); - - public static final BTABiome valley = new ValleyBiome(VALLEY_ID, "betterbiomes:valley", Climate.TROPICAL) - .setBiomeName("Valley") - .setSurfaceBuilder(new TropicsSurfaceBuilder()) - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(0.1F, 0.6F); - - public static final BTABiome wetlandsHills = new WetlandsBiome(WETLANDS_HILLS_ID, "betterbiomes:wetlands_hills", Climate.TROPICAL) - .setBiomeName("Wetlands Hills") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setSpawnsSugarCane() - .setSpawnsWitchHuts() - .setMinMaxHeight(-0.2F, 0.6F) - .setTemperatureRainfall(0.8F, 0.9F); - - public static final BTABiome willowHills = new WillowGroveBiome(WILLOW_HILLS_ID, "betterbiomes:willow_hills", Climate.TROPICAL) - .setBiomeName("Willow Hills") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setSpawnsSugarCane() - .setSpawnsWitchHuts() - .setMinMaxHeight(0.2F, 0.6F) - .setTemperatureRainfall(0.8F, 0.8F); - - //Rivers - public static final BTABiome badlandsRiver = new BadlandsRiverBiome(BADLANDS_RIVER_ID, "betterbiomes:badlands_river") - .setBiomeName("Badlands River") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setDisableRain() - .setTemperatureRainfall(2.0F, 0.0F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver() - .setNotSpawnable(); - - public static final BTABiome mysticRiver = new MysticRiverBiome(MYSTIC_RIVER_ID, "betterbiomes:mystic_river") - .setBiomeName("Mystic River") - .setSpawnsSugarCane() - .setTemperatureRainfall(0.9F, 1.0F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver(); - - public static final BTABiome orchardRiver = new OrchardRiverBiome(ORCHARD_RIVER_ID, "betterbiomes:orchard_river") - .setBiomeName("Orchard River") - .setTemperatureRainfall(0.7F, 0.5F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver(); - - public static final BTABiome outbackRiver = new OutbackRiverBiome(OUTBACK_RIVER_ID, "betterbiomes:outback_river") - .setBiomeName("Outback River") - .setSurfaceBuilder(new OutbackSurfaceBuilder()) - .setDisableRain() - .setTemperatureRainfall(2.0F, 0.0F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver() - .setNotSpawnable(); - - public static final BTABiome patagoniaRiver = new PatagoniaRiverBiome(PATAGONIA_RIVER_ID, "betterbiomes:patagonia_river") - .setBiomeName("Patagonia River") - .setSpawnsSugarCane() - .setTemperatureRainfall(0.3F, 0.6F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver(); - - public static final BTABiome rainforestRiver = new RainforestRiverBiome(RAINFOREST_RIVER_ID, "betterbiomes:rainforest_river") - .setBiomeName("Rainforest River") - .setSpawnsSugarCane() - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver() - .setNotSpawnable(); - - public static final BTABiome tropicsRiver = new TropicsRiverBiome(TROPICS_RIVER_ID, "betterbiomes:tropics_river") - .setBiomeName("Tropics River") - .setSpawnsSugarCane() - .setSurfaceBuilder(new TropicsSurfaceBuilder()) - .setTemperatureRainfall(2.0F, 2.0F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver() - .setNotSpawnable(); - - public static final BTABiome volcanicRiver = new TropicsRiverBiome(VOLCANIC_RIVER_ID, "betterbiomes:volcanic_river") - .setBiomeName("Volcanic River") - .setSpawnsSugarCane() - .setSurfaceBuilder(new VolcanicBeachSurfaceBuilder()) - .setTemperatureRainfall(2.0F, 2.0F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver() - .setNotSpawnable(); - - public static final BTABiome wetlandsRiver = new WetlandsRiverBiome(WETLANDS_RIVER_ID, "betterbiomes:wetlands_river") - .setBiomeName("Wetlands River") - .setSpawnsSugarCane() - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setTemperatureRainfall(0.8F, 0.9F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver(); - - public static final BTABiome willowRiver = new WillowRiverBiome(WILLOW_GROVE_RIVER_ID, "betterbiomes:willow_grove_river") - .setBiomeName("Willow Grove River") - .setSpawnsSugarCane() - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setTemperatureRainfall(0.6F, 0.9F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver(); - - //Edges - public static final BTABiome alpineEdge = new AlpineBiome(ALPINE_EDGE_ID, "betterbiomes:alpine_edge", Climate.COLD) - .setBiomeName("Alpine Edge") - .setSurfaceBuilder(new AlpineSurfaceBuilder()) - .setTemperatureRainfall(0.2F, 0.8F) - .setMinMaxHeight(0.2F, 0.5F) - .setEdge(); - - public static final BTABiome highlandsEdge = new HighlandsBiome(HIGHLANDS_EDGE_ID, "betterbiomes:highlands_edge", Climate.TEMPERATE) - .setBiomeName("Highlands Edge") - .setTemperatureRainfall(0.7F, 0.5F) - .setMinMaxHeight(0.2F, 0.5F) - .setEdge(); - - public static final BTABiome hotSpringsEdge = new HotSpringsBiome(HOT_SPRINGS_EDGE_ID, "betterbiomes:hot_springs_edge", Climate.COLD) - .setBiomeName("Hot Springs Edge") - .setSurfaceBuilder(new HotSpringsSurfaceBuilder(HOT_SPRINGS_EDGE_ID, false)) - .setTemperatureRainfall(0.5F, 0.4F) - .setMinMaxHeight(0.8F, 1.2F) - .setDecoOnly(); - - public static final BTABiome rainforestEdge = new RainforestEdgeBiome(RAINFOREST_EDGE_ID, "betterbiomes:rainforest_edge", Climate.TROPICAL) - .setBiomeName("Rainforest Edge") - .setSpawnsSugarCane() - .setSpawnsJungleTemples() - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(0.3F, 1.5F) - .setEdge() - .setNotSpawnable(); - - public static final BTABiome tropicsEdge = new TropicsBiome(TROPICS_EDGE_ID, "betterbiomes:tropics_edge", Climate.TROPICAL) - .setBiomeName("Tropics Edge") - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(-0.3F, 0.1F) - .setEdge() - .setNotSpawnable(); - - //Beaches - public static final BTABiome redSandBeach = new RedSandBeachBiome(RED_SAND_BEACH_ID, "betterbiomes:red_sand_beach", Climate.ARID) - .setBiomeName("Red Sand Beach") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setDisableRain() - .setTemperatureRainfall(2.0F, 0.0F) - .setMinMaxHeight(0.0F, 0.1F) - .setBeach() - .setNotSpawnable(); - - public static final BTABiome volcanicBeach = new BeachBiome(VOLCANIC_BEACH_ID, "betterbiomes:volcanic_beach", Climate.TROPICAL) - .setBiomeName("Volcanic Beach") - .setSurfaceBuilder(new VolcanicBeachSurfaceBuilder()) - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(0.0F, 0.1F) - .setBeach() - .setNotSpawnable(); - - // ------ Nether Biomes ------ // - public static final BTABiome ashFields = new AshFieldsBiome(ASH_FIELDS_ID, "betterbiomes:ash_fields") - .setBiomeName("Ash Fields") - .setSurfaceBuilder(new AshFieldsSurfaceBuilder()) - .setNether(); - - public static final BTABiome basaltDeltas = new BasaltDeltasBiome(BASALT_DELTAS_ID, "betterbiomes:basalt_deltas") - .setBiomeName("Basalt Deltas") - .setSurfaceBuilder(new BasaltDeltasSurfaceBuilder()) - .setNether(); - - public static final BTABiome soulSandValley = new SoulSandValleyBiome(SOUL_SAND_VALLEY_ID, "betterbiomes:soul_sand_valley") - .setBiomeName("Soul Sand Valley") - .setSurfaceBuilder(new SoulSandValleySurfaceBuilder()) - .setNether(); - - public static final BTABiome obsidianGrove = null; - - public static final BTABiome crystalCaverns = new CrystalCavernsBiome(CRYSTAL_CAVERNS_ID, "betterbiomes:crystal_caverns") - .setBiomeName("Crystal Caverns") - .setSurfaceBuilder(new CrystalCavernsSurfaceBuilder()) - .setNether(); - - public static final BTABiome petrifiedForest = new PetrifiedForestBiome(PETRIFIED_FOREST_ID, "betterbiomes:petrified_forest") - .setBiomeName("Petrified Forest") - .setSurfaceBuilder(new NetherSurfaceBuilder()) - .setNether(); - - // ------ Deprecated ------ // - public static final BTABiome aspenGrove = new AspenGroveBiome(ASPEN_GROVE_ID, "betterbiomes:aspen_grove", Climate.COLD) - .setBiomeName("Aspen Grove") - .setTemperatureRainfall(0.2F, 0.8F) - .setMinMaxHeight(0.5F, 3.0F); - - public static final BTABiome badlandsEdge = new BadlandsBiome(BADLANDS_EDGE_ID, "betterbiomes:badlands_edge", Climate.ARID) - .setBiomeName("Badlands Edge") - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setSpawnsRedDesertTemples() - .setDisableRain() - .setTemperatureRainfall(2.0F, 0.0F) - .setMinMaxHeight(0.1F, 0.1F) - .setEdge(); - - public static final BTABiome coniferousForestClearing = new ConiferousForestClearingBiome(CONIFEROUS_FOREST_CLEARING_ID, "betterbiomes:coniferous_forest_clearing", Climate.COLD) - .setBiomeName("Coniferous Forest Clearing") - .setTemperatureRainfall(0.5F, 0.4F) - .setMinMaxHeight(0.3F, 1.2F); - - public static final BTABiome heathlandWoods = new HeathlandWoodsBiome(HEATHLAND_WOODS_ID, "betterbiomes:heathland_woods", Climate.TEMPERATE) - .setBiomeName("Heathland Woods") - .setSpawnsPumpkins() - .setSpawnsVillages(false) - .setTemperatureRainfall(0.7F, 0.4F) - .setMinMaxHeight(0.1F, 0.5F); - - public static final BTABiome highlandsEdgeOld = new HighlandsBiome(HIGHLANDS_EDGE_OLD_ID, "betterbiomes:highlands_edge_old", Climate.TEMPERATE) - .setBiomeName("Highlands Edge") - .setTemperatureRainfall(0.7F, 0.5F) - .setMinMaxHeight(0.8F, 2.5F) - .setEdge(); - - public static final BTABiome oldValley = new OldValleyBiome(OLD_VALLEY_ID, "betterbiomes:old_valley", Climate.TROPICAL) - .setBiomeName("Old Valley") - .setTemperatureRainfall(0.7F, 0.8F) - .setMinMaxHeight(0.1F, 0.8F); - - public static final BTABiome orchardClearing = new OrchardClearingBiome(ORCHARD_CLEARING_ID, "betterbiomes:orchard_clearing", Climate.TEMPERATE) - .setBiomeName("Orchard Clearing") - .setSpawnsVillages(false) - .setSpawnsPumpkins() - .setTemperatureRainfall(0.7F, 0.5F); - - public static final BTABiome snowyConiferousForestClearing = new ConiferousForestClearingBiome(SNOWY_CONIFEROUS_FOREST_CLEARING_ID, "betterbiomes:snowy_coniferous_forest_clearing", Climate.SNOWY) - .setBiomeName("Snowy Coniferous Forest Clearing") - .setEnableSnow() - .setTemperatureRainfall(0.1F, 0.4F) - .setMinMaxHeight(0.3F, 1.2F); - - public static final BTABiome woodedSteppe = new WoodedSteppeBiome(WOODED_STEPPE_ID, "betterbiomes:wooded_steppe", Climate.TEMPERATE) - .setBiomeName("Wooded Steppe") - .setSpawnsVillages(true) - .setSpawnsDesertTemples() - .setTemperatureRainfall(0.8F, 0.1F) - .setMinMaxHeight(0.3F, 0.5F) - .setNotSpawnable(); - - private static ArrayList betterBiomes = new ArrayList(); - - private BetterBiomesConfiguration() {} - - public void addBiomesToList(ArrayList biomeList) { - betterBiomes.add(BTABiomeConfiguration.woods); - betterBiomes.add(BTABiomeConfiguration.desert); - betterBiomes.add(lushDesert); - betterBiomes.add(savanna); - betterBiomes.add(wetlands); - betterBiomes.add(birchForest); - betterBiomes.add(snowyWoods); - betterBiomes.add(chaparral); - betterBiomes.add(ancientForest); - betterBiomes.add(tropics); - betterBiomes.add(BTABiomeConfiguration.jungle); - betterBiomes.add(alpine); - betterBiomes.add(fungalForest); - betterBiomes.add(coniferousForest); - betterBiomes.add(snowyConiferousForest); - betterBiomes.add(mysticValley); - betterBiomes.add(rainforest); - betterBiomes.add(meadow); - betterBiomes.add(BTABiomeConfiguration.mountains); - betterBiomes.add(dunes); - betterBiomes.add(heathland); - betterBiomes.add(temperateForest); - betterBiomes.add(valleyMountains); - betterBiomes.add(BTABiomeConfiguration.tundra); - betterBiomes.add(orchard); - betterBiomes.add(steppe); - - betterBiomes.add(willowGrove); - betterBiomes.add(BTABiomeConfiguration.icyPeaks); - betterBiomes.add(patagonia); - betterBiomes.add(grasslands); - betterBiomes.add(BTABiomeConfiguration.siberia); - betterBiomes.add(BTABiomeConfiguration.plains); - betterBiomes.add(frozenSprings); - betterBiomes.add(mangroveForest); - betterBiomes.add(BTABiomeConfiguration.aridForest); - betterBiomes.add(borealForest); - betterBiomes.add(shield); - betterBiomes.add(brushland); - betterBiomes.add(highlands); - betterBiomes.add(floralForest); - - betterBiomes.add(outback); - betterBiomes.add(cherryForest); - betterBiomes.add(badlandsPlateau); - betterBiomes.add(autumnForest); - betterBiomes.add(hotSprings); - betterBiomes.add(volcanicJungle); - betterBiomes.add(firCanyon); - betterBiomes.add(ivoryHills); - - biomeList.addAll(betterBiomes); - - //BTA vanilla biomes added in to keep backwards compatible order - for (int i = 0; i < betterBiomes.size(); i++) { - if (betterBiomes.get(i).getInternalName().startsWith("betterterrain")) { - betterBiomes.remove(i); - i--; - } - } - - FCUtilsHardcoreSpawn.blacklistedBiomes.add(tropics); - FCUtilsHardcoreSpawn.blacklistedBiomes.add(tropicsRiver); - FCUtilsHardcoreSpawn.blacklistedBiomes.add(tropicsEdge); - - FCUtilsHardcoreSpawn.blacklistedBiomes.add(rainforest); - FCUtilsHardcoreSpawn.blacklistedBiomes.add(rainforestRiver); - FCUtilsHardcoreSpawn.blacklistedBiomes.add(rainforestEdge); - - FCUtilsHardcoreSpawn.blacklistedBiomes.add(volcanicJungle); - FCUtilsHardcoreSpawn.blacklistedBiomes.add(volcanicBeach); - } - - public void setBiomeVariants() { - //Sub biomes - WorldConfigurationInfo.Condition pre140 = new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_3_4); - } - }; - - alpine.addSubVariant(aspenGrove, pre140); - ancientForest.addSubVariant(ancientForestHills); - autumnForest.addSubVariant(autumnForestHills); - badlandsPlateau.addSubVariant(badlands); - birchForest.addSubVariant(birchForestHills); - borealForest.addSubVariant(borealForestHills); - chaparral.addSubVariant(chaparralHills); - cherryForest.addSubVariant(cherryForestHills); - coniferousForest.addSubVariant(coniferousForestClearing, pre140); - firCanyon.addSubVariant(firCanyonValley); - fungalForest.addSubVariant(fungalForestFlat); - grasslands.addSubVariant(grasslandsLake); - heathland.addSubVariant(heathlandWoods, pre140); - ivoryHills.addSubVariant(ivoryPlains); - orchard.addSubVariant(orchardClearing, pre140); - patagonia.addSubVariant(patagoniaMountains); - savanna.addSubVariant(savannaHills, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtOrBelow(BTAVersion.V2_0_2); - } - }); - savanna.addSubVariant(savannaPlateau, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtLeast(BTAVersion.V2_0_3); - } - }); - snowyConiferousForest.addSubVariant(snowyConiferousForestClearing, pre140); - snowyWoods.addSubVariant(snowyWoodsHills); - steppe.addSubVariant(woodedSteppe, pre140); - valleyMountains.addSubVariant(valley); - - //Sub biomes (Common) - lushDesert.addSubVariantCommon(oasis); - floralForest.addSubVariantCommon(floralPlateau); - wetlands.addSubVariantCommon(wetlandsHills); - willowGrove.addSubVariantCommon(willowHills); - - //Sporadic - frozenSprings.addSporadicVariant(frozenSpringsPond); - frozenSprings.addSporadicChance(3); - - wetlands.addSporadicVariant(wetlandsRiver); - wetlandsHills.addSporadicVariant(wetlandsRiver); - wetlands.addSporadicChance(5); - wetlandsHills.addSporadicChance(5); - - willowGrove.addSporadicVariant(willowRiver); - willowHills.addSporadicVariant(willowRiver); - willowGrove.addSporadicChance(5); - willowHills.addSporadicChance(5); - - rainforest.addSporadicVariant(rainforestRiver); - rainforest.addSporadicChance(8); - - lushDesert.addSporadicVariant(oasis); - lushDesert.addSporadicChance(8); - - mangroveForest.addSporadicVariant(mangroveForestIsland); - mangroveForest.addSporadicChance(3); - - //Beaches - WorldConfigurationInfo.Condition pre132 = new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_3_1); - } - }; - - alpine.setHasBeach(false); - alpineEdge.setHasBeach(false); - fungalForest.setHasBeach(false); - fungalForestFlat.setHasBeach(false); - coniferousForest.setHasBeach(false); - snowyConiferousForest.setHasBeach(false); - mysticValley.setHasBeach(false); - temperateForest.setHasBeach(false); - oldValley.setHasBeach(false); - valleyMountains.setHasBeach(false); - snowyWoods.setHasBeach(false, pre132); - snowyWoodsHills.setHasBeach(false); - badlandsPlateau.setHasBeach(false); - rainforest.setHasBeach(false); - tropics.setHasBeach(false); - patagoniaMountains.setHasBeach(false); - frozenSprings.setHasBeach(false, pre132); - mangroveForest.setHasBeach(false); - mangroveForestIsland.setHasBeach(false); - highlands.setHasBeach(false); - highlandsEdge.setHasBeach(false); - - outback.addBeachVariant(redSandBeach); - badlands.addBeachVariant(redSandBeach); - firCanyon.addBeachVariant(redSandBeach); - firCanyonValley.addBeachVariant(redSandBeach); - - ivoryHills.addBeachVariant(ivoryPlains); - - volcanicJungle.addBeachVariant(volcanicBeach); - - WorldConfigurationInfo.Condition post132 = new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtLeast(BTAVersion.V1_3_2); - } - }; - - snowyWoods.addBeachVariant(BTABiomeConfiguration.frozenBeach, post132); - frozenSprings.addBeachVariant(BTABiomeConfiguration.frozenBeach, post132); - - //Rivers - dunes.addRiverVariant(BTABiomeConfiguration.desertRiver); - - mysticValley.addRiverVariant(mysticRiver); - - rainforest.addRiverVariant(rainforestRiver); - rainforestEdge.addRiverVariant(rainforestRiver); - - outback.addRiverVariant(outbackRiver); - - badlands.addRiverVariant(badlandsRiver); - badlandsPlateau.addRiverVariant(badlandsRiver); - badlandsEdge.addRiverVariant(badlandsRiver); - firCanyon.addRiverVariant(badlandsRiver); - firCanyonValley.addRiverVariant(badlandsRiver); - - tropics.addRiverVariant(tropicsRiver); - tropicsEdge.addRiverVariant(tropicsRiver); - - orchard.addRiverVariant(orchardRiver); - orchardClearing.addRiverVariant(orchardRiver); - - wetlands.addRiverVariant(wetlandsRiver); - wetlandsHills.addRiverVariant(wetlandsRiver); - - willowGrove.addRiverVariant(willowRiver); - willowHills.addRiverVariant(willowRiver); - - patagonia.addRiverVariant(patagoniaRiver); - patagoniaMountains.addRiverVariant(patagoniaRiver); - - volcanicJungle.addRiverVariant(volcanicRiver); - volcanicBeach.addRiverVariant(volcanicRiver); - - for (BTABiome b : betterBiomes) { - if (b.getEnableSnow()) { - b.addRiverVariant(BTABiomeConfiguration.frozenRiver); - } - } - - //Edges - alpine.addEdgeVariant(alpineEdge); - valleyMountains.addEdgeVariant(valley); - dunes.addEdgeVariant(BTABiomeConfiguration.desert); - badlandsPlateau.addEdgeVariant(badlands, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtLeast(BTAVersion.V3_0_0); - } - }); - badlands.addEdgeVariant(badlandsEdge, pre140); - badlandsPlateau.addEdgeVariant(badlandsEdge, pre140); - firCanyon.addEdgeVariant(firCanyonValley); - highlands.addEdgeVariant(highlandsEdgeOld, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtOrBelow(BTAVersion.V2_0_8); - } - }); - highlands.addEdgeVariant(highlandsEdge, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtLeast(BTAVersion.V3_0_0); - } - }); - //hotSprings.addEdgeVariant(hotSpringsEdge); - rainforest.addEdgeVariant(rainforestEdge, post132); - tropics.addEdgeVariant(tropicsEdge, post132); - } - - /** - * Legacy code maintained for backwards compatibility - */ - public static int getEdgeVariantForBiomeGuaranteed(int baseBiome, WorldConfigurationInfo generatorInfo) { - int edgeBiome = -1; - - if (baseBiome == badlandsPlateau.biomeID) { - edgeBiome = badlands.biomeID; - } - - return edgeBiome; - } - - private static BetterBiomesConfiguration instance; - - public static BetterBiomesConfiguration getInstance() { - if (instance == null) { - instance = new BetterBiomesConfiguration(); - } - - return instance; - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/AlpineBiome.java b/minecraft/betterbiomes/biome/biomes/AlpineBiome.java deleted file mode 100644 index 2c5cddd..0000000 --- a/minecraft/betterbiomes/biome/biomes/AlpineBiome.java +++ /dev/null @@ -1,37 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenerator; - -public class AlpineBiome extends BTABiome { - public AlpineBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 20; - this.btaBiomeDecorator.grassPerChunk = 2; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return (WorldGenerator)(par1Random.nextInt(3) == 0 ? new TaigaGen5(false) : new WorldGenTaiga2(false)); - } - - public void decorate(World var1, Random var2, int var3, int var4, WorldConfigurationInfo generatorOptions) - { - super.decorate(var1, var2, var3, var4, generatorOptions); - this.addEmeralds(var1, var2, var3, var4); - this.addSilverfishBlocks(var1, var2, var3, var4); - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/AshFieldsBiome.java b/minecraft/betterbiomes/biome/biomes/AshFieldsBiome.java deleted file mode 100644 index 6c61962..0000000 --- a/minecraft/betterbiomes/biome/biomes/AshFieldsBiome.java +++ /dev/null @@ -1,30 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterterrain.DecoIntegration; -import betterterrain.biome.BTANetherBiome; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.Vec3; -import net.minecraft.src.World; - -public class AshFieldsBiome extends BTANetherBiome { - public AshFieldsBiome(int id, String internalName) { - super(id, internalName); - - if (DecoIntegration.isDecoInstalled()) { - this.topBlockExt = DecoIntegration.ash.blockID; - this.fillerBlockExt = DecoIntegration.ash.blockID; - } - - this.spawnableMonsterList.clear(); - this.spawnableCreatureList.clear(); - this.spawnableWaterCreatureList.clear(); - this.spawnableCaveCreatureList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 50, 4, 4)); - } - - @Override - public Vec3 getFogColor(World world) { - return world.getWorldVec3Pool().getVecFromPool(0.3, 0.2, 0.1); - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/BasaltDeltasBiome.java b/minecraft/betterbiomes/biome/biomes/BasaltDeltasBiome.java deleted file mode 100644 index 95cde0a..0000000 --- a/minecraft/betterbiomes/biome/biomes/BasaltDeltasBiome.java +++ /dev/null @@ -1,115 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.world.generate.surface.BasaltDeltasSurfaceBuilder; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTANetherBiome; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityMagmaCube; -import net.minecraft.src.FCUtilsBlockPos; -import net.minecraft.src.Material; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.Vec3; -import net.minecraft.src.World; - -public class BasaltDeltasBiome extends BTANetherBiome { - public BasaltDeltasBiome(int id, String internalName) { - super(id, internalName); - - if (DecoIntegration.isDecoInstalled()) { - this.topBlockExt = DecoIntegration.basalt.blockID; - this.fillerBlockExt = DecoIntegration.basalt.blockID; - } - else { - this.topBlockExt = Block.stone.blockID; - this.fillerBlockExt = Block.stone.blockID; - } - - this.infusedStonePerChunk = 6; - this.maxInfusedStoneHeight = 124; - this.magmaPerChunk = 8; - - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityMagmaCube.class, 1, 4, 4)); - } - - @Override - public Vec3 getFogColor(World world) { - return world.getWorldVec3Pool().getVecFromPool(0.3, 0.3, 0.3); - } - - @Override - public void decorate(World world, Random rand, int chunkX, int chunkZ, WorldConfigurationInfo generatorOptions) { - BasaltDeltasSurfaceBuilder surfaceBuilder = (BasaltDeltasSurfaceBuilder) this.getSurfaceBuilder(); - - for (int i = chunkX + 8; i < chunkX + 24; i++) { - for (int k = chunkZ + 8; k < chunkZ + 24; k++) { - double lavaNoiseScale = 1/32D; - double lavaNoise = surfaceBuilder.lavaNoiseGen.noise2(i, k, lavaNoiseScale); - - int previousBlockID = -1; - int thisBlockID = -1; - int nextBlockID = -1; - - for (int j = 32; j < 108; j++) { - if (previousBlockID == -1) { - previousBlockID = world.getBlockId(i, j - 1, k); - thisBlockID = world.getBlockId(i, j, k); - nextBlockID = world.getBlockId(i, j + 1, k); - } - else { - previousBlockID = thisBlockID; - thisBlockID = nextBlockID; - nextBlockID = world.getBlockId(i, j + 1, k); - } - - boolean useLava = lavaNoise + rand.nextDouble() * 0.3 > 0.25; - - if (previousBlockID != 0 && previousBlockID != Block.lavaStill.blockID && - (thisBlockID == this.topBlockExt || thisBlockID == DecoIntegration.infusedStone.blockID || thisBlockID == DecoIntegration.ash.blockID) && - nextBlockID == 0) { - if (useLava) { - int numBlockNeighbors = 4; - int numLavaNeighbors = 0; - - int offset = rand.nextInt(10) == 0 ? 1 : 0; - - for (int facing = 2; facing <= 5; facing++) { - FCUtilsBlockPos pos = new FCUtilsBlockPos(i, j, k, facing); - - int neighborID = world.getBlockId(pos.i, pos.j, pos.k); - if (neighborID == 0) { - numBlockNeighbors--; - - if (numBlockNeighbors < 3) - break; - } - else if (Block.blocksList[neighborID].blockMaterial == Material.lava){ - numLavaNeighbors++; - } - } - - if (numBlockNeighbors == 4 - offset) { - if (offset == 1) { - if (numLavaNeighbors > 0) { - world.setBlock(i, j, k, Block.lavaMoving.blockID); - world.scheduledUpdatesAreImmediate = true; - Block.blocksList[Block.lavaMoving.blockID].updateTick(world, i, j, k, rand); - world.scheduledUpdatesAreImmediate = false; - } - } - else { - world.setBlock(i, j, k, Block.lavaStill.blockID); - } - } - } - } - } - } - } - - super.decorate(world, rand, chunkX, chunkZ, generatorOptions); - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/FirCanyonBiome.java b/minecraft/betterbiomes/biome/biomes/FirCanyonBiome.java deleted file mode 100644 index 77e97b7..0000000 --- a/minecraft/betterbiomes/biome/biomes/FirCanyonBiome.java +++ /dev/null @@ -1,84 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.TaigaGen3; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.SmallShrubGen; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.feature.tree.TaigaGen6; -import betterterrain.feature.tree.TaigaGen7; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenerator; - -public class FirCanyonBiome extends BTABiome { - public FirCanyonBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 20; - - if (DecoIntegration.isDecoInstalled()) { - this.topBlockExt = DecoIntegration.redSand.blockID; - this.fillerBlockExt = DecoIntegration.redSand.blockID; - } - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(7) == 0) { - gen = new TaigaGen3(false); - } - else if (rand.nextInt(6) == 0) { - gen = new TaigaGen5(false); - } - else if (rand.nextInt(5) == 0) { - gen = new TaigaGen6(false); - } - else if (rand.nextInt(4) == 0) { - gen = new TaigaGen7(false); - } - else { - gen = new SmallShrubGen(1, 1); - } - - return gen; - } - - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - public int getBiomeGrassColor() - { - return 9341503; - } - - /** - * Provides the basic foliage color based on the biome temperature and rainfall - */ - public int getBiomeFoliageColor() - { - return 9341503; - } - - @Override - public boolean shouldConnectWithEdge(WorldConfigurationInfo generatorOptions) { - return true; - } - - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) { - return par1Random.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/FrozenSpringsBiome.java b/minecraft/betterbiomes/biome/biomes/FrozenSpringsBiome.java deleted file mode 100644 index 999af54..0000000 --- a/minecraft/betterbiomes/biome/biomes/FrozenSpringsBiome.java +++ /dev/null @@ -1,37 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.CherryTreeGen; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.WorldGenerator; -import net.minecraft.src.WorldType; - -public class FrozenSpringsBiome extends BTABiome { - public FrozenSpringsBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.treesPerChunk = 2; - this.btaBiomeDecorator.grassPerChunk = 5; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand, WorldConfigurationInfo generatorOptions, WorldType worldType) - { - WorldGenerator gen; - - if (rand.nextInt(5) == 0 && DecoIntegration.isDecoInstalled() && worldType.isDeco()) { - gen = new CherryTreeGen(); - } - else { - gen = this.worldGeneratorForest; - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/HotSpringsBiome.java b/minecraft/betterbiomes/biome/biomes/HotSpringsBiome.java deleted file mode 100644 index db5be0d..0000000 --- a/minecraft/betterbiomes/biome/biomes/HotSpringsBiome.java +++ /dev/null @@ -1,72 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.world.generate.surface.HotSpringsSurfaceBuilder; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.PineTreeGen; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.feature.tree.TaigaGen6; -import betterterrain.feature.tree.TaigaGen7; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.FCUtilsBlockPos; -import net.minecraft.src.FCUtilsColor; -import net.minecraft.src.Material; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class HotSpringsBiome extends BTABiome { - public HotSpringsBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - - spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 8, 4, 4)); - - this.btaBiomeDecorator.treesPerChunk = 8; - this.btaBiomeDecorator.grassPerChunk = 15; - // Clay messes up the hot springs - this.btaBiomeDecorator.clayPerChunk = 0; - - this.waterColorMultiplier = 0x00ffaa; - } - - @Override - public boolean shouldConnectWithEdge(WorldConfigurationInfo generatorOptions) { - return true; - } - - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) { - WorldGenerator gen; - - if (rand.nextInt(3) == 0) { - gen = new PineTreeGen(false, 2, 2); - } - else if (rand.nextInt(3) == 0) { - gen = new TaigaGen5(false); - } - else if (rand.nextInt(3) == 0) { - gen = new TaigaGen6(false); - } - else { - gen = new TaigaGen7(false); - } - - return gen; - } - - @Override - public WorldGenerator getRandomWorldGenForGrass(Random rand) { - return rand.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } - - @Override - public boolean canSnowAt(World world, int x, int y, int z) { - return super.canSnowAt(world, x, y, z) && ((HotSpringsSurfaceBuilder) this.getSurfaceBuilder()).springsNoiseGen.noise2(x, z, 1/192D) <= 0.125; - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/IvoryHillsBiome.java b/minecraft/betterbiomes/biome/biomes/IvoryHillsBiome.java deleted file mode 100644 index 82fb304..0000000 --- a/minecraft/betterbiomes/biome/biomes/IvoryHillsBiome.java +++ /dev/null @@ -1,45 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Random; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterbiomes.feature.tree.AcaciaGen; -import betterterrain.BTAVersion; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class IvoryHillsBiome extends BTABiome { - private ArrayList allowedTerracottaMetadata = new ArrayList(); - - public IvoryHillsBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - - this.btaBiomeDecorator.sandPerChunk = 0; - this.btaBiomeDecorator.sandPerChunk2 = 0; - - this.btaBiomeDecorator.treesPerChunk = 3; - this.btaBiomeDecorator.flowersPerChunk = -999; - this.btaBiomeDecorator.generateLakes = false; - } - - @Override - public boolean shouldConnectWithEdge(WorldConfigurationInfo generatorOptions) { - return true; - } - - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) { - return new AcaciaGen(false); - } - - @Override - public boolean CanLightningStrikeInBiome() { - return true; - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/MangroveForestBiome.java b/minecraft/betterbiomes/biome/biomes/MangroveForestBiome.java deleted file mode 100644 index a8bf168..0000000 --- a/minecraft/betterbiomes/biome/biomes/MangroveForestBiome.java +++ /dev/null @@ -1,54 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.MangroveGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenerator; - -public class MangroveForestBiome extends BTABiome { - - public MangroveForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 3; - this.btaBiomeDecorator.flowersPerChunk = -999; - this.btaBiomeDecorator.mushroomsPerChunk = 8; - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.clayPerChunk = 1; - this.btaBiomeDecorator.waterlilyPerChunk = 10; - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) { - return new MangroveGen(); - //return this.worldGeneratorSwamp; - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/OutbackBiome.java b/minecraft/betterbiomes/biome/biomes/OutbackBiome.java deleted file mode 100644 index dea74b9..0000000 --- a/minecraft/betterbiomes/biome/biomes/OutbackBiome.java +++ /dev/null @@ -1,71 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.SmallShrubGen; -import betterterrain.feature.tree.TinyShrubGen; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenerator; - -public class OutbackBiome extends BTABiome { - public OutbackBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - if (DecoIntegration.isDecoInstalled()) { - this.topBlockExt = DecoIntegration.redSand.blockID; - this.fillerBlockExt = DecoIntegration.redSand.blockID; - } - this.btaBiomeDecorator.generateOutback = true; - this.btaBiomeDecorator.deadBushPerChunk = 10; - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 20; - this.btaBiomeDecorator.cactiPerChunk = 15; - this.btaBiomeDecorator.sandPerChunk = 0; - this.btaBiomeDecorator.sandPerChunk2 = 0; - this.btaBiomeDecorator.flowersPerChunk = -999; - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 2, 2)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 2, 2)); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(7) == 0) { - gen = new SmallShrubGen(); - } - else if (rand.nextInt(2) == 0) { - gen = new WorldGenShrub(0, 0); - } - else { - gen = new TinyShrubGen(); - } - - return gen; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 0) : new TallGrassGen(Block.tallGrass.blockID, 1); - } - - public boolean CanLightningStrikeInBiome() - { - return true; - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/PatagoniaBiome.java b/minecraft/betterbiomes/biome/biomes/PatagoniaBiome.java deleted file mode 100644 index fecb8e4..0000000 --- a/minecraft/betterbiomes/biome/biomes/PatagoniaBiome.java +++ /dev/null @@ -1,22 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; - -public class PatagoniaBiome extends BTABiome { - public PatagoniaBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 30; - this.btaBiomeDecorator.sandPerChunk = 0; - this.btaBiomeDecorator.sandPerChunk2 = 0; - } - - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - public int getBiomeGrassColor() - { - return 15064968; - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/SavannaBiome.java b/minecraft/betterbiomes/biome/biomes/SavannaBiome.java deleted file mode 100644 index 2cc12e6..0000000 --- a/minecraft/betterbiomes/biome/biomes/SavannaBiome.java +++ /dev/null @@ -1,57 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterbiomes.feature.tree.AcaciaGen; -import betterterrain.BTAVersion; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.biome.layer.HillsLayer; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenerator; - -public class SavannaBiome extends BTABiome { - long lastRandSeed = 0; - Random rand = new Random(); - - public SavannaBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 2; - this.btaBiomeDecorator.grassPerChunk = 25; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) { - return rand.nextInt(3) == 0 ? new AcaciaGen(false) : new WorldGenShrub(0,0); - } - - @Override - public int getSubVariant(WorldConfigurationInfo generatorOptions, HillsLayer layer) { - if (this.biomeID == BetterBiomesConfiguration.savanna.biomeID) { - if (layer.getChunkSeed() != lastRandSeed) { - rand.setSeed(layer.getChunkSeed()); - lastRandSeed = layer.getChunkSeed(); - } - - if (generatorOptions.getBTAVersion().isVersionAtLeast(BTAVersion.V2_0_3)) { - if (rand.nextInt(3) == 0) { - return BetterBiomesConfiguration.savannaPlateau.biomeID; - } - else { - return this.biomeID; - } - } - else { - return BetterBiomesConfiguration.savannaHills.biomeID; - } - } - else { - return this.biomeID; - } - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/TemperateForestBiome.java b/minecraft/betterbiomes/biome/biomes/TemperateForestBiome.java deleted file mode 100644 index 9eb55d3..0000000 --- a/minecraft/betterbiomes/biome/biomes/TemperateForestBiome.java +++ /dev/null @@ -1,46 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.TaigaGen6; -import betterterrain.feature.tree.TemperateBirchGen; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenerator; - -public class TemperateForestBiome extends BTABiome { - public TemperateForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.treesPerChunk = 30; - this.btaBiomeDecorator.grassPerChunk = 5; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(4) == 0) { - gen = new WorldGenTrees(false, 6, 0, 0, false); - } - else if (rand.nextInt(4) == 0) { - gen = new WorldGenShrub(0, 0); - } - else if (rand.nextInt(3) == 0) { - gen = new TemperateBirchGen(); - } - else { - gen = new TaigaGen6(false); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/TropicsBiome.java b/minecraft/betterbiomes/biome/biomes/TropicsBiome.java deleted file mode 100644 index 56cb956..0000000 --- a/minecraft/betterbiomes/biome/biomes/TropicsBiome.java +++ /dev/null @@ -1,80 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.PalmTreeSmallGen; -import betterterrain.BTAVersion; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenerator; - -public class TropicsBiome extends BTABiome { - public TropicsBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 2; - this.btaBiomeDecorator.sandPerChunk = 100; - this.btaBiomeDecorator.sandPerChunk2 = 100; - this.btaBiomeDecorator.melonChancePerChunk = 32; - this.waterColorMultiplier = 65396; - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - } - - @Override - public boolean spawnSand(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_1_3); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(2) == 0) { - gen = new PalmTreeSmallGen(false, true);; - } - else { - gen = new WorldGenShrub(3, 3); - } - - return gen; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(4) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/TropicsRiverBiome.java b/minecraft/betterbiomes/biome/biomes/TropicsRiverBiome.java deleted file mode 100644 index 0b89d77..0000000 --- a/minecraft/betterbiomes/biome/biomes/TropicsRiverBiome.java +++ /dev/null @@ -1,46 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.biome.biomes.RiverBiome; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; - -public class TropicsRiverBiome extends RiverBiome { - public TropicsRiverBiome(int id, String internalName) { - super(id, internalName, BetterBiomesConfiguration.tropics.climate); - this.waterColorMultiplier = BetterBiomesConfiguration.tropics.waterColorMultiplier; - this.spawnableCreatureList.clear(); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - } - - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - public int getBiomeGrassColor() - { - return BetterBiomesConfiguration.tropics.getBiomeGrassColor(); - } - - /** - * Provides the basic foliage color based on the biome temperature and rainfall - */ - public int getBiomeFoliageColor() - { - return BetterBiomesConfiguration.tropics.getBiomeFoliageColor(); - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/WetlandsBiome.java b/minecraft/betterbiomes/biome/biomes/WetlandsBiome.java deleted file mode 100644 index 8e6a367..0000000 --- a/minecraft/betterbiomes/biome/biomes/WetlandsBiome.java +++ /dev/null @@ -1,71 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.feature.tree.TallSwampTreeGen; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntityWitch; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenVines; -import net.minecraft.src.WorldGenerator; - -public class WetlandsBiome extends BTABiome { - - public WetlandsBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.flowersPerChunk = -999; - this.btaBiomeDecorator.deadBushPerChunk = 1; - this.btaBiomeDecorator.mushroomsPerChunk = 8; - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.clayPerChunk = 1; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 1, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityWitch.class, 1, 1, 1)); - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 2, 2)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 2, 2)); - this.waterColorMultiplier = 10083127; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(7) == 0) { - gen = new TallSwampTreeGen(); - } - else if (rand.nextInt(3) == 0) { - gen = new TaigaGen5(false); - } - else { - gen = this.worldGeneratorSwamp; - } - - return gen; - } - - public void decorate(World par1World, Random par2Random, int par3, int par4, WorldConfigurationInfo generatorOptions) - { - super.decorate(par1World, par2Random, par3, par4, generatorOptions); - WorldGenVines var5 = new WorldGenVines(); - - for (int var6 = 0; var6 < 50; ++var6) - { - int var7 = par3 + par2Random.nextInt(16) + 8; - byte var8 = 64; - int var9 = par4 + par2Random.nextInt(16) + 8; - var5.generate(par1World, par2Random, var7, var8, var9); - } - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/biome/biomes/deprecated/ConiferousForestClearingBiome.java b/minecraft/betterbiomes/biome/biomes/deprecated/ConiferousForestClearingBiome.java deleted file mode 100644 index c3e774d..0000000 --- a/minecraft/betterbiomes/biome/biomes/deprecated/ConiferousForestClearingBiome.java +++ /dev/null @@ -1,52 +0,0 @@ -package betterbiomes.biome.biomes.deprecated; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.feature.tree.TaigaGen7; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenerator; - -public class ConiferousForestClearingBiome extends BTABiome { - public ConiferousForestClearingBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 8, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 3; - this.btaBiomeDecorator.grassPerChunk = 15; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(5) == 0) { - gen = new WorldGenTaiga2(false); - } - else if (rand.nextInt(3) == 0) { - gen = new TaigaGen5(false); - } - else { - gen = new TaigaGen7(false); - } - - return gen; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(4) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/entity/BTAEntityCrystalGolem.java b/minecraft/betterbiomes/entity/BTAEntityCrystalGolem.java deleted file mode 100644 index ad1a70c..0000000 --- a/minecraft/betterbiomes/entity/BTAEntityCrystalGolem.java +++ /dev/null @@ -1,23 +0,0 @@ -package betterbiomes.entity; - -import net.minecraft.src.EntityAIAttackOnCollide; -import net.minecraft.src.EntityAINearestAttackableTarget; -import net.minecraft.src.EntityMob; -import net.minecraft.src.EntityPlayer; -import net.minecraft.src.FCEntityAIWanderSimple; -import net.minecraft.src.World; - -public class BTAEntityCrystalGolem extends EntityMob { - public BTAEntityCrystalGolem(World world) { - super(world); - this.texture = "/bta/crystalGolem.png"; - this.tasks.addTask(1, new FCEntityAIWanderSimple(this, this.moveSpeed)); - this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false)); - this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, true)); - } - - @Override - public int getMaxHealth() { - return 30; - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/entity/BTAEntityWraith.java b/minecraft/betterbiomes/entity/BTAEntityWraith.java deleted file mode 100644 index fcbb8ad..0000000 --- a/minecraft/betterbiomes/entity/BTAEntityWraith.java +++ /dev/null @@ -1,19 +0,0 @@ -package betterbiomes.entity; - -import net.minecraft.src.EntityFlying; -import net.minecraft.src.World; - -public class BTAEntityWraith extends EntityFlying { - - public BTAEntityWraith(World par1World) { - super(par1World); - // TODO Auto-generated constructor stub - } - - @Override - public int getMaxHealth() { - // TODO Auto-generated method stub - return 0; - } - -} diff --git a/minecraft/betterbiomes/entity/BTAModelCrystalGolem.java b/minecraft/betterbiomes/entity/BTAModelCrystalGolem.java deleted file mode 100644 index 0cf6ed4..0000000 --- a/minecraft/betterbiomes/entity/BTAModelCrystalGolem.java +++ /dev/null @@ -1,131 +0,0 @@ -package betterbiomes.entity; - -import net.minecraft.src.Entity; -import net.minecraft.src.EntityLiving; -import net.minecraft.src.ModelBase; -import net.minecraft.src.ModelRenderer; - -public class BTAModelCrystalGolem extends ModelBase -{ - /** The head model for the iron golem. */ - public ModelRenderer ironGolemHead; - - /** The body model for the iron golem. */ - public ModelRenderer ironGolemBody; - - /** The right arm model for the iron golem. */ - public ModelRenderer ironGolemRightArm; - - /** The left arm model for the iron golem. */ - public ModelRenderer ironGolemLeftArm; - - /** The left leg model for the Iron Golem. */ - public ModelRenderer ironGolemLeftLeg; - - /** The right leg model for the Iron Golem. */ - public ModelRenderer ironGolemRightLeg; - - public BTAModelCrystalGolem() - { - this(0.0F); - } - - public BTAModelCrystalGolem(float par1) - { - this(par1, -7.0F); - } - - public BTAModelCrystalGolem(float par1, float par2) - { - short var3 = 128; - short var4 = 128; - this.ironGolemHead = (new ModelRenderer(this)).setTextureSize(var3, var4); - this.ironGolemHead.setRotationPoint(0.0F, 0.0F + par2, -2.0F); - this.ironGolemHead.setTextureOffset(0, 0).addBox(-4.0F, -12.0F, -5.5F, 8, 10, 8, par1); - this.ironGolemHead.setTextureOffset(24, 0).addBox(-1.0F, -5.0F, -7.5F, 2, 4, 2, par1); - this.ironGolemBody = (new ModelRenderer(this)).setTextureSize(var3, var4); - this.ironGolemBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F); - this.ironGolemBody.setTextureOffset(0, 40).addBox(-9.0F, -2.0F, -6.0F, 18, 12, 11, par1); - this.ironGolemBody.setTextureOffset(0, 70).addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, par1 + 0.5F); - this.ironGolemRightArm = (new ModelRenderer(this)).setTextureSize(var3, var4); - this.ironGolemRightArm.setRotationPoint(0.0F, -7.0F, 0.0F); - this.ironGolemRightArm.setTextureOffset(60, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 30, 6, par1); - this.ironGolemLeftArm = (new ModelRenderer(this)).setTextureSize(var3, var4); - this.ironGolemLeftArm.setRotationPoint(0.0F, -7.0F, 0.0F); - this.ironGolemLeftArm.setTextureOffset(60, 58).addBox(9.0F, -2.5F, -3.0F, 4, 30, 6, par1); - this.ironGolemLeftLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(var3, var4); - this.ironGolemLeftLeg.setRotationPoint(-4.0F, 18.0F + par2, 0.0F); - this.ironGolemLeftLeg.setTextureOffset(37, 0).addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1); - this.ironGolemRightLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(var3, var4); - this.ironGolemRightLeg.mirror = true; - this.ironGolemRightLeg.setTextureOffset(60, 0).setRotationPoint(5.0F, 18.0F + par2, 0.0F); - this.ironGolemRightLeg.addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1); - } - - /** - * Sets the models various rotation angles then renders the model. - */ - public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) - { - this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); - this.ironGolemHead.render(par7); - this.ironGolemBody.render(par7); - this.ironGolemLeftLeg.render(par7); - this.ironGolemRightLeg.render(par7); - this.ironGolemRightArm.render(par7); - this.ironGolemLeftArm.render(par7); - } - - /** - * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms - * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how - * "far" arms and legs can swing at most. - */ - public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) - { - this.ironGolemHead.rotateAngleY = par4 / (180F / (float)Math.PI); - this.ironGolemHead.rotateAngleX = par5 / (180F / (float)Math.PI); - this.ironGolemLeftLeg.rotateAngleX = -1.5F * this.func_78172_a(par1, 13.0F) * par2; - this.ironGolemRightLeg.rotateAngleX = 1.5F * this.func_78172_a(par1, 13.0F) * par2; - this.ironGolemLeftLeg.rotateAngleY = 0.0F; - this.ironGolemRightLeg.rotateAngleY = 0.0F; - } - - /** - * Used for easily adding entity-dependent animations. The second and third float params here are the same second - * and third as in the setRotationAngles method. - */ - public void setLivingAnimations(EntityLiving par1EntityLiving, float par2, float par3, float par4) - { - BTAEntityCrystalGolem var5 = (BTAEntityCrystalGolem)par1EntityLiving; - /* - int var6 = var5.getAttackTimer(); - - if (var6 > 0) - { - this.ironGolemRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)var6 - par4, 10.0F); - this.ironGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)var6 - par4, 10.0F); - } - else - { - int var7 = var5.getHoldRoseTick(); - - if (var7 > 0) - { - this.ironGolemRightArm.rotateAngleX = -0.8F + 0.025F * this.func_78172_a((float)var7, 70.0F); - this.ironGolemLeftArm.rotateAngleX = 0.0F; - } - else - { - this.ironGolemRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(par2, 13.0F)) * par3; - this.ironGolemLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(par2, 13.0F)) * par3; - } - } - */ - } - - private float func_78172_a(float par1, float par2) - { - return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F); - } -} diff --git a/minecraft/betterbiomes/entity/BTARenderCrystalGolem.java b/minecraft/betterbiomes/entity/BTARenderCrystalGolem.java deleted file mode 100644 index ffaaf64..0000000 --- a/minecraft/betterbiomes/entity/BTARenderCrystalGolem.java +++ /dev/null @@ -1,65 +0,0 @@ -package betterbiomes.entity; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import net.minecraft.src.Entity; -import net.minecraft.src.EntityLiving; -import net.minecraft.src.RenderLiving; - -public class BTARenderCrystalGolem extends RenderLiving -{ - /** Iron Golem's Model. */ - private BTAModelCrystalGolem ironGolemModel; - - public BTARenderCrystalGolem() - { - super(new BTAModelCrystalGolem(), 0.5F); - this.ironGolemModel = (BTAModelCrystalGolem)this.mainModel; - } - - /** - * Renders the Iron Golem. - */ - public void doRenderIronGolem(BTAEntityCrystalGolem par1EntityIronGolem, double par2, double par4, double par6, float par8, float par9) - { - super.doRenderLiving(par1EntityIronGolem, par2, par4, par6, par8, par9); - } - - /** - * Rotates Iron Golem corpse. - */ - protected void rotateIronGolemCorpse(BTAEntityCrystalGolem par1EntityIronGolem, float par2, float par3, float par4) - { - super.rotateCorpse(par1EntityIronGolem, par2, par3, par4); - - if ((double)par1EntityIronGolem.limbYaw >= 0.01D) - { - float var5 = 13.0F; - float var6 = par1EntityIronGolem.limbSwing - par1EntityIronGolem.limbYaw * (1.0F - par4) + 6.0F; - float var7 = (Math.abs(var6 % var5 - var5 * 0.5F) - var5 * 0.25F) / (var5 * 0.25F); - GL11.glRotatef(6.5F * var7, 0.0F, 0.0F, 1.0F); - } - } - - protected void rotateCorpse(EntityLiving par1EntityLiving, float par2, float par3, float par4) - { - this.rotateIronGolemCorpse((BTAEntityCrystalGolem)par1EntityLiving, par2, par3, par4); - } - - public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) - { - this.doRenderIronGolem((BTAEntityCrystalGolem)par1EntityLiving, par2, par4, par6, par8, par9); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render validOrientations = new ArrayList(0); - - FCUtilsBlockPos pos = new FCUtilsBlockPos(i, j, k, DecoUtilsBlock.getOppositeFacing(1)); - - int blockID = world.getBlockId(pos.i, pos.j, pos.k); - - if (blockID == Block.stone.blockID || - blockID == Block.grass.blockID || - blockID == Block.dirt.blockID) { - world.setBlock(i, j, k, DecoIntegration.amethystShardBlock.blockID, 1, 2); - } - } - } - - return true; - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/feature/tree/AutmnTreeGen.java b/minecraft/betterbiomes/feature/tree/AutmnTreeGen.java deleted file mode 100644 index 16bcb6c..0000000 --- a/minecraft/betterbiomes/feature/tree/AutmnTreeGen.java +++ /dev/null @@ -1,149 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.FCUtilsTrees; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class AutmnTreeGen extends WorldGenerator { - private static int leafMeta = 0; - - public AutmnTreeGen(int leafMeta) { - this.leafMeta = leafMeta; - } - - public boolean generate(World var0, Random var1, int var2, int var3, int var4) { - int var5 = 5; - int var6 = 0; - int var7 = leafMeta; - boolean var8 = false; - - int var9 = var1.nextInt(3) + var5; - boolean var10 = true; - - if (var3 >= 1 && var3 + var9 + 1 <= 256) - { - int var11; - byte var12; - int var14; - int var15; - - for (var11 = var3; var11 <= var3 + 1 + var9; ++var11) - { - var12 = 1; - - if (var11 == var3) - { - var12 = 0; - } - - if (var11 >= var3 + 1 + var9 - 2) - { - var12 = 2; - } - - for (int var13 = var2 - var12; var13 <= var2 + var12 && var10; ++var13) - { - for (var14 = var4 - var12; var14 <= var4 + var12 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = var0.getBlockId(var13, var11, var14); - - if (!var0.isAirBlock(var13, var11, var14) && var15 != Block.leaves.blockID && var15 != Block.grass.blockID && var15 != Block.dirt.blockID && var15 != Block.wood.blockID && var15 != DecoIntegration.cherryLog.blockID && var15 != DecoIntegration.cherryLeaves.blockID || var15 == DecoIntegration.autumnLeaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - { - return false; - } - else - { - var11 = var0.getBlockId(var2, var3 - 1, var4); - - if (FCUtilsTrees.CanSaplingGrowOnBlock(var0, var2, var3 - 1, var4) && var3 < 256 - var9 - 1) - { - if (var11 == Block.grass.blockID) - { - var0.setBlockWithNotify(var2, var3 - 1, var4, Block.dirt.blockID); - } - - var12 = 3; - byte var21 = 0; - int var16; - int var17; - int var18; - - for (var14 = var3 - var12 + var9; var14 <= var3 + var9; ++var14) - { - var15 = var14 - (var3 + var9); - var16 = var21 + 1 - var15 / 2; - - for (var17 = var2 - var16; var17 <= var2 + var16; ++var17) - { - var18 = var17 - var2; - - for (int var19 = var4 - var16; var19 <= var4 + var16; ++var19) - { - int var20 = var19 - var4; - - if ((Math.abs(var18) != var16 || Math.abs(var20) != var16 || var1.nextInt(2) != 0 && var15 != 0) && !Block.opaqueCubeLookup[var0.getBlockId(var17, var14, var19)]) - { - var0.setBlockAndMetadataWithNotify(var17, var14, var19, DecoIntegration.autumnLeaves.blockID, leafMeta); - } - } - } - } - - for (var14 = 0; var14 < var9; ++var14) - { - var15 = var0.getBlockId(var2, var3 + var14, var4); - - if (var0.isAirBlock(var2, var3 + var14, var4) || var15 == Block.leaves.blockID || var15 == DecoIntegration.autumnLeaves.blockID || var15 == DecoIntegration.cherryLeaves.blockID) - { - var0.setBlockAndMetadataWithNotify(var2, var3 + var14, var4, Block.wood.blockID, var6); - } - } - - if (var9 > 2) - { - var14 = var0.getBlockId(var2, var3, var4); - - if (var14 == Block.wood.blockID) - { - var15 = var0.getBlockMetadata(var2, var3, var4); - - if (var15 == var6) - { - var0.setBlockMetadata(var2, var3, var4, var15 | 12); - } - } - } - - return true; - } - else - { - return false; - } - } - } - else - { - return false; - } - } -} diff --git a/minecraft/betterbiomes/feature/tree/CherryTreeGen.java b/minecraft/betterbiomes/feature/tree/CherryTreeGen.java deleted file mode 100644 index d6f946c..0000000 --- a/minecraft/betterbiomes/feature/tree/CherryTreeGen.java +++ /dev/null @@ -1,143 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.FCUtilsTrees; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class CherryTreeGen extends WorldGenerator { - public boolean generate(World var0, Random var1, int var2, int var3, int var4) { - int var5 = 5; - int var6 = 0; - int var7 = 0; - boolean var8 = false; - - int var9 = var1.nextInt(3) + var5; - boolean var10 = true; - - if (var3 >= 1 && var3 + var9 + 1 <= 256) - { - int var11; - byte var12; - int var14; - int var15; - - for (var11 = var3; var11 <= var3 + 1 + var9; ++var11) - { - var12 = 1; - - if (var11 == var3) - { - var12 = 0; - } - - if (var11 >= var3 + 1 + var9 - 2) - { - var12 = 2; - } - - for (int var13 = var2 - var12; var13 <= var2 + var12 && var10; ++var13) - { - for (var14 = var4 - var12; var14 <= var4 + var12 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = var0.getBlockId(var13, var11, var14); - - if (!var0.isAirBlock(var13, var11, var14) && var15 != Block.leaves.blockID && var15 != Block.grass.blockID && var15 != Block.dirt.blockID && var15 != Block.wood.blockID && var15 != DecoIntegration.cherryLog.blockID && var15 != DecoIntegration.cherryLeaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - { - return false; - } - else - { - var11 = var0.getBlockId(var2, var3 - 1, var4); - - if (FCUtilsTrees.CanSaplingGrowOnBlock(var0, var2, var3 - 1, var4) && var3 < 256 - var9 - 1) - { - if (var11 == Block.grass.blockID) - { - var0.setBlock(var2, var3 - 1, var4, Block.dirt.blockID); - } - - var12 = 3; - byte var21 = 0; - int var16; - int var17; - int var18; - - for (var14 = var3 - var12 + var9; var14 <= var3 + var9; ++var14) - { - var15 = var14 - (var3 + var9); - var16 = var21 + 1 - var15 / 2; - - for (var17 = var2 - var16; var17 <= var2 + var16; ++var17) - { - var18 = var17 - var2; - - for (int var19 = var4 - var16; var19 <= var4 + var16; ++var19) - { - int var20 = var19 - var4; - - if ((Math.abs(var18) != var16 || Math.abs(var20) != var16 || var1.nextInt(2) != 0 && var15 != 0) && !Block.opaqueCubeLookup[var0.getBlockId(var17, var14, var19)]) - { - var0.setBlockAndMetadata(var17, var14, var19, DecoIntegration.cherryLeaves.blockID, var7); - } - } - } - } - - for (var14 = 0; var14 < var9; ++var14) - { - var15 = var0.getBlockId(var2, var3 + var14, var4); - - if (var0.isAirBlock(var2, var3 + var14, var4) || var15 == Block.leaves.blockID || var15 == DecoIntegration.cherryLeaves.blockID) - { - var0.setBlockAndMetadata(var2, var3 + var14, var4, DecoIntegration.cherryLog.blockID, var6); - } - } - - if (var9 > 2) - { - var14 = var0.getBlockId(var2, var3, var4); - - if (var14 == DecoIntegration.cherryLog.blockID) - { - var15 = var0.getBlockMetadata(var2, var3, var4); - - if (var15 == var6) - { - var0.setBlock(var2, var3, var4, DecoIntegration.cherryStump.blockID); - } - } - } - - return true; - } - else - { - return false; - } - } - } - else - { - return false; - } - } -} diff --git a/minecraft/betterbiomes/feature/tree/MangroveGen.java b/minecraft/betterbiomes/feature/tree/MangroveGen.java deleted file mode 100644 index 8376f60..0000000 --- a/minecraft/betterbiomes/feature/tree/MangroveGen.java +++ /dev/null @@ -1,205 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class MangroveGen extends WorldGenerator { - public boolean generate(World world, Random rand, int x, int y, int z) { - int blockIDBelow = world.getBlockId(x, y - 1, z); - - if (blockIDBelow != Block.grass.blockID && blockIDBelow != Block.waterMoving.blockID && blockIDBelow != Block.waterStill.blockID) { - return false; - } - - int var7 = 11 + rand.nextInt(3); - - for (int j = 6; j < var7; ++j) { - world.setBlock(x, y + j, z, Block.wood.blockID); - } - - this.createSwampRoots(world, rand, x, y, z); - this.createRainForestBranch(world, rand, x, y + var7 - 5, z); - this.createRainForestLeaves(world, rand, x, y + var7, z, 2); - this.createRainForestLeaves(world, rand, x, y + var7 + 1, z, 3); - this.createRainForestLeaves(world, rand, x, y + var7 + 2, z, 2); - world.setBlock(x, y + var7, z, Block.wood.blockID); - world.setBlock(x, y + var7 + 1, z, Block.wood.blockID); - - return true; - } - - private void createSwampRoots(World world, Random rand, int x, int y, int z) { - int offset1 = rand.nextInt(5); - - for (int var7 = offset1; var7 < 8; ++var7) { - world.setBlock(x, y + var7, z, Block.wood.blockID); - } - - world.setBlock(x - 1, y + offset1, z, Block.wood.blockID); - world.setBlock(x - 1, y + offset1 - 1, z, Block.wood.blockID); - world.setBlock(x - 2, y + offset1 - 1, z, Block.wood.blockID); - world.setBlock(x - 2, y + offset1 - 2, z, Block.wood.blockID); - world.setBlock(x - 2, y + offset1 - 3, z, Block.wood.blockID); - world.setBlock(x - 3, y + offset1 - 3, z, Block.wood.blockID); - - for (int j = y + offset1 - 3; j > 50; --j) { - int blockID = world.getBlockId(x - 3, j, z); - - if (blockID != 0 && blockID != Block.grass.blockID && blockID != Block.waterMoving.blockID && blockID != Block.waterStill.blockID && blockID != Block.leaves.blockID && blockID != Block.wood.blockID && blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID) { - break; - } - - world.setBlock(x - 3, j, z, Block.wood.blockID); - } - - int offset2 = 2 + rand.nextInt(5); - - for (int j = offset2; j < 8; ++j) { - world.setBlock(x, y + j, z, Block.wood.blockID); - } - - world.setBlock(x + 1, y + offset2, z, Block.wood.blockID); - world.setBlock(x + 1, y + offset2 - 1, z, Block.wood.blockID); - world.setBlock(x + 2, y + offset2 - 1, z, Block.wood.blockID); - world.setBlock(x + 2, y + offset2 - 2, z, Block.wood.blockID); - world.setBlock(x + 2, y + offset2 - 3, z, Block.wood.blockID); - world.setBlock(x + 3, y + offset2 - 3, z, Block.wood.blockID); - - for (int j = y + offset2 - 3; j > 50; --j) { - int blockID = world.getBlockId(x + 3, j, z); - - if (blockID != 0 && blockID != Block.grass.blockID && blockID != Block.waterMoving.blockID && blockID != Block.waterStill.blockID && blockID != Block.leaves.blockID && blockID != Block.wood.blockID && blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID) { - break; - } - - world.setBlock(x + 3, j, z, Block.wood.blockID); - } - - int offset3 = 2 + rand.nextInt(5); - - for (int j = offset3; j < 8; ++j) { - world.setBlock(x, y + j, z, Block.wood.blockID); - } - - world.setBlock(x, y + offset3, z - 1, Block.wood.blockID); - world.setBlock(x, y + offset3 - 1, z - 1, Block.wood.blockID); - world.setBlock(x, y + offset3 - 1, z - 2, Block.wood.blockID); - world.setBlock(x, y + offset3 - 2, z - 2, Block.wood.blockID); - world.setBlock(x, y + offset3 - 3, z - 2, Block.wood.blockID); - world.setBlock(x, y + offset3 - 3, z - 3, Block.wood.blockID); - - for (int j = y + offset3 - 3; j > 50; --j) { - int blockID = world.getBlockId(x, j, z - 3); - - if (blockID != 0 && blockID != Block.grass.blockID && blockID != Block.waterMoving.blockID && blockID != Block.waterStill.blockID && blockID != Block.leaves.blockID && blockID != Block.wood.blockID && blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID) { - break; - } - - world.setBlock(x, j, z - 3, Block.wood.blockID); - } - - int offset4 = 2 + rand.nextInt(5); - - for (int j = offset4; j < 8; ++j) { - world.setBlock(x, y + j, z, Block.wood.blockID); - } - - world.setBlock(x, y + offset4, z + 1, Block.wood.blockID); - world.setBlock(x, y + offset4 - 1, z + 1, Block.wood.blockID); - world.setBlock(x, y + offset4 - 1, z + 2, Block.wood.blockID); - world.setBlock(x, y + offset4 - 2, z + 2, Block.wood.blockID); - world.setBlock(x, y + offset4 - 3, z + 2, Block.wood.blockID); - world.setBlock(x, y + offset4 - 3, z + 3, Block.wood.blockID); - - for (int j = y + offset4 - 3; j > 50; --j) { - int blockID = world.getBlockId(x, j, z + 3); - - if (blockID != 0 && blockID != Block.grass.blockID && blockID != Block.waterMoving.blockID && blockID != Block.waterStill.blockID && blockID != Block.leaves.blockID && blockID != Block.wood.blockID && blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID) { - break; - } - - world.setBlock(x, j, z + 3, Block.wood.blockID); - } - } - - private void createRainForestBranch(World world, Random rand, int x, int y, int z) { - int var6; - int var7; - - if (rand.nextInt(4) == 0) { - world.setBlock(x + 1, y, z, Block.wood.blockID); - world.setBlock(x + 2, y + 1, z, Block.wood.blockID); - world.setBlock(x + 3, y + 2, z, Block.wood.blockID); - world.setBlock(x + 4, y + 3, z, Block.wood.blockID); - var6 = 1 + rand.nextInt(5); - this.createRainForestLeaves(world, rand, x + 4, y + 4 + var6, z, 2); - this.createRainForestLeaves(world, rand, x + 4, y + 5 + var6, z, 3); - this.createRainForestLeaves(world, rand, x + 4, y + 6 + var6, z, 2); - - for (var7 = 0; var7 <= var6; ++var7) { - world.setBlock(x + 4, y + 4 + var7, z, Block.wood.blockID); - } - } - - if (rand.nextInt(4) == 0) { - world.setBlock(x - 1, y, z, Block.wood.blockID); - world.setBlock(x - 2, y + 1, z, Block.wood.blockID); - world.setBlock(x - 3, y + 2, z, Block.wood.blockID); - world.setBlock(x - 4, y + 3, z, Block.wood.blockID); - var6 = 1 + rand.nextInt(5); - this.createRainForestLeaves(world, rand, x - 4, y + 4 + var6, z, 2); - this.createRainForestLeaves(world, rand, x - 4, y + 5 + var6, z, 3); - this.createRainForestLeaves(world, rand, x - 4, y + 6 + var6, z, 2); - - for (var7 = 0; var7 <= var6; ++var7) - { - world.setBlock(x - 4, y + 4 + var7, z, Block.wood.blockID); - } - } - - if (rand.nextInt(4) == 0) { - world.setBlock(x, y, z + 1, Block.wood.blockID); - world.setBlock(x, y + 1, z + 2, Block.wood.blockID); - world.setBlock(x, y + 2, z + 3, Block.wood.blockID); - world.setBlock(x, y + 3, z + 4, Block.wood.blockID); - var6 = 1 + rand.nextInt(5); - this.createRainForestLeaves(world, rand, x, y + 4 + var6, z + 4, 2); - this.createRainForestLeaves(world, rand, x, y + 5 + var6, z + 4, 3); - this.createRainForestLeaves(world, rand, x, y + 6 + var6, z + 4, 2); - - for (var7 = 0; var7 <= var6; ++var7) { - world.setBlock(x, y + 4 + var7, z + 4, Block.wood.blockID); - } - } - - if (rand.nextInt(4) == 0) { - world.setBlock(x, y, z - 1, Block.wood.blockID); - world.setBlock(x, y + 1, z - 2, Block.wood.blockID); - world.setBlock(x, y + 2, z - 3, Block.wood.blockID); - world.setBlock(x, y + 3, z - 4, Block.wood.blockID); - var6 = 1 + rand.nextInt(5); - this.createRainForestLeaves(world, rand, x, y + 4 + var6, z - 4, 2); - this.createRainForestLeaves(world, rand, x, y + 5 + var6, z - 4, 3); - this.createRainForestLeaves(world, rand, x, y + 6 + var6, z - 4, 2); - - for (var7 = 0; var7 <= var6; ++var7) { - world.setBlock(x, y + 4 + var7, z - 4, Block.wood.blockID); - } - } - } - - private void createRainForestLeaves(World var1, Random var2, int var3, int var4, int var5, int var6) { - for (int var7 = -var6 + var3; var7 < var6 + 1 + var3; ++var7) { - for (int var8 = -var6 + var5; var8 < var6 + 1 + var5; ++var8) { - int var9 = var1.getBlockId(var7, var4, var8); - - if (var9 == 0 && (var7 != -var6 + var3 || var8 != -var6 + var5) && (var7 != -var6 + var3 || var8 != var6 + var5) && (var7 != var6 + var3 || var8 != -var6 + var5) && (var7 != var6 + var3 || var8 != var6 + var5)) { - var1.setBlock(var7, var4, var8, Block.leaves.blockID); - } - } - } - } -} diff --git a/minecraft/betterbiomes/feature/tree/PalmTreeSmallGen.java b/minecraft/betterbiomes/feature/tree/PalmTreeSmallGen.java deleted file mode 100644 index 4f47387..0000000 --- a/minecraft/betterbiomes/feature/tree/PalmTreeSmallGen.java +++ /dev/null @@ -1,217 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.FCUtilsBlockPos; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class PalmTreeSmallGen extends WorldGenerator { - /** The minimum height of a generated tree. */ - private final int minTreeHeight; - - /** True if this tree should grow Vines. */ - private final boolean vinesGrow; - - /** The metadata value of the wood to use in tree generation. */ - private final int metaWood; - - /** The metadata value of the leaves to use in tree generation. */ - private final int metaLeaves; - - private final boolean spawnCocoa; - - public PalmTreeSmallGen(boolean par1, boolean spawnCocoa) { - this(par1, 6, 3, 3, false, spawnCocoa); - } - - public PalmTreeSmallGen(boolean par1, int par2, int par3, int par4, boolean par5, boolean spawnCocoa) - { - super(par1); - this.minTreeHeight = par2; - this.metaWood = par3; - this.metaLeaves = par4; - this.vinesGrow = par5; - this.spawnCocoa = spawnCocoa; - } - - @Override - public boolean generate(World world, Random rand, int x, int y, int z) { - if (world.getBlockId(x, y - 1, z) != Block.grass.blockID) - return false; - - int treeHeight = this.minTreeHeight + rand.nextInt(3); - //How many times the trunk shifts to the side, controls the angle of the trunk - int trunkShifts = 1 + rand.nextInt(2); - //Which direction the trunk leans - int leanDirection = rand.nextInt(4); - int leanX = 0; - int leanZ = 0; - int[] trunkShiftHeights; - - switch (leanDirection) { - //North - case 0: - leanX = 0; - leanZ = -1; - break; - //West - case 1: - leanX = -1; - leanZ = 0; - break; - //South - case 2: - leanX = 0; - leanZ = 1; - break; - //East - case 3: - leanX = 1; - leanZ = 0; - break; - default: - } - - if (!checkForValidTreeSpawn(world, x, y, z, treeHeight, trunkShifts, leanX, leanZ)) - return false; - - //Gets the heights at which to split the trunk - if (trunkShifts == 1) { - trunkShiftHeights = new int[2]; - - if (treeHeight == 6) { - trunkShiftHeights[0] = 3; - trunkShiftHeights[1] = 3; - } - else if (treeHeight == 7) { - trunkShiftHeights[0] = 4; - trunkShiftHeights[1] = 3; - } - else if (treeHeight == 8) { - trunkShiftHeights[0] = 4; - trunkShiftHeights[1] = 4; - } - } - else { - trunkShiftHeights = new int[3]; - - if (treeHeight == 6) { - trunkShiftHeights[0] = 2; - trunkShiftHeights[1] = 2; - trunkShiftHeights[2] = 2; - } - else if (treeHeight == 7) { - trunkShiftHeights[0] = 3; - trunkShiftHeights[1] = 2; - trunkShiftHeights[2] = 2; - } - else if (treeHeight == 8) { - trunkShiftHeights[0] = 3; - trunkShiftHeights[1] = 3; - trunkShiftHeights[2] = 2; - } - } - - int height = y; - - for (int i = 0; i < trunkShifts + 1; i++) { - for (int j = 0; j < trunkShiftHeights[i]; j++) { - world.setBlockAndMetadata(x + leanX * i, height, z + leanZ * i, Block.wood.blockID, metaWood); - - if (rand.nextInt(5) == 0 && this.spawnCocoa) { - int facing = rand.nextInt(4) + 2; - - FCUtilsBlockPos pos = new FCUtilsBlockPos(x + leanX * i, height, z + leanZ * i); - pos.AddFacingAsOffset(facing); - - int meta = 0; - - if (facing - 2 == 1) { - meta = 2; - } - else if (facing - 2 == 2) { - meta = 3; - } - else if (facing - 2 == 3) { - meta = 1; - } - - world.setBlockAndMetadata(pos.i, pos.j, pos.k, Block.cocoaPlant.blockID, meta); - } - - height++; - } - } - - //Places a stump - world.setBlockMetadataWithClient(x, y, z, metaWood | 12); - - generatePalmLeaves(world, x + leanX * trunkShifts, height, z + leanZ * trunkShifts); - - return true; - } - - public void generatePalmLeaves(World world, int x, int y, int z) { - //Central leaves - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - world.setBlockAndMetadata(x + i, y, z+ j, Block.leaves.blockID, metaLeaves); - } - } - - //Lower leaves around log - world.setBlockAndMetadata(x + 1, y - 1, z, Block.leaves.blockID, metaLeaves); - world.setBlockAndMetadata(x, y - 1, z + 1, Block.leaves.blockID, metaLeaves); - world.setBlockAndMetadata(x - 1, y - 1, z, Block.leaves.blockID, metaLeaves); - world.setBlockAndMetadata(x, y - 1, z - 1, Block.leaves.blockID, metaLeaves); - - //Hanging leaves - uses metadata to not despawn - for (int i = 2; i < 5; i++) { - int j = 0; - int k = 0; - - if (i == 3) - k = 1; - if (i == 4) - j = 1; - - //Sides - world.setBlockAndMetadata(x + i, y - j, z, Block.leaves.blockID, metaLeaves | 4); - world.setBlockAndMetadata(x, y - j, z + i, Block.leaves.blockID, metaLeaves | 4); - world.setBlockAndMetadata(x - i, y - j, z, Block.leaves.blockID, metaLeaves | 4); - world.setBlockAndMetadata(x, y - j, z - i, Block.leaves.blockID, metaLeaves | 4); - - //Corners - if (i < 4) { - world.setBlockAndMetadata(x + i, y - k, z + i, Block.leaves.blockID, metaLeaves | 4); - world.setBlockAndMetadata(x - i, y - k, z + i, Block.leaves.blockID, metaLeaves | 4); - world.setBlockAndMetadata(x + i, y - k, z - i, Block.leaves.blockID, metaLeaves | 4); - world.setBlockAndMetadata(x - i, y - k, z - i, Block.leaves.blockID, metaLeaves | 4); - } - } - } - - //Checks to make sure the space is clear for a tree to spawn - private boolean checkForValidTreeSpawn(World world, int x, int y, int z, int treeHeight, int trunkShifts, int leanX, int leanZ) { - leanX *= trunkShifts; - leanZ *= trunkShifts; - - //Checks trunk - - - //Checks leaves - for (int i = -4 + leanX; i < 5 + leanZ; i++) { - for (int j = -1; j < 1; j++) { - for (int k = -4 + leanZ; k < 5 + leanZ; k++) { - if (!world.isAirBlock(i + x, j + y + treeHeight, k + z)) { - return false; - } - } - } - } - - return true; - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/feature/tree/TaigaGen3.java b/minecraft/betterbiomes/feature/tree/TaigaGen3.java deleted file mode 100644 index b41465f..0000000 --- a/minecraft/betterbiomes/feature/tree/TaigaGen3.java +++ /dev/null @@ -1,168 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class TaigaGen3 extends WorldGenerator -{ - public TaigaGen3(boolean var1) - { - super(var1); - } - - @Override - public boolean generate(World var1, Random var2, int x, int y, int z) - { - int var6 = var2.nextInt(10) + 35; - int var7 = var2.nextInt(5) + 10; - int var8 = var6 - var7; - int var9 = 4; - boolean var10 = true; - - if (y >= 1 && y + var6 + 1 <= 256) - { - int var11; - int var13; - int var14; - int var15; - int var24; - - for (var11 = y; var11 <= y + 1 + var6 && var10; ++var11) - { - boolean var12 = true; - - if (var11 - y < var7) - { - var24 = 0; - } - else - { - var24 = var9; - } - - for (var13 = x - var24; var13 <= x + var24 && var10; ++var13) - { - for (var14 = z - var24; var14 <= z + var24 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = var1.getBlockId(var13, var11, var14); - - if (var15 != 0 && var15 != Block.leaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - return false; - else - { - var11 = var1.getBlockId(x, y - 1, z); - var24 = var1.getBlockId(x - 1, y - 1, z); - var13 = var1.getBlockId(x, y - 1, z - 1); - var14 = var1.getBlockId(x - 1, y - 1, z - 1); - - if ((var11 == Block.grass.blockID || var11 == Block.dirt.blockID || (DecoIntegration.isDecoInstalled() && (var11 == DecoIntegration.coarseDirt.blockID || var11 == DecoIntegration.podzol.blockID))) && y < 256 - var6 - 1) - { - if ((var24 == Block.grass.blockID || var24 == Block.dirt.blockID || (DecoIntegration.isDecoInstalled() && (var24 == DecoIntegration.coarseDirt.blockID || var24 == DecoIntegration.podzol.blockID))) && y < 256 - var6 - 1) - { - if ((var13 == Block.grass.blockID || var24 == Block.dirt.blockID || (DecoIntegration.isDecoInstalled() && (var13 == DecoIntegration.coarseDirt.blockID || var13 == DecoIntegration.podzol.blockID))) && y < 256 - var6 - 1) - { - if ((var14 == Block.grass.blockID || var24 == Block.dirt.blockID || (DecoIntegration.isDecoInstalled() && (var14 == DecoIntegration.coarseDirt.blockID || var14 == DecoIntegration.podzol.blockID))) && y < 256 - var6 - 1) - { - var1.setBlock(x, y - 1, z, Block.dirt.blockID); - var1.setBlock(x - 1, y - 1, z, Block.dirt.blockID); - var1.setBlock(x, y - 1, z - 1, Block.dirt.blockID); - var1.setBlock(x - 1, y - 1, z - 1, Block.dirt.blockID); - var15 = var2.nextInt(2); - int var16 = 1; - boolean var17 = false; - int var19; - int var18; - int var20; - - for (var18 = 0; var18 <= var8; ++var18) - { - var19 = y + var6 - var18; - - for (var20 = x - var15; var20 <= x + var15; ++var20) - { - int var21 = var20 - x; - - for (int var22 = z - var15; var22 <= z + var15; ++var22) - { - int var23 = var22 - z; - - if ((Math.abs(var21) != var15 || Math.abs(var23) != var15 || var15 <= 0) && !Block.opaqueCubeLookup[var1.getBlockId(var20, var19, var22)]) - { - this.setBlockAndMetadata(var1, var20, var19, var22, Block.leaves.blockID, 1); - this.setBlockAndMetadata(var1, var20 - 1, var19, var22, Block.leaves.blockID, 1); - this.setBlockAndMetadata(var1, var20, var19, var22 - 1, Block.leaves.blockID, 1); - this.setBlockAndMetadata(var1, var20 - 1, var19, var22 - 1, Block.leaves.blockID, 1); - } - } - } - - if (var15 >= var16) - { - var15 = var17 ? 1 : 0; - var17 = true; - ++var16; - - if (var16 > var9) - { - var16 = var9; - } - } - else - { - ++var15; - } - } - - var18 = var2.nextInt(3); - - for (var19 = 0; var19 < var6 - var18; ++var19) - { - var20 = var1.getBlockId(x, y + var19, z); - - if (var20 == 0 || var20 == Block.leaves.blockID) - { - this.setBlockAndMetadata(var1, x, y + var19, z, Block.wood.blockID, 1); - this.setBlockAndMetadata(var1, x - 1, y + var19, z, Block.wood.blockID, 1); - this.setBlockAndMetadata(var1, x, y + var19, z - 1, Block.wood.blockID, 1); - this.setBlockAndMetadata(var1, x - 1, y + var19, z - 1, Block.wood.blockID, 1); - } - } - - var1.setBlockMetadataWithClient(x, y, z, 1 | 12); // place stump - var1.setBlockMetadataWithClient(x - 1, y, z, 1 | 12); // place stump - var1.setBlockMetadataWithClient(x, y, z - 1, 1 | 12); // place stump - var1.setBlockMetadataWithClient(x - 1, y, z - 1, 1 | 12); // place stump - - return true; - } else - return false; - } else - return false; - } else - return false; - } else - return false; - } - } else - return false; - } -} diff --git a/minecraft/betterbiomes/feature/tree/TaigaGen4.java b/minecraft/betterbiomes/feature/tree/TaigaGen4.java deleted file mode 100644 index b862a5f..0000000 --- a/minecraft/betterbiomes/feature/tree/TaigaGen4.java +++ /dev/null @@ -1,139 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class TaigaGen4 extends WorldGenerator -{ - public TaigaGen4(boolean var1) - { - super(var1); - } - - @Override - public boolean generate(World var1, Random var2, int x, int y, int z) - { - int var6 = var2.nextInt(15) + 20; - int var7 = var2.nextInt(3) + 5; - int var8 = var6 - var7; - int var9 = 2 + var2.nextInt(3); - boolean var10 = true; - - if (y >= 1 && y + var6 + 1 <= 256) - { - int var11; - int var13; - int var15; - int var21; - - for (var11 = y; var11 <= y + 1 + var6 && var10; ++var11) - { - boolean var12 = true; - - if (var11 - y < var7) - { - var21 = 0; - } - else - { - var21 = var9; - } - - for (var13 = x - var21; var13 <= x + var21 && var10; ++var13) - { - for (int var14 = z - var21; var14 <= z + var21 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = var1.getBlockId(var13, var11, var14); - - if (var15 != 0 && var15 != Block.leaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - return false; - else - { - var11 = var1.getBlockId(x, y - 1, z); - - if ((var11 == Block.grass.blockID || var11 == Block.dirt.blockID || (DecoIntegration.isDecoInstalled() && (var11 == DecoIntegration.coarseDirt.blockID || var11 == DecoIntegration.podzol.blockID))) && y < 256 - var6 - 1) - { - var1.setBlock(x, y - 1, z, Block.dirt.blockID); - var21 = var2.nextInt(2); - var13 = 1; - boolean var22 = false; - int var17; - int var16; - - for (var15 = 0; var15 <= var8; ++var15) - { - var16 = y + var6 - var15; - - for (var17 = x - var21; var17 <= x + var21; ++var17) - { - int var18 = var17 - x; - - for (int var19 = z - var21; var19 <= z + var21; ++var19) - { - int var20 = var19 - z; - - if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && !Block.opaqueCubeLookup[var1.getBlockId(var17, var16, var19)]) - { - this.setBlockAndMetadata(var1, var17, var16, var19, Block.leaves.blockID, 1); - } - } - } - - if (var21 >= var13) - { - var21 = var22 ? 1 : 0; - var22 = true; - ++var13; - - if (var13 > var9) - { - var13 = var9; - } - } - else - { - ++var21; - } - } - - var15 = var2.nextInt(3); - - for (var16 = 0; var16 < var6 - var15; ++var16) - { - var17 = var1.getBlockId(x, y + var16, z); - - if (var17 == 0 || var17 == Block.leaves.blockID) - { - this.setBlockAndMetadata(var1, x, y + var16, z, Block.wood.blockID, 1); - } - } - - var1.setBlockMetadataWithClient(x, y, z, 1 | 12); // place stump - - return true; - } else - return false; - } - } else - return false; - } -} diff --git a/minecraft/betterbiomes/feature/tree/TaigaGen8.java b/minecraft/betterbiomes/feature/tree/TaigaGen8.java deleted file mode 100644 index aa767cf..0000000 --- a/minecraft/betterbiomes/feature/tree/TaigaGen8.java +++ /dev/null @@ -1,138 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class TaigaGen8 extends WorldGenerator -{ - public TaigaGen8(boolean par1) - { - super(par1); - } - - @Override - public boolean generate(World par1World, Random par2Random, int x, int y, int z) - { - int var6 = par2Random.nextInt(9) + 13; - int var7 = 4 + par2Random.nextInt(4); - int var8 = var6 - var7; - int var9 = 2; - boolean var10 = true; - - if (y >= 1 && y + var6 + 1 <= 256) - { - int var11; - int var13; - int var15; - int var21; - - for (var11 = y; var11 <= y + 1 + var6 && var10; ++var11) - { - boolean var12 = true; - - if (var11 - y < var7) - { - var21 = 0; - } - else - { - var21 = var9; - } - - for (var13 = x - var21; var13 <= x + var21 && var10; ++var13) - { - for (int var14 = z - var21; var14 <= z + var21 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = par1World.getBlockId(var13, var11, var14); - - if (var15 != 0 && var15 != Block.leaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - return false; - else - { - var11 = par1World.getBlockId(x, y - 1, z); - - if ((var11 == Block.grass.blockID || var11 == Block.dirt.blockID || (DecoIntegration.isDecoInstalled() && (var11 == DecoIntegration.coarseDirt.blockID || var11 == DecoIntegration.podzol.blockID))) && y < 256 - var6 - 1) - { - this.setBlock(par1World, x, y - 1, z, Block.dirt.blockID); - var21 = par2Random.nextInt(2); - var13 = 1; - byte var22 = 0; - int var17; - int var16; - - for (var15 = 0; var15 <= var8; ++var15) - { - var16 = y + var6 - var15; - - for (var17 = x - var21; var17 <= x + var21; ++var17) - { - int var18 = var17 - x; - - for (int var19 = z - var21; var19 <= z + var21; ++var19) - { - int var20 = var19 - z; - - if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var17, var16, var19)]) - { - this.setBlockAndMetadata(par1World, var17, var16, var19, Block.leaves.blockID, 1); - } - } - } - - if (var21 >= var13) - { - var21 = var22; - var22 = 1; - ++var13; - - if (var13 > var9) - { - var13 = var9; - } - } - else - { - ++var21; - } - } - - var15 = par2Random.nextInt(3); - - for (var16 = 0; var16 < var6 - var15; ++var16) - { - var17 = par1World.getBlockId(x, y + var16, z); - - if (var17 == 0 || var17 == Block.leaves.blockID) - { - this.setBlockAndMetadata(par1World, x, y + var16, z, Block.wood.blockID, 1); - } - } - par1World.setBlockMetadataWithClient(x, y, z, 1 | 12); // place stump - - return true; - } else - return false; - } - } else - return false; - } -} diff --git a/minecraft/betterbiomes/world/generate/surface/ConiferousForestSurfaceBuilder.java b/minecraft/betterbiomes/world/generate/surface/ConiferousForestSurfaceBuilder.java deleted file mode 100644 index 00b60bd..0000000 --- a/minecraft/betterbiomes/world/generate/surface/ConiferousForestSurfaceBuilder.java +++ /dev/null @@ -1,94 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterbiomes.feature.tree.TaigaGen3; -import betterbiomes.feature.tree.TaigaGen4; -import betterterrain.DecoIntegration; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.feature.tree.TaigaGen7; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenerator; -import net.minecraft.src.WorldType; - -public class ConiferousForestSurfaceBuilder extends SurfaceBuilder { - protected static OpenSimplexOctaves coarseDirtNoiseGenSimplex; - protected static OpenSimplexOctaves podzolNoiseGenSimplex; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random soilRand = new Random(seed); - - coarseDirtNoiseGenSimplex = new OpenSimplexOctaves(soilRand.nextLong(), 4); - podzolNoiseGenSimplex = new OpenSimplexOctaves(soilRand.nextLong(), 4); - - this.treeNoiseGen = new OpenSimplexOctaves(soilRand.nextLong(), 2); - - this.treeNoiseScale = 1/256D; - } - - @Override - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - double grassNoiseScale = 1/96D; - //k and i swapped because apparently I messed something up somewhere - boolean usePodzol = coarseDirtNoiseGenSimplex.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), grassNoiseScale) + rand.nextDouble() * 0.1D - .25 > 0; - boolean useCoarseDirt = podzolNoiseGenSimplex.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), grassNoiseScale) + rand.nextDouble() * 0.1D - .25 > 0; - - boolean sandOrGravel = (this.useSandAtLocation(i, k, rand) || this.useGravelAtLocation(i, k, rand, generatorInfo)) && surfaceJ <= seaLevel + 1; - - if (useCoarseDirt && DecoIntegration.isDecoInstalled() && worldType.isDeco() && surfaceType == SurfaceType.TOP && !sandOrGravel) { - return new int[] {DecoIntegration.coarseDirt.blockID, 0}; - } - else if (usePodzol && DecoIntegration.isDecoInstalled() && worldType.isDeco() && surfaceType == SurfaceType.TOP && !sandOrGravel) { - return new int[] {DecoIntegration.podzol.blockID, 0}; - } - else { - return super.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, surfaceType, seaLevel, rand, generatorInfo, worldType); - } - } - - public void generateTreesForBiome(World world, Random rand, WorldConfigurationInfo generatorInfo) { - int numTrees = 6; - - for (int i = 0; i < numTrees; ++i) - { - int x = this.chunkX + rand.nextInt(16) + 8; - int z = this.chunkZ + rand.nextInt(16) + 8; - - WorldGenerator gen; - - if (this.treeNoiseGen.noise2(x, z, this.treeNoiseScale) - .375 > 0 && rand.nextInt(6) < 3) { - if (rand.nextInt(5) == 0) { - gen = new WorldGenTaiga2(false); - } - else if (rand.nextInt(3) == 0) { - gen = new TaigaGen5(false); - } - else { - gen = new TaigaGen7(false); - } - } - else { - if (rand.nextInt(5) == 0) { - gen = new TaigaGen3(false); - } - else if (rand.nextInt(3) == 0) { - gen = new TaigaGen4(false); - } - else { - gen = new TaigaGen7(false); - } - } - - gen.setScale(1.0D, 1.0D, 1.0D); - gen.generate(world, rand, x, world.getHeightValue(x, z), z); - } - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/world/generate/surface/CrystalCavernsSurfaceBuilder.java b/minecraft/betterbiomes/world/generate/surface/CrystalCavernsSurfaceBuilder.java deleted file mode 100644 index 72454ac..0000000 --- a/minecraft/betterbiomes/world/generate/surface/CrystalCavernsSurfaceBuilder.java +++ /dev/null @@ -1,45 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.NetherSurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.Block; -import net.minecraft.src.WorldType; - -public class CrystalCavernsSurfaceBuilder extends NetherSurfaceBuilder { - protected static OpenSimplexOctaves amethystNoiseGen; - protected static OpenSimplexOctaves amethystNoiseGen2; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random grassRand = new Random(seed + 3000); - - amethystNoiseGen = new OpenSimplexOctaves(grassRand.nextLong(), 2); - amethystNoiseGen2 = new OpenSimplexOctaves(grassRand.nextLong(), 2); - } - - @Override - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, boolean isReversed, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - double pumiceNoiseScale = 0.0625D; - //k and i swapped because apparently I messed something up somewhere - boolean useAmethyst = amethystNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), pumiceNoiseScale) > 0.2; - boolean useAmethyst2 = amethystNoiseGen2.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), pumiceNoiseScale) > 0.2; - - if (useAmethyst && DecoIntegration.isDecoInstalled() && worldType.isDeco() && surfaceType != SurfaceType.SUBFILLER) { - return new int[] {DecoIntegration.amethyst.blockID, 0}; - } - else if (useAmethyst2 && DecoIntegration.isDecoInstalled() && worldType.isDeco() && surfaceType != SurfaceType.SUBFILLER) { - return new int[] {DecoIntegration.amethyst.blockID, 0}; - } - else { - return new int[] {getDefaultSurfaceBlock(i, k, surfaceType, Block.netherrack.blockID), 0}; - } - } -} \ No newline at end of file diff --git a/minecraft/betterbiomes/world/generate/surface/FirCanyonSurfaceBuilder.java b/minecraft/betterbiomes/world/generate/surface/FirCanyonSurfaceBuilder.java deleted file mode 100644 index 0173394..0000000 --- a/minecraft/betterbiomes/world/generate/surface/FirCanyonSurfaceBuilder.java +++ /dev/null @@ -1,128 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.ArrayList; -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.NoShorelineSurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.Block; -import net.minecraft.src.WorldType; - -public class FirCanyonSurfaceBuilder extends NoShorelineSurfaceBuilder { - private static ArrayList allowedTerracottaMetadata = new ArrayList(); - private static int[] metaLocations; - - protected OpenSimplexOctaves grassNoiseGen; - protected OpenSimplexOctaves coarseDirtNoiseGen; - - private final boolean generateTerracotta; - - public FirCanyonSurfaceBuilder(boolean generateTerracotta) { - this.generateTerracotta = generateTerracotta; - } - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random metaRand = new Random(seed + 100); - - //Init terracotta striping data - done statically in case multiple badlands variants use this surface builder - if (allowedTerracottaMetadata.size() == 0) { - allowedTerracottaMetadata.add(1); - allowedTerracottaMetadata.add(3); - allowedTerracottaMetadata.add(7); - allowedTerracottaMetadata.add(11); - allowedTerracottaMetadata.add(14); - allowedTerracottaMetadata.add(15); - } - - if (metaLocations == null) { - metaLocations = new int[128]; - - for (int i = 0; i < metaLocations.length; i++) { - int meta = metaRand.nextInt(16); - - if (allowedTerracottaMetadata.contains(meta)) { - metaLocations[i] = meta; - } - else { - //Tries a second time to place a colored stripe - meta = metaRand.nextInt(16); - - if (allowedTerracottaMetadata.contains(meta)) { - metaLocations[i] = meta; - } - else { - metaLocations[i] = -1; - } - } - } - } - - grassNoiseGen = new OpenSimplexOctaves(metaRand.nextLong(), 4); - coarseDirtNoiseGen = new OpenSimplexOctaves(metaRand.nextLong(), 4); - } - - @Override - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - double dirtNoiseScale = 1/96D; - //k and i swapped because apparently I messed something up somewhere - boolean useCoarseDirt = coarseDirtNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), dirtNoiseScale) + rand.nextDouble() * 0.15D > -0.125; - - if (useCoarseDirt && DecoIntegration.isDecoInstalled() && worldType.isDeco()) { - double grassNoiseScale = 1/48D; - //k and i swapped because apparently I messed something up somewhere - boolean useGrass = grassNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), grassNoiseScale) + rand.nextDouble() * 0.15D > -0.125; - - switch (surfaceType) { - case TOP: - if (useGrass) { - if (j >= seaLevel - 1) { - return new int[] {Block.grass.blockID, 0}; - } - else { - return new int[] {Block.dirt.blockID, 0}; - } - } - else { - return new int[] {DecoIntegration.coarseDirt.blockID, 0}; - } - case FILLER: - return new int[] {Block.dirt.blockID, 0}; - default: - return new int[] {Block.stone.blockID, 0}; - } - } - else if (generateTerracotta) { - int blockID = DecoIntegration.terracotta.blockID; - int metadata = 0; - - if (blockID == DecoIntegration.terracotta.blockID && metaLocations[j & 15] != -1) { - if (j < 95 || (j < 127 && j != surfaceJ)) { - blockID = DecoIntegration.stainedTerracotta.blockID; - metadata = metaLocations[j & 15]; - } - } - - return new int[] {blockID, metadata}; - } - else { - return super.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, surfaceType, seaLevel, rand, generatorInfo, worldType); - } - } - - @Override - protected int getSubsurfaceDepth(Random rand) { - if (this.generateTerracotta) { - return 10; - } - else { - return super.getSubsurfaceDepth(rand); - } - } -} \ No newline at end of file diff --git a/minecraft/betterterrain/BTAMod.java b/minecraft/betterterrain/BTAMod.java deleted file mode 100644 index 2c8837c..0000000 --- a/minecraft/betterterrain/BTAMod.java +++ /dev/null @@ -1,81 +0,0 @@ -package betterterrain; - -import betterterrain.biome.BiomeConfiguration; -import betterterrain.block.BTABlockClay; -import betterterrain.item.BTAItemBloodMossSpores; -import betterterrain.item.BTAItemPileSoulSand; -import betterterrain.world.type.BTADefaultWorldType; -import betterterrain.world.type.BetaWorldType; -import betterterrain.world.type.SkyWorldType; -import net.minecraft.src.Block; -import net.minecraft.src.EntityList; -import net.minecraft.src.FCAddOn; -import net.minecraft.src.FCAddOnHandler; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.Item; -import net.minecraft.src.ItemMultiTextureTile; -import net.minecraft.src.MapColor; -import net.minecraft.src.Material; -import net.minecraft.src.RenderManager; -import net.minecraft.src.ServerCommandManager; -import net.minecraft.src.WorldType; - -public class BTAMod extends FCAddOn { - private static BTAMod instance; - - public final BTAVersion currentVersion; - - public static final WorldType BTAWorldType = new BTADefaultWorldType(4, "BTA"); - public static final WorldType BTAWorldTypeDeco = new BTADefaultWorldType(5, "BTADeco").setIsDeco().setCanBeCreated(false).setParent(BTAWorldType); - public static final WorldType BTAWorldTypeBeta = new BetaWorldType(6, "BTABeta"); - public static final WorldType BTAWorldTypeBetaDeco = new BetaWorldType(7, "BTABetaDeco").setIsDeco().setCanBeCreated(false).setParent(BTAWorldTypeBeta); - public static final WorldType BTAWorldTypeSky = new SkyWorldType(8, "BTASky"); - public static final WorldType BTAWorldTypeSkyDeco = new SkyWorldType(9, "BTASkyDeco").setIsDeco().setCanBeCreated(false).setParent(BTAWorldTypeSky); - public static final WorldType BTAWorldTypeSmall = new BTADefaultWorldType(10, "BTASmall").setCanBeCreated(false).setParent(BTAWorldType); - public static final WorldType BTAWorldTypeSmallDeco = new BTADefaultWorldType(11, "BTASmallDeco").setIsDeco().setCanBeCreated(false).setParent(BTAWorldType); - - public static Material netherSand; - - private BTAMod() { - super("Better Terrain", "3.0.0", "BTA"); - this.currentVersion = BTAVersion.fromString(this.getVersionString()); - } - - @Override - public void Initialize() { - ServerCommandManager.registerAddonCommand(new BiomeCommand()); - - DecoIntegration.init(); - - netherSand = new Material(MapColor.sandColor).setRequiresTool().SetNetherMobsCanSpawnOn(); - - FCBetterThanWolves.fcItemPileSoulSand = Item.replaceItem(FCBetterThanWolves.fcItemPileSoulSand.itemID, BTAItemPileSoulSand.class, instance); - - Block.blockClay = Block.replaceBlock(Block.blockClay.blockID, BTABlockClay.class, instance); - Item.itemsList[Block.blockClay.blockID] = new ItemMultiTextureTile(Block.blockClay.blockID - 256, Block.blockClay, new String[] {"dirt", "sand", "redSand", "grass"}); - - FCBetterThanWolves.fcItemBloodMossSpores = Item.replaceItem(FCBetterThanWolves.fcItemBloodMossSpores.itemID, BTAItemBloodMossSpores.class, instance); - Block.blockNetherQuartz.SetBlockMaterial(FCBetterThanWolves.fcMaterialNetherRock); - Block.slowSand.SetBlockMaterial(netherSand); - - for (FCAddOn mod : FCAddOnHandler.m_ModList.values()) { - if (mod instanceof BTAAddon) { - BTAAddon addon = (BTAAddon) mod; - addon.currentVersion = AddonVersion.fromString(addon.getVersionString(), addon); - } - } - } - - @Override - public void PostInitialize() { - BiomeConfiguration.init(); - } - - public static BTAMod getInstance() { - if (instance == null) { - instance = new BTAMod(); - } - - return instance; - } -} \ No newline at end of file diff --git a/minecraft/betterterrain/BTAVersion.java b/minecraft/betterterrain/BTAVersion.java deleted file mode 100644 index d956757..0000000 --- a/minecraft/betterterrain/BTAVersion.java +++ /dev/null @@ -1,103 +0,0 @@ -package betterterrain; - -public enum BTAVersion { - V1_1_3(1, 1, 3), - - V1_2_0(1, 2, 0), - V1_2_1(1, 2, 1), - - V1_3_0(1, 3, 0), - V1_3_1(1, 3, 1), - V1_3_2(1, 3, 2), - V1_3_3(1, 3, 3), - V1_3_4(1, 3, 4), - - V1_4_0(1, 4, 0), - V1_4_1(1, 4, 1), - V1_4_2(1, 4, 2), - V1_4_3(1, 4, 3), - V1_4_4(1, 4, 4), - - V2_0_0(2, 0, 0), - V2_0_1(2, 0, 1), - V2_0_2(2, 0, 2), - V2_0_3(2, 0, 3), - V2_0_4(2, 0, 4), - V2_0_5(2, 0, 5), - V2_0_6(2, 0, 6), - V2_0_7(2, 0, 7), - V2_0_8(2, 0, 8), - - V3_0_0(3, 0, 0); - - private final int major; - private final int minor; - private final int patch; - - private BTAVersion(int major, int minor, int patch) { - this.major = major; - this.minor = minor; - this.patch = patch; - } - - public String toString() { - return this.major + "." + this.minor + "." + this.patch; - } - - public static BTAVersion fromString(String info) { - String[] infoSplit = info.split("\\."); - - if (infoSplit.length != 3) { - throw new IllegalArgumentException("Incorrect format for version comnpatibility string. String must be in the format of where X are integers."); - } - - try { - for (BTAVersion version : BTAVersion.values()) { - if (version.major == Integer.parseInt(infoSplit[0]) && version.minor == Integer.parseInt(infoSplit[1]) && version.patch == Integer.parseInt(infoSplit[2]) ) { - return version; - } - } - - throw new IllegalArgumentException("Specified version " + info + " not found."); - } - catch (NumberFormatException e) { - throw new IllegalArgumentException("Incorrect format for version comnpatibility string. String must be in the format of where X are integers."); - } - } - - public boolean isVersionAtOrBelow(BTAVersion version) { - if (this.major > version.major) { - return false; - } - else if (this.major == version.major) { - if (this.minor > version.minor) { - return false; - } - else if (this.minor == version.minor) { - if (this.patch > version.patch) { - return false; - } - } - } - - return true; - } - - public boolean isVersionAtLeast(BTAVersion version) { - if (this.major < version.major) { - return false; - } - else if (this.major == version.major) { - if (this.minor < version.minor) { - return false; - } - else if (this.minor == version.minor) { - if (this.patch < version.patch) { - return false; - } - } - } - - return true; - } -} diff --git a/minecraft/betterterrain/DecoIntegration.java b/minecraft/betterterrain/DecoIntegration.java deleted file mode 100644 index f4abc24..0000000 --- a/minecraft/betterterrain/DecoIntegration.java +++ /dev/null @@ -1,102 +0,0 @@ -package betterterrain; - -import net.minecraft.src.Block; -import net.minecraft.src.DecoManager; -import net.minecraft.src.FCAddOn; -import net.minecraft.src.FCAddOnHandler; -import net.minecraft.src.Item; - -public class DecoIntegration { - private static boolean isDecoInstalled = false; - private static FCAddOn decoManager = null; - - public static Block redSand; - public static Block redSandStone; - public static Block redSandStoneStairs; - public static Block terracotta; - public static Block stainedTerracotta; - public static Block cherryLog; - public static Block cherryStump; - public static Block cherryLeaves; - public static Block acaciaLog; - public static Block acaciaStump; - public static Block acaciaLeaves; - public static Block flower; - public static Block flower2; - public static Block tulip; - public static Block stoneTypes; - public static Block autumnLeaves; - public static Block coarseDirt; - public static Block podzol; - public static Block basalt; - public static Block infusedStone; - public static Block magma; - public static Block ash; - public static Block pumice; - public static Block amethyst; - public static Block amethystShardBlock; - public static Block bonePillar; - - public static Item pileRedSand; - - public static void init() { - try { - if (FCAddOnHandler.isModInstalled("Deco Addon")) { - decoManager = FCAddOnHandler.getModByName("Deco Addon"); - } - - if (decoManager != null) { - isDecoInstalled = true; - - redSand = (Block) getDecoField("redSand"); - redSandStone = (Block) getDecoField("redSandStone"); - redSandStoneStairs = (Block) getDecoField("redSandStoneStairs"); - terracotta = (Block) getDecoField("terracotta"); - stainedTerracotta = (Block) getDecoField("stainedTerracotta"); - cherryLog = (Block) getDecoField("cherryLog"); - cherryStump = (Block) getDecoField("cherryStump"); - cherryLeaves = (Block) getDecoField("cherryLeaves"); - acaciaLog = (Block) getDecoField("acaciaLog"); - acaciaStump = (Block) getDecoField("acaciaStump"); - acaciaLeaves = (Block) getDecoField("acaciaLeaves"); - flower = (Block) getDecoField("flower"); - flower2 = (Block) getDecoField("flower2"); - tulip = (Block) getDecoField("tulip"); - stoneTypes = (Block) getDecoField("stoneTypes"); - autumnLeaves = (Block) getDecoField("autumnLeaves"); - coarseDirt = (Block) getDecoField("coarseDirt"); - podzol = (Block) getDecoField("podzol"); - basalt = (Block) getDecoField("basalt"); - infusedStone = (Block) getDecoField("infusedStone"); - magma = (Block) getDecoField("magma"); - ash = (Block) getDecoField("ashBlock"); - pumice = (Block) getDecoField("pumice"); - amethyst = (Block) getDecoField("amethyst"); - amethystShardBlock = (Block) getDecoField("amethystShardBlock"); - bonePillar = (Block) getDecoField("bonePillar"); - - pileRedSand = (Item) getDecoField("pileRedSand"); - } - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (NoSuchFieldException e) { - e.printStackTrace(); - } catch (SecurityException e) { - e.printStackTrace(); - } - } - - private static Object getDecoField(String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { - if (isDecoInstalled) { - return ((DecoManager) decoManager).decoDefs.getClass().getDeclaredField(fieldName).get(null); - } - - return null; - } - - public static boolean isDecoInstalled() { - return isDecoInstalled; - } -} \ No newline at end of file diff --git a/minecraft/betterterrain/biome/BTANetherBiome.java b/minecraft/betterterrain/biome/BTANetherBiome.java deleted file mode 100644 index ad29d55..0000000 --- a/minecraft/betterterrain/biome/BTANetherBiome.java +++ /dev/null @@ -1,120 +0,0 @@ -package betterterrain.biome; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.feature.terrain.BasaltPillarGen; -import betterterrain.feature.terrain.GlowstoneGen; -import betterterrain.feature.terrain.NetherLavaGen; -import betterterrain.feature.terrain.OreGen; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityGhast; -import net.minecraft.src.FCEntityMagmaCube; -import net.minecraft.src.FCEntityPigZombie; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.Vec3; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenFire; -import net.minecraft.src.WorldGenerator; - -public abstract class BTANetherBiome extends BTABiome { - protected int infusedStonePerChunk = 2; - protected int maxInfusedStoneHeight = 32; - - protected int magmaPerChunk = 4; - - public BTANetherBiome(int id, String internalName) { - super(id, internalName, Climate.HELL); - - this.topBlockExt = Block.netherrack.blockID; - this.fillerBlockExt = Block.netherrack.blockID; - - this.spawnableMonsterList.clear(); - this.spawnableCreatureList.clear(); - this.spawnableWaterCreatureList.clear(); - this.spawnableCaveCreatureList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityGhast.class, 50, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityPigZombie.class, 100, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityMagmaCube.class, 1, 4, 4)); - } - - public Vec3 getFogColor(World world) { - return world.getWorldVec3Pool().getVecFromPool(0.2, 0.03, 0.03); - } - - @Override - public void decorate(World world, Random rand, int chunkX, int chunkZ, WorldConfigurationInfo generatorOptions) { - WorldGenerator gen; - - //Random buried lava pockets - gen = new NetherLavaGen(false); - - for (int i = 0; i < 8; i++) { - int x = chunkX + rand.nextInt(16) + 8; - int y = rand.nextInt(120) + 4; - int z = chunkZ + rand.nextInt(16) + 8; - - gen.generate(world, rand, x, y, z); - } - - //Fire - int numFire = rand.nextInt(rand.nextInt(10) + 1) + 1; - //gen = new BTAWorldGenNetherFire(); - gen = new WorldGenFire(); - - for (int i = 0; i < 8; i++) { - int x = chunkX + rand.nextInt(16) + 8; - int y = rand.nextInt(120) + 4; - int z = chunkZ + rand.nextInt(16) + 8; - - gen.generate(world, rand, x, y, z); - } - - //Glowstone - int numGlowstone = rand.nextInt(rand.nextInt(10) + 1) + 11; - gen = new GlowstoneGen(); - - for (int i = 0; i < numGlowstone; i++) { - int x = chunkX + rand.nextInt(16) + 8; - int y = rand.nextInt(120) + 4; - int z = chunkZ + rand.nextInt(16) + 8; - - gen.generate(world, rand, x, y, z); - } - - //Infused stone blobs - gen = new OreGen(DecoIntegration.infusedStone.blockID, 0, 32, 100, new int[] {Block.netherrack.blockID, DecoIntegration.basalt.blockID}); - this.genStandardOre1(world, rand, infusedStonePerChunk, gen, chunkX, chunkZ, 5, maxInfusedStoneHeight); - - //Magma - gen = new OreGen(DecoIntegration.magma.blockID, 0, 8, 24, new int[] {Block.netherrack.blockID, DecoIntegration.basalt.blockID, DecoIntegration.infusedStone.blockID}); - this.genStandardOre1(world, rand, magmaPerChunk, gen, chunkX, chunkZ, 27, 36); - - //Quartz - gen = new OreGen(Block.oreNetherQuartz.blockID, 0, 13, Block.netherrack.blockID); - this.genStandardOre1(world, rand, 16, gen, chunkX, chunkZ, 10, 118); - - //Dried up lava pillars - gen = new BasaltPillarGen(); - - if (rand.nextInt(20) == 0) { - int x = chunkX + rand.nextInt(16) + 8; - int y = rand.nextInt(128); - int z = chunkZ + rand.nextInt(16) + 8; - - gen.generate(world, rand, x, y, z); - } - - //Lavafalls - gen = new NetherLavaGen(true); - - for (int i = 0; i < 16; i++) { - int x = chunkX + rand.nextInt(16) + 8; - int y = rand.nextInt(108) + 10; - int z = chunkZ + rand.nextInt(16) + 8; - - gen.generate(world, rand, x, y, z); - } - } -} \ No newline at end of file diff --git a/minecraft/betterterrain/biome/BiomeConfiguration.java b/minecraft/betterterrain/biome/BiomeConfiguration.java deleted file mode 100644 index 8053efc..0000000 --- a/minecraft/betterterrain/biome/BiomeConfiguration.java +++ /dev/null @@ -1,234 +0,0 @@ -package betterterrain.biome; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import betterterrain.BTAAddon; -import betterterrain.biome.layer.HillsLayer; -import betterterrain.biome.layer.RiverLayer; -import betterterrain.biome.layer.ShoreLayer; -import betterterrain.biome.layer.SporadicLayer; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.FCAddOn; -import net.minecraft.src.FCAddOnHandler; - -public abstract class BiomeConfiguration { - public static void init() { - BTABiomeConfiguration btaConfig = BTABiomeConfiguration.getInstance(); - btaConfig.addBiomesToList(biomeList); - btaConfig.setBiomeVariants(); - - for (FCAddOn mod : FCAddOnHandler.m_ModList.values()) { - if (mod instanceof BTAAddon) { - BTAAddon addon = (BTAAddon) mod; - BiomeConfiguration biomeConfig = addon.getBiomeConfiguration(); - biomeConfig.addBiomesToList(biomeList); - biomeConfig.setBiomeVariants(); - } - } - - initClimateLists(); - initBiomeInfoList(); - } - - //------ API Funcionality ------// - - /** - * Done separate from biome constructor to allow for initialization order separate from definition order - * @param biomeList - */ - public abstract void addBiomesToList(ArrayList biomeList); - - /** - * Used to define rivers, edges, hills, etc - * Must be done separately from biome definition to prevent definition order from affecting things - */ - public abstract void setBiomeVariants(); - - //------ Biome Functionality ------// - - private static ArrayList biomeList = new ArrayList(); - - private static Map biomeInfoMap = new HashMap(); - - public static void initBiomeInfoList() { - for (BTABiome b : biomeList) { - if (b.isDecoOnly()) - biomeInfoMap.put(b.biomeID, new BiomeInfo(b.biomeID, true, true)); - else - biomeInfoMap.put(b.biomeID, new BiomeInfo(b.biomeID, true)); - } - } - - public static ArrayList getBiomeList() { - return biomeList; - } - - public static Map getBiomeInfoMap() { - return biomeInfoMap; - } - - public static boolean canBiomeSpawnStronghold(BiomeGenBase biome) { - if (biome != BiomeGenBase.ocean && biome != BiomeGenBase.frozenOcean) { - return false; - } - else if (biome instanceof BTABiome && !((BTABiome) biome).canSpawnStronghold()) { - return false; - } - else { - return true; - } - } - - public static int getSubVariantForBiomes(int baseBiome, WorldConfigurationInfo generatorOptions, HillsLayer layer) { - BiomeGenBase b = BiomeGenBase.biomeList[baseBiome]; - - if (b instanceof BTABiome) { - BTABiome biome = (BTABiome) b; - - return biome.getSubVariant(generatorOptions, layer); - } - else { - return baseBiome; - } - } - - public static int getSubVariantForBiomesCommon(int baseBiome, WorldConfigurationInfo generatorOptions, HillsLayer layer) { - BiomeGenBase b = BiomeGenBase.biomeList[baseBiome]; - - if (b instanceof BTABiome) { - BTABiome biome = (BTABiome) b; - - return biome.getSubVariantCommon(generatorOptions, layer); - } - else { - return baseBiome; - } - } - - public static int getSporadicVariantForBiomes(int baseBiome, WorldConfigurationInfo generatorOptions, SporadicLayer layer) { - BiomeGenBase b = BiomeGenBase.biomeList[baseBiome]; - - if (b instanceof BTABiome) { - BTABiome biome = (BTABiome) b; - - return biome.getSporadicVariant(generatorOptions, layer); - } - else { - return baseBiome; - } - } - - public static int getSporadicChanceForBiomes(int baseBiome, WorldConfigurationInfo generatorOptions, SporadicLayer layer) { - BiomeGenBase b = BiomeGenBase.biomeList[baseBiome]; - - if (b instanceof BTABiome) { - BTABiome biome = (BTABiome) b; - - return biome.getSporadicChance(generatorOptions, layer); - } - else { - return baseBiome; - } - } - - public static int getBeachVariantForBiomes(int baseBiome, WorldConfigurationInfo generatorOptions, ShoreLayer layer) { - BiomeGenBase b = BiomeGenBase.biomeList[baseBiome]; - - if (b instanceof BTABiome) { - BTABiome biome = (BTABiome) b; - - return biome.getBeachVariant(generatorOptions, layer); - } - else { - return baseBiome; - } - } - - public static boolean shouldBiomeSpawnBeach(int baseBiome, WorldConfigurationInfo generatorOptions, ShoreLayer layer) { - BiomeGenBase b = BiomeGenBase.biomeList[baseBiome]; - - if (b instanceof BTABiome) { - BTABiome biome = (BTABiome) b; - - return biome.hasBeach(generatorOptions, layer); - } - else { - return true; - } - } - - public static int getRiverVariantForBiomes(int baseBiome, WorldConfigurationInfo generatorOptions, RiverLayer layer) { - BiomeGenBase b = BiomeGenBase.biomeList[baseBiome]; - - if (b instanceof BTABiome) { - BTABiome biome = (BTABiome) b; - - return biome.getRiverVariant(generatorOptions, layer); - } - else { - return baseBiome; - } - } - - public static int getEdgeVariantForBiomes(int baseBiome, WorldConfigurationInfo generatorOptions, ShoreLayer layer) { - BiomeGenBase b = BiomeGenBase.biomeList[baseBiome]; - - if (b instanceof BTABiome) { - BTABiome biome = (BTABiome) b; - - return biome.getEdgeVariant(generatorOptions, layer); - } - else { - return baseBiome; - } - } - - public static boolean shouldBiomeConnectWithEdge(int baseBiome, WorldConfigurationInfo generatorOptions, ShoreLayer layer) { - BiomeGenBase b = BiomeGenBase.biomeList[baseBiome]; - - if (b instanceof BTABiome) { - BTABiome biome = (BTABiome) b; - - return biome.shouldConnectWithEdge(generatorOptions, layer); - } - else { - return true; - } - } - - //------ Climate functionality ------// - - public static ArrayList snowyList = new ArrayList(); - public static ArrayList coldList = new ArrayList(); - public static ArrayList temperateList = new ArrayList(); - public static ArrayList tropicalList = new ArrayList(); - public static ArrayList aridList = new ArrayList(); - public static Map> biomeCategoryMap = new HashMap(); - - public static ArrayList getClimateListForGenerator(Climate climate, ArrayList biomesForGeneration) { - ArrayList newClimateList = new ArrayList(); - - for (BTABiome b : biomeCategoryMap.get(climate)) { - if (biomesForGeneration.contains(b)) { - newClimateList.add(b); - } - } - - return newClimateList; - } - - public static void initClimateLists() { - biomeCategoryMap.put(Climate.SNOWY, snowyList); - biomeCategoryMap.put(Climate.COLD, coldList); - biomeCategoryMap.put(Climate.TEMPERATE, temperateList); - biomeCategoryMap.put(Climate.TROPICAL, tropicalList); - biomeCategoryMap.put(Climate.ARID, aridList); - - for (BTABiome b : biomeList) { - biomeCategoryMap.get(b.climate).add(b); - } - } -} diff --git a/minecraft/betterterrain/biome/biomes/AridForestBiome.java b/minecraft/betterterrain/biome/biomes/AridForestBiome.java deleted file mode 100644 index 5ad4277..0000000 --- a/minecraft/betterterrain/biome/biomes/AridForestBiome.java +++ /dev/null @@ -1,49 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.SmallShrubGen; -import betterterrain.feature.tree.TinyShrubGen; -import net.minecraft.src.WorldGenBigTree; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenerator; - -public class AridForestBiome extends BTABiome { - public AridForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - btaBiomeDecorator.treesPerChunk = 8; - btaBiomeDecorator.grassPerChunk = 20; - btaBiomeDecorator.generateStoneInGrass = true; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - - - if (rand.nextInt(10) == 0) { - gen = new WorldGenBigTree(false); - } - else if (rand.nextInt(4) == 0) { - gen = new WorldGenTrees(false); - } - else if (rand.nextInt(3) == 0) { - gen = new SmallShrubGen(); - } - else if (rand.nextInt(2) == 0) { - gen = new WorldGenShrub(0, 0); - } - else { - gen = new TinyShrubGen(); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft/betterterrain/biome/biomes/SwampBiome.java b/minecraft/betterterrain/biome/biomes/SwampBiome.java deleted file mode 100644 index 4cc394f..0000000 --- a/minecraft/betterterrain/biome/biomes/SwampBiome.java +++ /dev/null @@ -1,98 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterbiomes.world.generate.surface.HotSpringsSurfaceBuilder; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.TallSwampTreeGen; -import betterterrain.feature.tree.TemperateBirchGen; -import betterterrain.feature.tree.WillowGen; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.surface.SwampSurfaceBuilder; -import net.minecraft.src.Block; -import net.minecraft.src.ColorizerFoliage; -import net.minecraft.src.ColorizerGrass; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntityWitch; -import net.minecraft.src.FCUtilsColor; -import net.minecraft.src.Material; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenVines; -import net.minecraft.src.WorldGenerator; - -public class SwampBiome extends BTABiome { - - public SwampBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.grassPerChunk = 5; - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.flowersPerChunk = -999; - this.btaBiomeDecorator.deadBushPerChunk = 10; - this.btaBiomeDecorator.mushroomsPerChunk = 8; - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.clayPerChunk = 1; - this.btaBiomeDecorator.waterlilyPerChunk = 10; - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 1, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityWitch.class, 1, 1, 1)); - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 2, 2)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 2, 2)); - this.waterColorMultiplier = 14745518; - } - - @Override - public int getBiomeGrassColor() { - return 0x5f9b76; - } - - @Override - public int getBiomeFoliageColor() { - return 0x5C8E47; - } - - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) { - WorldGenerator gen; - - if (rand.nextInt(20) == 0) { - gen = new WillowGen(); - } - else if (rand.nextInt(10) == 0) { - gen = new TemperateBirchGen(); - } - else if (rand.nextInt(4) == 0) { - gen = new TallSwampTreeGen(); - } - else { - gen = this.worldGeneratorSwamp; - } - - return gen; - } - - @Override - public WorldGenerator getRandomWorldGenForGrass(Random rand) { - return rand.nextInt(6) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 0) : new TallGrassGen(Block.tallGrass.blockID, 1); - } - - @Override - public void decorate(World world, Random rand, int chunkX, int chunkZ, WorldConfigurationInfo generatorOptions) { - super.decorate(world, rand, chunkX, chunkZ, generatorOptions); - - WorldGenVines var5 = new WorldGenVines(); - - for (int var6 = 0; var6 < 50; ++var6) - { - int x = chunkX + rand.nextInt(16) + 8; - byte y = 64; - int z = chunkZ + rand.nextInt(16) + 8; - var5.generate(world, rand, x, y, z); - } - } -} \ No newline at end of file diff --git a/minecraft/betterterrain/biome/layer/ClimatesLayer.java b/minecraft/betterterrain/biome/layer/ClimatesLayer.java deleted file mode 100644 index e26e347..0000000 --- a/minecraft/betterterrain/biome/layer/ClimatesLayer.java +++ /dev/null @@ -1,60 +0,0 @@ -package betterterrain.biome.layer; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.biome.Climate; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; - -public class ClimatesLayer extends BTALayer { - private ArrayList biomesForGeneration; - private Map> biomeCategoryMapCached = new HashMap(); - private ArrayList climateIDsForGeneration = new ArrayList(); - - public ClimatesLayer(long baseSeed, GenLayer parent, ArrayList biomesForGeneration) { - super(baseSeed); - this.parent = parent; - this.biomesForGeneration = biomesForGeneration; - - for (Climate c : Climate.values()) { - if (c.isOverworld) { - this.biomeCategoryMapCached.put(c, BiomeConfiguration.getClimateListForGenerator(c, this.biomesForGeneration)); - - if (biomeCategoryMapCached.get(c).size() != 0) { - climateIDsForGeneration.add(c.id); - } - } - } - } - - /** - * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall - * amounts, or biomeList[] indices based on the particular GenLayer subclass. - */ - public int[] getInts(int xOffset, int zOffset, int sizeX, int sizeZ) { - int parentXOffset = xOffset - 1; - int parentZOffset = zOffset - 1; - int parentSizeX = sizeX + 2; - int parentSizeZ = sizeZ + 2; - int[] parentArray = this.parent.getInts(parentXOffset, parentZOffset, parentSizeX, parentSizeZ); - int[] cache = IntCache.getIntCache(sizeX * sizeZ); - - for (int i = 0; i < sizeZ; ++i) { - for (int k = 0; k < sizeX; ++k) { - int parentInt = parentArray[k + 1 + (i + 1) * parentSizeX]; - this.initChunkSeed((long)(k + xOffset), (long)(i + zOffset)); - - int climateID = climateIDsForGeneration.get(this.nextInt(climateIDsForGeneration.size())); - - cache[k + i * sizeX] = climateID; - } - } - - return cache; - } -} diff --git a/minecraft/betterterrain/block/BTABlockClay.java b/minecraft/betterterrain/block/BTABlockClay.java deleted file mode 100644 index e1ebe04..0000000 --- a/minecraft/betterterrain/block/BTABlockClay.java +++ /dev/null @@ -1,168 +0,0 @@ -package betterterrain.block; - -import java.util.List; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.CreativeTabs; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.FCBlockClay; -import net.minecraft.src.IBlockAccess; -import net.minecraft.src.Icon; -import net.minecraft.src.IconRegister; -import net.minecraft.src.ItemStack; -import net.minecraft.src.RenderBlocks; -import net.minecraft.src.World; - -public class BTABlockClay extends FCBlockClay { - public BTABlockClay(int id) { - super(id); - } - - /** - * Drops the block items with a specified chance of dropping the specified items - */ - public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6, int var7) - { - if (!var1.isRemote) - { - this.dropBlockAsItem_do(var1, var2, var3, var4, new ItemStack(this.idDropped(var5, var1.rand, var7), 1, this.damageDropped(var5))); - - if (var5 == 1) { - this.DropItemsIndividualy(var1, var2, var3, var4, FCBetterThanWolves.fcItemPileSand.itemID, 6, 0, var6); - } - else if (var5 == 2 && DecoIntegration.isDecoInstalled()) { - this.DropItemsIndividualy(var1, var2, var3, var4, DecoIntegration.pileRedSand.itemID, 6, 0, var6); - } - else { - this.DropItemsIndividualy(var1, var2, var3, var4, FCBetterThanWolves.fcItemPileDirt.itemID, 6, 0, var6); - } - } - } - - public boolean DropComponentItemsOnBadBreak(World var1, int var2, int var3, int var4, int var5, float var6) - { - this.DropItemsIndividualy(var1, var2, var3, var4, FCBetterThanWolves.fcItemPileClay.itemID, 1, 0, var6); - - if (var5 == 1) { - this.DropItemsIndividualy(var1, var2, var3, var4, FCBetterThanWolves.fcItemPileSand.itemID, 4, 0, var6); - } - else if (var5 == 2 && DecoIntegration.isDecoInstalled()) { - this.DropItemsIndividualy(var1, var2, var3, var4, DecoIntegration.pileRedSand.itemID, 4, 0, var6); - } - else { - this.DropItemsIndividualy(var1, var2, var3, var4, FCBetterThanWolves.fcItemPileDirt.itemID, 4, 0, var6); - } - return true; - } - - public float GetMovementModifier(World var1, int var2, int var3, int var4) - { - int meta = var1.getBlockMetadata(var2, var3, var4); - - return (meta == 1 || meta == 2) ? 0.8F : 1.0F; - } - - public boolean CanReedsGrowOnBlock(World var1, int var2, int var3, int var4) - { - return var1.getBlockMetadata(var2, var3, var4) == 3; - } - - public boolean CanSaplingsGrowOnBlock(World var1, int var2, int var3, int var4) - { - return var1.getBlockMetadata(var2, var3, var4) == 3; - } - - public boolean CanWildVegetationGrowOnBlock(World var1, int var2, int var3, int var4) - { - return var1.getBlockMetadata(var2, var3, var4) == 3; - } - - //CLIENT ONLY - Icon sandyClayIcon; - Icon redSandyClayIcon; - Icon grassyClayOverlay; - - /** - * When this method is called, your block should register all the icons it needs with the given IconRegister. This - * is the only chance you get to register icons. - */ - public void registerIcons(IconRegister var1) - { - super.registerIcons(var1); - sandyClayIcon = var1.registerIcon("btaBlockSandyClay"); - redSandyClayIcon = var1.registerIcon("btaBlockRedSandyClay"); - grassyClayOverlay = var1.registerIcon("btaOverlayGrassyClay"); - } - - @Override - public Icon getIcon(int side, int meta) { - if (meta == 1) { - return sandyClayIcon; - } - else if (meta == 2) { - return redSandyClayIcon; - } - else { - return super.getIcon(side, meta); - } - } - - @Override - public boolean RenderBlock(RenderBlocks render, int x, int y, int z) { - int meta = render.blockAccess.getBlockMetadata(x, y, z); - - if (meta == 0) - super.RenderBlock(render, x, y, z); - else if (meta == 1) - this.RenderBlockWithTexture(render, x, y, z, sandyClayIcon); - else if (meta == 2) - this.RenderBlockWithTexture(render, x, y, z, redSandyClayIcon); - else - Block.grass.RenderBlock(render, x, y, z); - - return true; - } - - /** - * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given - * coordinates. Args: blockAccess, x, y, z, side - */ - @Override - public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side) { - if (blockAccess.getBlockMetadata(x, y, z) == 3 && side == 1) { - return false; - } - - return true; - } - - @Override - public void RenderBlockSecondPass(RenderBlocks var1, int var2, int var3, int var4, boolean var5) - { - if (var1.blockAccess.getBlockMetadata(var2, var3, var4) == 3) { - Block.grass.RenderBlockSecondPass(var1, var2, var3, var4, var5); - - var1.SetRenderAllFaces(false); - this.RenderBlockWithTexture(var1, var2, var3, var4, grassyClayOverlay); - var1.SetRenderAllFaces(true); - } - } - - @Override - public int getDamageValue(World world, int x, int y, int z) { - // used only by pick block - return world.getBlockMetadata(x, y, z); - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int var4 = 0; var4 < 4; ++var4) - { - par3List.add(new ItemStack(par1, 1, var4)); - } - } -} \ No newline at end of file diff --git a/minecraft/betterterrain/block/BTABlockSoulSand.java b/minecraft/betterterrain/block/BTABlockSoulSand.java deleted file mode 100644 index fb622d5..0000000 --- a/minecraft/betterterrain/block/BTABlockSoulSand.java +++ /dev/null @@ -1,9 +0,0 @@ -package betterterrain.block; - -import net.minecraft.src.FCBlockSoulSand; - -public class BTABlockSoulSand extends FCBlockSoulSand { - public BTABlockSoulSand(int id) { - super(id); - } -} \ No newline at end of file diff --git a/minecraft/betterterrain/feature/plant/DecoFlowerGen.java b/minecraft/betterterrain/feature/plant/DecoFlowerGen.java deleted file mode 100644 index 337c065..0000000 --- a/minecraft/betterterrain/feature/plant/DecoFlowerGen.java +++ /dev/null @@ -1,73 +0,0 @@ -package betterterrain.feature.plant; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class DecoFlowerGen extends WorldGenerator -{ - /** The ID of the plant block used in this plant generator. */ - private int plantBlockId; - private int plantMetadata; - - public DecoFlowerGen() - { - plantBlockId = -1; - plantMetadata = -1; - } - - public DecoFlowerGen(int blockID) - { - this.plantBlockId = blockID; - plantMetadata = 0; - } - - public DecoFlowerGen(int blockID, int metadata) - { - this.plantBlockId = blockID; - plantMetadata = metadata; - } - - public boolean generate(World par1World, Random rand, int par3, int par4, int par5) - { - int plantID = plantBlockId; - - if (plantBlockId == -1) { - int i = rand.nextInt(23); - - if (i < 16) { - plantID = DecoIntegration.flower.blockID; - plantMetadata = i; - } - else if (i < 18) { - plantID = DecoIntegration.flower2.blockID; - plantMetadata = i - 16; - } - else { - plantID = DecoIntegration.tulip.blockID; - plantMetadata = i - 18; - } - } - - for (int var6 = 0; var6 < 64; ++var6) - { - int var7 = par3 + rand.nextInt(8) - rand.nextInt(8); - int var8 = par4 + rand.nextInt(4) - rand.nextInt(4); - int var9 = par5 + rand.nextInt(8) - rand.nextInt(8); - - if (par1World.isAirBlock(var7, var8, var9) && (!par1World.provider.hasNoSky || var8 < 127) && Block.blocksList[plantID].CanBlockStayDuringGenerate(par1World, var7, var8, var9)) - { - par1World.setBlock(var7, var8, var9, plantID, this.plantMetadata, 2); - - if (par1World.getBiomeGenForCoords(var7, var9).getEnableSnow() && par1World.isAirBlock(var7, var8 + 1, var9) && par1World.canBlockSeeTheSky(var7, var8, var9)) { - par1World.setBlock(var7, var8 + 1, var9, Block.snow.blockID); - } - } - } - - return true; - } -} diff --git a/minecraft/betterterrain/feature/plant/FlowerGen.java b/minecraft/betterterrain/feature/plant/FlowerGen.java deleted file mode 100644 index 32ae381..0000000 --- a/minecraft/betterterrain/feature/plant/FlowerGen.java +++ /dev/null @@ -1,39 +0,0 @@ -package betterterrain.feature.plant; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class FlowerGen extends WorldGenerator -{ - /** The ID of the plant block used in this plant generator. */ - private int plantBlockId; - - public FlowerGen(int par1) - { - this.plantBlockId = par1; - } - - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - for (int var6 = 0; var6 < 64; ++var6) - { - int var7 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8); - int var8 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4); - int var9 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8); - - if (par1World.isAirBlock(var7, var8, var9) && (!par1World.provider.hasNoSky || var8 < 127) && Block.blocksList[this.plantBlockId].CanBlockStayDuringGenerate(par1World, var7, var8, var9)) - { - par1World.setBlock(var7, var8, var9, this.plantBlockId, 0, 2); - - if (par1World.getBiomeGenForCoords(var7, var9).canSnowAt(par1World, par3, par4, par5) && par1World.isAirBlock(var7, var8 + 1, var9) && par1World.canBlockSeeTheSky(var7, var8, var9)) { - par1World.setBlock(var7, var8 + 1, var9, Block.snow.blockID); - } - } - } - - return true; - } -} diff --git a/minecraft/betterterrain/feature/plant/TallGrassGen.java b/minecraft/betterterrain/feature/plant/TallGrassGen.java deleted file mode 100644 index 32888db..0000000 --- a/minecraft/betterterrain/feature/plant/TallGrassGen.java +++ /dev/null @@ -1,48 +0,0 @@ -package betterterrain.feature.plant; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class TallGrassGen extends WorldGenerator -{ - /** Stores ID for WorldGenTallGrass */ - private int tallGrassID; - private int tallGrassMetadata; - - public TallGrassGen(int par1, int par2) - { - this.tallGrassID = par1; - this.tallGrassMetadata = par2; - } - - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - int var11; - - for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4) - { - ; - } - - for (int var7 = 0; var7 < 128; ++var7) - { - int var8 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8); - int var9 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4); - int var10 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8); - - if (par1World.isAirBlock(var8, var9, var10) && Block.blocksList[this.tallGrassID].canBlockStay(par1World, var8, var9, var10)) - { - par1World.setBlock(var8, var9, var10, this.tallGrassID, this.tallGrassMetadata, 2); - - if (par1World.getBiomeGenForCoords(var8, var10).canSnowAt(par1World, par3, par4, par5) && par1World.isAirBlock(var8, var9 + 1, var10) && par1World.canBlockSeeTheSky(var8, var9 + 1, var10)) { - par1World.setBlock(var8, var9 + 1, var10, Block.snow.blockID); - } - } - } - - return true; - } -} diff --git a/minecraft/betterterrain/feature/terrain/ClayGen.java b/minecraft/betterterrain/feature/terrain/ClayGen.java deleted file mode 100644 index 152fee2..0000000 --- a/minecraft/betterterrain/feature/terrain/ClayGen.java +++ /dev/null @@ -1,77 +0,0 @@ -package betterterrain.feature.terrain; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.Material; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class ClayGen extends WorldGenerator { - /** The block ID for clay. */ - private int clayBlockId; - - /** The number of blocks to generate. */ - private int numberOfBlocks; - - public ClayGen(int par1) - { - this.clayBlockId = Block.blockClay.blockID; - this.numberOfBlocks = par1; - } - - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - if (par1World.getBlockMaterial(par3, par4, par5) != Material.water) - { - return false; - } - else - { - int var6 = par2Random.nextInt(this.numberOfBlocks - 2) + 2; - byte var7 = 1; - - for (int var8 = par3 - var6; var8 <= par3 + var6; ++var8) - { - for (int var9 = par5 - var6; var9 <= par5 + var6; ++var9) - { - int var10 = var8 - par3; - int var11 = var9 - par5; - - if (var10 * var10 + var11 * var11 <= var6 * var6) - { - for (int var12 = par4 - var7; var12 <= par4 + var7; ++var12) - { - int var13 = par1World.getBlockId(var8, var12, var9); - - if (var13 == Block.dirt.blockID || var13 == Block.blockClay.blockID) - { - par1World.setBlock(var8, var12, var9, this.clayBlockId, 0, 2); - } - else if (var13 == Block.sand.blockID) - { - par1World.setBlock(var8, var12, var9, this.clayBlockId, 1, 2); - } - else if (DecoIntegration.isDecoInstalled() && var13 == DecoIntegration.redSand.blockID) - { - par1World.setBlock(var8, var12, var9, this.clayBlockId, 2, 2); - } - else if (var13 == Block.grass.blockID) - { - par1World.setBlock(var8, var12, var9, this.clayBlockId, 3, 2); - } - else if (var13 == Block.blockClay.blockID) - { - int meta = par1World.getBlockMetadata(par3, par4, par5); - par1World.setBlock(var8, var12, var9, this.clayBlockId, meta, 2); - } - } - } - } - } - - return true; - } - } -} diff --git a/minecraft/betterterrain/feature/terrain/NetherFireGen.java b/minecraft/betterterrain/feature/terrain/NetherFireGen.java deleted file mode 100644 index 5c5ddee..0000000 --- a/minecraft/betterterrain/feature/terrain/NetherFireGen.java +++ /dev/null @@ -1,23 +0,0 @@ -package betterterrain.feature.terrain; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class NetherFireGen extends WorldGenerator { - public boolean generate(World world, Random random, int x, int y, int z) { - for (int count = 0; count < 64; ++count) { - int i = x + random.nextInt(8) - random.nextInt(8); - int j = y + random.nextInt(4) - random.nextInt(4); - int k = z + random.nextInt(8) - random.nextInt(8); - - if (world.isAirBlock(i, j, k) && world.getBlockId(i, j - 1, k) != 0 && Block.blocksList[world.getBlockId(i, j - 1, k)].DoesInfiniteBurnToFacing(world, i, j - 1, k, 0)) { - world.setBlock(i, j, k, Block.fire.blockID, 0, 2); - } - } - - return true; - } -} diff --git a/minecraft/betterterrain/feature/terrain/OreGen.java b/minecraft/betterterrain/feature/terrain/OreGen.java deleted file mode 100644 index 439456f..0000000 --- a/minecraft/betterterrain/feature/terrain/OreGen.java +++ /dev/null @@ -1,158 +0,0 @@ -package betterterrain.feature.terrain; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.Random; -import java.util.Set; - -import net.minecraft.src.Block; -import net.minecraft.src.MathHelper; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class OreGen extends WorldGenerator -{ - /** The block ID of the ore to be placed using this generator. */ - private int minableBlockId; - private int meta; - - /** The number of blocks to generate. */ - private int minNumberOfBlocks; - private int maxNumberOfBlocks; - - private int[] replaceIDs; - - public OreGen(int id, int numBlocks) - { - minableBlockId = id; - minNumberOfBlocks = numBlocks; - this.meta = 0; - this.replaceIDs = new int[] {Block.grass.blockID, Block.dirt.blockID}; - } - - public OreGen(int id, int meta, int numBlocks, int replaceID) { - this(id, meta, numBlocks, new int[] {replaceID}); - } - - public OreGen(int id, int meta, int minBlocks, int maxBlocks, int replaceID) { - this(id, meta, minBlocks, maxBlocks, new int[] {replaceID}); - } - - public OreGen(int id, int meta, int numBlocks, int[] replaceIDs) { - this(id, meta, numBlocks, numBlocks, replaceIDs); - } - - public OreGen(int id, int meta, int minBlocks, int maxBlocks, int[] replaceIDs) { - minableBlockId = id; - minNumberOfBlocks = minBlocks; - maxNumberOfBlocks = maxBlocks; - this.meta = meta; - this.replaceIDs = replaceIDs; - } - - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - int numBlocks; - - if (minNumberOfBlocks == maxNumberOfBlocks) { - numBlocks = maxNumberOfBlocks; - } - else { - numBlocks = par2Random.nextInt(maxNumberOfBlocks - minNumberOfBlocks) + minNumberOfBlocks; - } - - float var6 = par2Random.nextFloat() * (float)Math.PI; - double var7 = par3 + 8 + MathHelper.sin(var6) * numBlocks / 8.0F; - double var9 = par3 + 8 - MathHelper.sin(var6) * numBlocks / 8.0F; - double var11 = par5 + 8 + MathHelper.cos(var6) * numBlocks / 8.0F; - double var13 = par5 + 8 - MathHelper.cos(var6) * numBlocks / 8.0F; - double var15 = par4 + par2Random.nextInt(3) - 2; - double var17 = par4 + par2Random.nextInt(3) - 2; - - for (int var19 = 0; var19 <= numBlocks; ++var19) - { - double var20 = var7 + (var9 - var7) * var19 / numBlocks; - double var22 = var15 + (var17 - var15) * var19 / numBlocks; - double var24 = var11 + (var13 - var11) * var19 / numBlocks; - double var26 = par2Random.nextDouble() * numBlocks / 16.0D; - double var28 = (MathHelper.sin(var19 * (float)Math.PI / numBlocks) + 1.0F) * var26 + 1.0D; - double var30 = (MathHelper.sin(var19 * (float)Math.PI / numBlocks) + 1.0F) * var26 + 1.0D; - int var32 = MathHelper.floor_double(var20 - var28 / 2.0D); - int var33 = MathHelper.floor_double(var22 - var30 / 2.0D); - int var34 = MathHelper.floor_double(var24 - var28 / 2.0D); - int var35 = MathHelper.floor_double(var20 + var28 / 2.0D); - int var36 = MathHelper.floor_double(var22 + var30 / 2.0D); - int var37 = MathHelper.floor_double(var24 + var28 / 2.0D); - - for (int var38 = var32; var38 <= var35; ++var38) - { - double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D); - - if (var39 * var39 < 1.0D) - { - for (int var41 = var33; var41 <= var36; ++var41) - { - double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D); - - if (var39 * var39 + var42 * var42 < 1.0D) - { - for (int var44 = var34; var44 <= var37; ++var44) - { - double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D); - - if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && canBlockBeReplaced(par1World.getBlockId(var38, var41, var44))) - { - int var47 = this.meta; - Block var48 = Block.blocksList[this.minableBlockId]; - - int[] stratas = par1World.provider.terrainType.getStrataLevels(); - - int strata1Height = stratas[0]; - int strata2Height = stratas[1]; - int strata3Height = -2; - - if (stratas.length > 2) - strata3Height = stratas[2]; - - if (var48.HasStrata() && var41 <= strata1Height + par1World.rand.nextInt(2)) - { - byte var49 = 1; - - if (var41 <= strata2Height + par1World.rand.nextInt(2)) - { - var49 = 2; - } - - if (var41 <= strata3Height + par1World.rand.nextInt(2)) - { - var49 = 3; - } - - var47 = var48.GetMetadataConversionForStrataLevel(var49, 0); - } - - par1World.setBlock(var38, var41, var44, this.minableBlockId, var47, 2); - } - } - } - } - } - } - } - - return true; - } - - public boolean canBlockBeReplaced(int blockID) { - for (int i : this.replaceIDs) { - if (i == blockID) { - return true; - } - } - - return false; - } -} diff --git a/minecraft/betterterrain/feature/tree/TaigaGen5.java b/minecraft/betterterrain/feature/tree/TaigaGen5.java deleted file mode 100644 index c3326c1..0000000 --- a/minecraft/betterterrain/feature/tree/TaigaGen5.java +++ /dev/null @@ -1,139 +0,0 @@ -package betterterrain.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class TaigaGen5 extends WorldGenerator -{ - public TaigaGen5(boolean par1) - { - super(par1); - } - - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - int var6 = par2Random.nextInt(9) + 9; - int var7 = 2 + par2Random.nextInt(4); - int var8 = var6 - var7; - int var9 = 2 + par2Random.nextInt(2); - boolean var10 = true; - - if (par4 >= 1 && par4 + var6 + 1 <= 256) - { - int var11; - int var13; - int var15; - int var21; - - for (var11 = par4; var11 <= par4 + 1 + var6 && var10; ++var11) - { - boolean var12 = true; - - if (var11 - par4 < var7) - { - var21 = 0; - } - else - { - var21 = var9; - } - - for (var13 = par3 - var21; var13 <= par3 + var21 && var10; ++var13) - { - for (int var14 = par5 - var21; var14 <= par5 + var21 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = par1World.getBlockId(var13, var11, var14); - - if (var15 != 0 && var15 != Block.leaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - return false; - else - { - var11 = par1World.getBlockId(par3, par4 - 1, par5); - - if ((var11 == Block.grass.blockID || var11 == Block.dirt.blockID || (DecoIntegration.isDecoInstalled() && (var11 == DecoIntegration.coarseDirt.blockID || var11 == DecoIntegration.podzol.blockID))) && par4 < 256 - var6 - 1) - { - this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); - var21 = par2Random.nextInt(2); - var13 = 1; - byte var22 = 0; - int var17; - int var16; - - for (var15 = 0; var15 <= var8; ++var15) - { - var16 = par4 + var6 - var15; - - for (var17 = par3 - var21; var17 <= par3 + var21; ++var17) - { - int var18 = var17 - par3; - - for (int var19 = par5 - var21; var19 <= par5 + var21; ++var19) - { - int var20 = var19 - par5; - - if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var17, var16, var19)]) - { - this.setBlockAndMetadata(par1World, var17, var16, var19, Block.leaves.blockID, 1); - } - } - } - - if (var21 >= var13) - { - var21 = var22; - var22 = 1; - ++var13; - - if (var13 > var9) - { - var13 = var9; - } - } - else - { - ++var21; - } - } - - var15 = par2Random.nextInt(3); - - for (var16 = 0; var16 < var6 - var15; ++var16) - { - var17 = par1World.getBlockId(par3, par4 + var16, par5); - - if (var17 == 0 || var17 == Block.leaves.blockID) - { - this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 1); - } - } - - par1World.setBlockMetadataWithClient(par3, par4, par5, 1 | 12); // place stump - - return true; - } else - return false; - } - } else - return false; - } -} diff --git a/minecraft/betterterrain/item/BTAItemBloodMossSpores.java b/minecraft/betterterrain/item/BTAItemBloodMossSpores.java deleted file mode 100644 index b76144c..0000000 --- a/minecraft/betterterrain/item/BTAItemBloodMossSpores.java +++ /dev/null @@ -1,97 +0,0 @@ -package betterterrain.item; - -import java.util.List; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.BiomeGenHell; -import net.minecraft.src.Block; -import net.minecraft.src.DamageSource; -import net.minecraft.src.Entity; -import net.minecraft.src.EntityPlayer; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.FCEntityPigZombie; -import net.minecraft.src.FCItemBloodMossSpores; -import net.minecraft.src.FCUtilsBlockPos; -import net.minecraft.src.ItemStack; -import net.minecraft.src.World; -import net.minecraft.src.WorldChunkManager; - -public class BTAItemBloodMossSpores extends FCItemBloodMossSpores { - public BTAItemBloodMossSpores(int id) { - super(id); - } - - /** - * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return - * True if something happen and false if it don't. This is for ITEMS, not BLOCKS - */ - public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7, float var8, float var9, float var10) - { - if (var2 != null && !var2.canPlayerEdit(var4, var5, var6, var7, var1)) - { - return false; - } - else if (var1.stackSize == 0) - { - return false; - } - else - { - FCUtilsBlockPos var11 = new FCUtilsBlockPos(var4, var5, var6); - var11.AddFacingAsOffset(var7); - WorldChunkManager var12 = var3.getWorldChunkManager(); - - if (var12 != null) - { - BiomeGenBase var13 = var12.getBiomeGenAt(var4, var6); - - if (var13 instanceof BiomeGenHell || (var13 instanceof BTABiome && ((BTABiome) var13).climate == Climate.HELL)) - { - int var14 = FCBetterThanWolves.fcBlockBloodMoss.blockID; - byte var15 = 0; - - if (var3.canPlaceEntityOnSide(var14, var11.i, var11.j, var11.k, false, var7, var2, var1)) - { - if (!var3.isRemote) - { - int var17 = Block.blocksList[var14].onBlockPlaced(var3, var11.i, var11.j, var11.k, var7, var8, var9, var10, var15); - var17 = Block.blocksList[var14].PreBlockPlacedBy(var3, var11.i, var11.j, var11.k, var17, var2); - - if (var3.setBlockAndMetadataWithNotify(var11.i, var11.j, var11.k, var14, var17)) - { - Block var16 = Block.blocksList[var14]; - - if (var3.getBlockId(var11.i, var11.j, var11.k) == var14) - { - Block.blocksList[var14].onBlockPlacedBy(var3, var11.i, var11.j, var11.k, var2, var1); - Block.blocksList[var14].onPostBlockPlaced(var3, var11.i, var11.j, var11.k, var17); - } - - var3.playSoundEffect((double)((float)var11.i + 0.5F), (double)((float)var11.j + 0.5F), (double)((float)var11.k + 0.5F), var16.stepSound.getStepSound(), (var16.stepSound.getVolume() + 1.0F) / 2.0F, var16.stepSound.getPitch() * 0.8F); - this.AngerPigmen(var3, var2); - } - } - - --var1.stackSize; - return true; - } - } - } - - return false; - } - } - - private void AngerPigmen(World var1, EntityPlayer var2) - { - List var3 = var1.getEntitiesWithinAABB(FCEntityPigZombie.class, var2.boundingBox.expand(32.0D, 32.0D, 32.0D)); - - for (int var4 = 0; var4 < var3.size(); ++var4) - { - Entity var5 = (Entity)var3.get(var4); - var5.attackEntityFrom(DamageSource.causePlayerDamage(var2), 0); - } - } -} diff --git a/minecraft/betterterrain/item/BTAItemPileSoulSand.java b/minecraft/betterterrain/item/BTAItemPileSoulSand.java deleted file mode 100644 index 880acc1..0000000 --- a/minecraft/betterterrain/item/BTAItemPileSoulSand.java +++ /dev/null @@ -1,99 +0,0 @@ -// FCMOD - -package betterterrain.item; - -import betterterrain.world.generate.BTAChunkProvider; -import betterterrain.world.generate.NetherChunkProvider; -import betterterrain.world.generate.SkyChunkProvider; -import net.minecraft.src.ChunkProviderHell; -import net.minecraft.src.ChunkProviderServer; -import net.minecraft.src.CreativeTabs; -import net.minecraft.src.EntityList; -import net.minecraft.src.EntityPlayer; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.FCEntitySoulSand; -import net.minecraft.src.FCItemPileSoulSand; -import net.minecraft.src.FCSpawnLocation; -import net.minecraft.src.FCSpawnLocationList; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.ItemStack; -import net.minecraft.src.StructureStart; -import net.minecraft.src.World; - -public class BTAItemPileSoulSand extends FCItemPileSoulSand -{ - public BTAItemPileSoulSand(int itemID) { - super(itemID); - } - - @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - if (!world.isRemote) { - boolean hasTarget = false; - - double targetXPos = player.posX; - double targetZPos = player.posZ; - - if (world.provider.dimensionId == 0) { - FCSpawnLocationList spawnList = world.GetSpawnLocationList(); - - FCSpawnLocation closestSpawnLoc = spawnList.GetClosestSpawnLocationForPosition(player.posX, player.posZ); - - if (closestSpawnLoc != null) { - targetXPos = closestSpawnLoc.m_iIPos; - targetZPos = closestSpawnLoc.m_iKPos; - - hasTarget = true; - } - } - else if (world.provider.dimensionId == -1) { - IChunkProvider provider = world.getChunkProvider(); - - if (provider != null && provider instanceof ChunkProviderServer) { - ChunkProviderServer serverProvider = (ChunkProviderServer)provider; - - provider = serverProvider.GetCurrentProvider(); - - if (provider != null) { - StructureStart closestFortress = null; - - if (provider instanceof ChunkProviderHell) { - ChunkProviderHell hellProvider = (ChunkProviderHell) provider; - closestFortress = hellProvider.genNetherBridge.GetClosestStructureWithinRangeSq(player.posX, player.posZ, 90000); // 300 block range - } - else if (provider instanceof BTAChunkProvider) { - BTAChunkProvider btaProvider = (BTAChunkProvider) provider; - - if (btaProvider.isNether()) { - closestFortress = btaProvider.getNetherBridgeGenerator().GetClosestStructureWithinRangeSq(player.posX, player.posZ, 90000); // 300 block range - } - } - - if (closestFortress != null) { - targetXPos = (double)closestFortress.getBoundingBox().getCenterX(); - targetZPos = (double)closestFortress.getBoundingBox().getCenterZ(); - - hasTarget = true; - } - } - } - } - - FCEntitySoulSand sandEntity = (FCEntitySoulSand) EntityList.createEntityOfType(FCEntitySoulSand.class, world, player.posX, player.posY + 2.0D - (double)player.yOffset, player.posZ); - - sandEntity.MoveTowards(targetXPos, targetZPos); - - world.spawnEntityInWorld(sandEntity); - - if (hasTarget) { - world.playAuxSFX(FCBetterThanWolves.m_iGhastMoanSoundAuxFXID, (int) Math.round(sandEntity.posX), (int) Math.round(sandEntity.posY), (int) Math.round(sandEntity.posZ), 0); - } - - if (!player.capabilities.isCreativeMode) { - --stack.stackSize; - } - } - - return stack; - } -} diff --git a/minecraft/betterterrain/structure/BTAStructureComponent.java b/minecraft/betterterrain/structure/BTAStructureComponent.java deleted file mode 100644 index a70a924..0000000 --- a/minecraft/betterterrain/structure/BTAStructureComponent.java +++ /dev/null @@ -1,589 +0,0 @@ -package betterterrain.structure; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.BlockDirectional; -import net.minecraft.src.BlockDoor; -import net.minecraft.src.BlockFenceGate; -import net.minecraft.src.BlockFlower; -import net.minecraft.src.BlockTrapDoor; -import net.minecraft.src.Direction; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.FCBlockStairs; -import net.minecraft.src.Facing; -import net.minecraft.src.ItemDoor; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureComponent; -import net.minecraft.src.World; - -abstract class BTAStructureComponent extends StructureComponent { - protected BTAStructureComponent(int par1) { - super(par1); - } - - /** - * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int - * maxZ, int placeBlockId, int placeBlockMetadata, int replaceBlockId, int replaceBlockMetadata, boolean - * alwaysreplace) - */ - protected void fillWithMetadataBlocks(World world, StructureBoundingBox structBB, int minY, int minX, int minZ, int maxY, int maxX, int maxZ, int par9, int par10, int par11, int par12, boolean par13) - { - for (int i = minX; i <= maxX; ++i) - { - for (int j = minY; j <= maxY; ++j) - { - for (int k = minZ; k <= maxZ; ++k) - { - if (!par13 || this.getBlockIdAtCurrentPosition(world, j, i, k, structBB) != 0) - { - if (i != minX && i != maxX && j != minY && j != maxY && k != minZ && k != maxZ) - { - this.placeBlockAtCurrentPosition(world, par11, par12, j, i, k, structBB); - } - else - { - this.placeBlockAtCurrentPosition(world, par9, par10, j, i, k, structBB); - } - } - } - } - } - } - - /** - * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int - * maxZ, int placeBlockId, int placeBlockMetadata, int replaceBlockId, int replaceBlockMetadata, boolean - * alwaysreplace) - */ - protected void fillWithMetadataBlocksIfEmpty(World world, StructureBoundingBox structBB, int minY, int minX, int minZ, int maxY, int maxX, int maxZ, int par9, int par10) - { - for (int i = minX; i <= maxX; ++i) - { - for (int j = minY; j <= maxY; ++j) - { - for (int k = minZ; k <= maxZ; ++k) - { - if (this.getBlockIdAtCurrentPosition(world, j, i, k, structBB) == 0 || Block.blocksList[this.getBlockIdAtCurrentPosition(world, j, i, k, structBB)].blockMaterial.isReplaceable() || Block.blocksList[this.getBlockIdAtCurrentPosition(world, j, i, k, structBB)] instanceof BlockFlower) - { - this.placeBlockAtCurrentPosition(world, par9, par10, j, i, k, structBB); - } - } - } - } - } - - /** - * Overwrites air and liquids from selected position downwards, stops at hitting anything else. - */ - protected void fillCurrentPositionBlocksDownwards(World par1World, int par2, int par3, int par4, int par5, int par6, StructureBoundingBox par7StructureBoundingBox) - { - int var8 = this.getXWithOffset(par4, par6); - int var9 = this.getYWithOffset(par5); - int var10 = this.getZWithOffset(par4, par6); - - if (par7StructureBoundingBox.isVecInside(var8, var9, var10)) - { - while ((par1World.isAirBlock(var8, var9, var10) || par1World.getBlockMaterial(var8, var9, var10).isLiquid() || Block.blocksList[par1World.getBlockId(var8, var9, var10)].blockMaterial.isReplaceable() || Block.blocksList[par1World.getBlockId(var8, var9, var10)] instanceof BlockFlower) && var9 > 1) - { - par1World.setBlock(var8, var9, var10, par2, par3, 2); - --var9; - } - } - } - - protected void placeDoorAtCurrentPosition(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, int par7, BlockDoor door) - { - int var8 = this.getXWithOffset(par4, par6); - int var9 = this.getYWithOffset(par5); - int var10 = this.getZWithOffset(par4, par6); - - if (par2StructureBoundingBox.isVecInside(var8, var9, var10)) - { - ItemDoor.placeDoorBlock(par1World, var8, var9, var10, par7, door); - } - } - - protected int getMetadataWithOffset(int blockId, int meta) - { - /*try {*/ - if (blockId == Block.rail.blockID) - { - if (this.coordBaseMode == 1 || this.coordBaseMode == 3) - { - if (meta == 1) - { - return 0; - } - - return 1; - } - } - else if (!(Block.blocksList[blockId] instanceof BlockDoor)) - { - if (!(Block.blocksList[blockId] instanceof FCBlockStairs)) - { - if (blockId == Block.ladder.blockID) - { - if (this.coordBaseMode == 0) - { - if (meta == 2) - { - return 3; - } - - if (meta == 3) - { - return 2; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 2) - { - return 4; - } - - if (meta == 3) - { - return 5; - } - - if (meta == 4) - { - return 2; - } - - if (meta == 5) - { - return 3; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 2) - { - return 5; - } - - if (meta == 3) - { - return 4; - } - - if (meta == 4) - { - return 2; - } - - if (meta == 5) - { - return 3; - } - } - } - else if (blockId == Block.stoneButton.blockID) - { - if (this.coordBaseMode == 0) - { - if (meta == 3) - { - return 4; - } - - if (meta == 4) - { - return 3; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 3) - { - return 1; - } - - if (meta == 4) - { - return 2; - } - - if (meta == 2) - { - return 3; - } - - if (meta == 1) - { - return 4; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 3) - { - return 2; - } - - if (meta == 4) - { - return 1; - } - - if (meta == 2) - { - return 3; - } - - if (meta == 1) - { - return 4; - } - } - } - else if (blockId != Block.tripWireSource.blockID && (Block.blocksList[blockId] == null || !(Block.blocksList[blockId] instanceof BlockDirectional))) - { - if (blockId == Block.pistonBase.blockID || blockId == Block.pistonStickyBase.blockID || blockId == Block.lever.blockID || blockId == Block.dispenser.blockID) - { - if (this.coordBaseMode == 0) - { - if (meta == 2 || meta == 3) - { - return Facing.oppositeSide[meta]; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 2) - { - return 4; - } - - if (meta == 3) - { - return 5; - } - - if (meta == 4) - { - return 2; - } - - if (meta == 5) - { - return 3; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 2) - { - return 5; - } - - if (meta == 3) - { - return 4; - } - - if (meta == 4) - { - return 2; - } - - if (meta == 5) - { - return 3; - } - } - } - } - else if (this.coordBaseMode == 0) - { - if (meta == 0 || meta == 2) - { - return Direction.rotateOpposite[meta]; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 2) - { - return 1; - } - - if (meta == 0) - { - return 3; - } - - if (meta == 1) - { - return 2; - } - - if (meta == 3) - { - return 0; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 2) - { - return 3; - } - - if (meta == 0) - { - return 1; - } - - if (meta == 1) - { - return 2; - } - - if (meta == 3) - { - return 0; - } - } - } - else if (this.coordBaseMode == 0) - { - if (meta == 2) - { - return 3; - } - - if (meta == 3) - { - return 2; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 0) - { - return 2; - } - - if (meta == 1) - { - return 3; - } - - if (meta == 2) - { - return 0; - } - - if (meta == 3) - { - return 1; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 0) - { - return 2; - } - - if (meta == 1) - { - return 3; - } - - if (meta == 2) - { - return 1; - } - - if (meta == 3) - { - return 0; - } - } - } - else if (this.coordBaseMode == 0) - { - if (meta == 0) - { - return 2; - } - - if (meta == 2) - { - return 0; - } - } - else - { - if (this.coordBaseMode == 1) - { - return meta + 1 & 3; - } - - if (this.coordBaseMode == 3) - { - return meta + 3 & 3; - } - } - - if (blockId == Block.wood.blockID) {// || (BTADecoIntegration.isDecoInstalled() && (blockId == BTADecoIntegration.barkLogStripped.blockID || blockId == BTADecoIntegration.strippedLog.blockID))) { - if (this.coordBaseMode == 1 || this.coordBaseMode == 3) { - if ((meta & 8) != 0) { - return meta - 4; - } - else { - return meta + 4; - } - } - } - - if (blockId == Block.bed.blockID) { - if (this.coordBaseMode == 1) { - meta += 1; - } - if (this.coordBaseMode == 0) { - meta += 2; - } - if (this.coordBaseMode == 3) { - meta += 3; - } - - return meta % 4; - } - - if (Block.blocksList[blockId] instanceof BlockFenceGate) { - if (this.coordBaseMode == 1 || this.coordBaseMode == 3) { - return meta % 2 + 1; - } - } - - if (Block.blocksList[blockId] instanceof BlockTrapDoor /*|| (BTADecoIntegration.isDecoInstalled() && Class.forName("DecoBlockChair").isInstance(Block.blocksList[blockId]))*/) { - if (this.coordBaseMode == 0) - { - if (meta == 0) - { - return 1; - } - - if (meta == 1) - { - return 0; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 0) - { - return 2; - } - - if (meta == 1) - { - return 3; - } - - if (meta == 2) - { - return 0; - } - - if (meta == 3) - { - return 1; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 0) - { - return 3; - } - - if (meta == 1) - { - return 2; - } - - if (meta == 2) - { - return 0; - } - - if (meta == 3) - { - return 1; - } - } - - if (blockId == FCBetterThanWolves.fcBlockFurnaceBrickIdle.blockID) { - if (this.coordBaseMode == 0) - { - if (meta == 0) - { - return 5; - } - - if (meta == 1) - { - return 4; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 0) - { - return 2; - } - - if (meta == 1) - { - return 3; - } - - if (meta == 2) - { - return 4; - } - - if (meta == 3) - { - return 5; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 0) - { - return 3; - } - - if (meta == 1) - { - return 2; - } - - if (meta == 2) - { - return 4; - } - - if (meta == 3) - { - return 5; - } - } - } - } - /*} catch (ClassNotFoundException e) { - e.printStackTrace(); - }*/ - - return meta; - } -} \ No newline at end of file diff --git a/minecraft/betterterrain/structure/BTAStructureMineshaftPieces.java b/minecraft/betterterrain/structure/BTAStructureMineshaftPieces.java deleted file mode 100644 index 7f3f6cf..0000000 --- a/minecraft/betterterrain/structure/BTAStructureMineshaftPieces.java +++ /dev/null @@ -1,89 +0,0 @@ -package betterterrain.structure; - -import java.util.List; -import java.util.Random; - -import betterterrain.structure.component.BTAComponentMineshaftCorridor; -import betterterrain.structure.component.BTAComponentMineshaftCross; -import betterterrain.structure.component.BTAComponentMineshaftStairs; -import net.minecraft.src.Block; -import net.minecraft.src.Item; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureComponent; -import net.minecraft.src.WeightedRandomChestContent; - -public class BTAStructureMineshaftPieces -{ - /** List of contents that can generate in Mineshafts. */ - private static final WeightedRandomChestContent[] mineshaftChestContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.ingotIron.itemID, 0, 1, 5, 10), new WeightedRandomChestContent(Item.ingotGold.itemID, 0, 1, 3, 5), new WeightedRandomChestContent(Item.redstone.itemID, 0, 4, 9, 5), new WeightedRandomChestContent(Item.dyePowder.itemID, 4, 4, 9, 5), new WeightedRandomChestContent(Item.diamond.itemID, 0, 1, 2, 3), new WeightedRandomChestContent(Item.coal.itemID, 0, 3, 8, 10), new WeightedRandomChestContent(Item.bread.itemID, 0, 1, 3, 15), new WeightedRandomChestContent(Item.pickaxeIron.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Block.rail.blockID, 0, 4, 8, 1), new WeightedRandomChestContent(Item.melonSeeds.itemID, 0, 2, 4, 10), new WeightedRandomChestContent(Item.pumpkinSeeds.itemID, 0, 2, 4, 10)}; - - private static StructureComponent getRandomComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) - { - int var7 = par1Random.nextInt(100); - StructureBoundingBox var8; - - if (var7 >= 80) - { - var8 = BTAComponentMineshaftCross.findValidPlacement(par0List, par1Random, par2, par3, par4, par5); - - if (var8 != null) - { - return new BTAComponentMineshaftCross(par6, par1Random, var8, par5); - } - } - else if (var7 >= 70) - { - var8 = BTAComponentMineshaftStairs.findValidPlacement(par0List, par1Random, par2, par3, par4, par5); - - if (var8 != null) - { - return new BTAComponentMineshaftStairs(par6, par1Random, var8, par5); - } - } - else - { - var8 = BTAComponentMineshaftCorridor.findValidPlacement(par0List, par1Random, par2, par3, par4, par5); - - if (var8 != null) - { - return new BTAComponentMineshaftCorridor(par6, par1Random, var8, par5); - } - } - - return null; - } - - private static StructureComponent getNextMineShaftComponent(StructureComponent par0StructureComponent, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) - { - if (par7 > 8) - { - return null; - } - else if (Math.abs(par3 - par0StructureComponent.getBoundingBox().minX) <= 80 && Math.abs(par5 - par0StructureComponent.getBoundingBox().minZ) <= 80) - { - StructureComponent var8 = getRandomComponent(par1List, par2Random, par3, par4, par5, par6, par7 + 1); - - if (var8 != null) - { - par1List.add(var8); - var8.buildComponent(par0StructureComponent, par1List, par2Random); - } - - return var8; - } - else - { - return null; - } - } - - public static StructureComponent getNextComponent(StructureComponent par0StructureComponent, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) - { - return getNextMineShaftComponent(par0StructureComponent, par1List, par2Random, par3, par4, par5, par6, par7); - } - - static WeightedRandomChestContent[] func_78816_a() - { - return mineshaftChestContents; - } -} diff --git a/minecraft/betterterrain/structure/BTAStructureMineshaftStart.java b/minecraft/betterterrain/structure/BTAStructureMineshaftStart.java deleted file mode 100644 index d9ddd55..0000000 --- a/minecraft/betterterrain/structure/BTAStructureMineshaftStart.java +++ /dev/null @@ -1,19 +0,0 @@ -package betterterrain.structure; - -import java.util.Random; - -import net.minecraft.src.ComponentMineshaftRoom; -import net.minecraft.src.StructureStart; -import net.minecraft.src.World; - -public class BTAStructureMineshaftStart extends StructureStart -{ - public BTAStructureMineshaftStart(World par1World, Random par2Random, int par3, int par4) - { - ComponentMineshaftRoom var5 = new ComponentMineshaftRoom(0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2); - this.components.add(var5); - var5.buildComponent(var5, this.components, par2Random); - this.updateBoundingBox(); - this.markAvailableHeight(par1World, par2Random, 10); - } -} diff --git a/minecraft/betterterrain/structure/component/BTAComponentMineshaftCorridor.java b/minecraft/betterterrain/structure/component/BTAComponentMineshaftCorridor.java deleted file mode 100644 index eb9cc31..0000000 --- a/minecraft/betterterrain/structure/component/BTAComponentMineshaftCorridor.java +++ /dev/null @@ -1,435 +0,0 @@ -package betterterrain.structure.component; - -import java.util.List; -import java.util.Random; - -import betterterrain.structure.BTAStructureMineshaftPieces; -import net.minecraft.src.Block; -import net.minecraft.src.EntityMinecartChest; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.Item; -import net.minecraft.src.ItemStack; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureComponent; -import net.minecraft.src.StructureMineshaftPieces; -import net.minecraft.src.TileEntityMobSpawner; -import net.minecraft.src.WeightedRandomChestContent; -import net.minecraft.src.World; - -public class BTAComponentMineshaftCorridor extends StructureComponent -{ - private final boolean hasRails; - private final boolean hasSpiders; - private boolean spawnerPlaced; - - /** - * A count of the different sections of this mine. The space between ceiling supports. - */ - private int sectionCount; - - public BTAComponentMineshaftCorridor(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) - { - super(par1); - this.coordBaseMode = par4; - this.boundingBox = par3StructureBoundingBox; - this.hasRails = par2Random.nextInt(3) == 0; - this.hasSpiders = !this.hasRails && par2Random.nextInt(23) == 0; - - if (this.coordBaseMode != 2 && this.coordBaseMode != 0) - { - this.sectionCount = par3StructureBoundingBox.getXSize() / 5; - } - else - { - this.sectionCount = par3StructureBoundingBox.getZSize() / 5; - } - } - - public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5) - { - StructureBoundingBox var6 = new StructureBoundingBox(par2, par3, par4, par2, par3 + 2, par4); - int var7; - - for (var7 = par1Random.nextInt(3) + 2; var7 > 0; --var7) - { - int var8 = var7 * 5; - - switch (par5) - { - case 0: - var6.maxX = par2 + 2; - var6.maxZ = par4 + (var8 - 1); - break; - - case 1: - var6.minX = par2 - (var8 - 1); - var6.maxZ = par4 + 2; - break; - - case 2: - var6.maxX = par2 + 2; - var6.minZ = par4 - (var8 - 1); - break; - - case 3: - var6.maxX = par2 + (var8 - 1); - var6.maxZ = par4 + 2; - } - - if (StructureComponent.findIntersecting(par0List, var6) == null) - { - break; - } - } - - return var7 > 0 ? var6 : null; - } - - /** - * Initiates construction of the Structure Component picked, at the current Location of StructGen - */ - public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) - { - int var4 = this.getComponentType(); - int var5 = par3Random.nextInt(4); - - switch (this.coordBaseMode) - { - case 0: - if (var5 <= 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ + 1, this.coordBaseMode, var4); - } - else if (var5 == 2) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ - 3, 1, var4); - } - else - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ - 3, 3, var4); - } - - break; - - case 1: - if (var5 <= 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, this.coordBaseMode, var4); - } - else if (var5 == 2) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ - 1, 2, var4); - } - else - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ + 1, 0, var4); - } - - break; - - case 2: - if (var5 <= 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ - 1, this.coordBaseMode, var4); - } - else if (var5 == 2) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, 1, var4); - } - else - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, 3, var4); - } - - break; - - case 3: - if (var5 <= 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, this.coordBaseMode, var4); - } - else if (var5 == 2) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX - 3, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ - 1, 2, var4); - } - else - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX - 3, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ + 1, 0, var4); - } - } - - if (var4 < 8) - { - int var6; - int var7; - - if (this.coordBaseMode != 2 && this.coordBaseMode != 0) - { - for (var6 = this.boundingBox.minX + 3; var6 + 3 <= this.boundingBox.maxX; var6 += 5) - { - var7 = par3Random.nextInt(5); - - if (var7 == 0) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, var6, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4 + 1); - } - else if (var7 == 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, var6, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4 + 1); - } - } - } - else - { - for (var6 = this.boundingBox.minZ + 3; var6 + 3 <= this.boundingBox.maxZ; var6 += 5) - { - var7 = par3Random.nextInt(5); - - if (var7 == 0) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, var6, 1, var4 + 1); - } - else if (var7 == 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, var6, 3, var4 + 1); - } - } - } - } - } - - /** - * Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests. - */ - protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8) - { - int var9 = this.getXWithOffset(par4, par6); - int var10 = this.getYWithOffset(par5); - int var11 = this.getZWithOffset(par4, par6); - - if (par2StructureBoundingBox.isVecInside(var9, var10, var11) && par1World.getBlockId(var9, var10, var11) == 0) - { - par1World.setBlock(var9, var10, var11, Block.rail.blockID, this.getMetadataWithOffset(Block.rail.blockID, par3Random.nextBoolean() ? 1 : 0), 2); - EntityMinecartChest var12 = new EntityMinecartChest(par1World, (double)((float)var9 + 0.5F), (double)((float)var10 + 0.5F), (double)((float)var11 + 0.5F)); - WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, var12, par8); - this.FilterChestMinecartContents(var12); - par1World.spawnEntityInWorld(var12); - return true; - } - else - { - return false; - } - } - - /** - * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at - * the end, it adds Fences... - */ - public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) - { - if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox) || this.isStructureBoundingBoxEmpty(par1World, par3StructureBoundingBox)) - { - return false; - } - else - { - int var4 = this.sectionCount * 5 - 1; - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 1, var4, 0, 0, false); - this.randomlyFillWithBlocks(par1World, par3StructureBoundingBox, par2Random, 0.8F, 0, 2, 0, 2, 2, var4, 0, 0, false); - - if (this.hasSpiders) - { - this.randomlyFillWithBlocks(par1World, par3StructureBoundingBox, par2Random, 0.6F, 0, 0, 0, 2, 1, var4, FCBetterThanWolves.fcBlockWeb.blockID, 0, false); - } - - int var5; - int var6; - int var7; - - for (var5 = 0; var5 < this.sectionCount; ++var5) - { - var6 = 2 + var5 * 5; - - boolean supportShaft = false; - - if (this.getBlockIdAtCurrentPosition(par1World, 0, 3, var6, par3StructureBoundingBox) != 0 || - this.getBlockIdAtCurrentPosition(par1World, 1, 3, var6, par3StructureBoundingBox) != 0 || - this.getBlockIdAtCurrentPosition(par1World, 2, 3, var6, par3StructureBoundingBox) != 0) - supportShaft = true; - - if (supportShaft) { - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 0, var6, 0, 1, var6, Block.wood.blockID, 0, 0, 0, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 0, var6, 2, 1, var6, Block.wood.blockID, 0, 0, 0, false); - int var8 = this.getMetadataWithOffset(Block.wood.blockID, 4); - - if (par2Random.nextInt(4) == 0) - { - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 2, var6, 0, 2, var6, Block.wood.blockID, var8, 0, 0, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 2, var6, 2, 2, var6, Block.wood.blockID, var8, 0, 0, false); - } - else - { - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 2, var6, 2, 2, var6, Block.wood.blockID, var8, 0, 0, false); - } - } - else if (var5 % 2 == 0){ - - } - - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.1F, 0, 2, var6 - 1, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.1F, 2, 2, var6 - 1, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.1F, 0, 2, var6 + 1, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.1F, 2, 2, var6 + 1, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 0, 2, var6 - 2, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 2, 2, var6 - 2, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 0, 2, var6 + 2, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 2, 2, var6 + 2, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, var6 - 1, FCBetterThanWolves.fcBlockTorchFiniteUnlit.blockID, 8); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, var6 + 1, FCBetterThanWolves.fcBlockTorchFiniteUnlit.blockID, 8); - - if (par2Random.nextInt(100) == 0) - { - this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, var6 - 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); - } - - if (par2Random.nextInt(100) == 0) - { - this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, var6 + 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); - } - - if (this.hasSpiders && !this.spawnerPlaced) - { - var7 = this.getYWithOffset(0); - int var9 = var6 - 1 + par2Random.nextInt(3); - int var10 = this.getXWithOffset(1, var9); - var9 = this.getZWithOffset(1, var9); - - if (par3StructureBoundingBox.isVecInside(var10, var7, var9)) - { - this.spawnerPlaced = true; - par1World.setBlock(var10, var7, var9, Block.mobSpawner.blockID, 0, 2); - TileEntityMobSpawner var11 = (TileEntityMobSpawner)par1World.getBlockTileEntity(var10, var7, var9); - - if (var11 != null) - { - var11.func_98049_a().setMobID("CaveSpider"); - } - } - } - } - - for (var5 = 0; var5 <= 2; ++var5) - { - for (var6 = 0; var6 <= var4; ++var6) - { - var7 = this.getBlockIdAtCurrentPosition(par1World, var5, -1, var6, par3StructureBoundingBox); - - if (var7 == 0) - { - this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, var5, -1, var6, par3StructureBoundingBox); - } - } - } - - if (this.hasRails) - { - for (var5 = 0; var5 <= var4; ++var5) - { - var6 = this.getBlockIdAtCurrentPosition(par1World, 1, -1, var5, par3StructureBoundingBox); - - if (var6 > 0 && Block.opaqueCubeLookup[var6]) - { - this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.7F, 1, 0, var5, Block.rail.blockID, this.getMetadataWithOffset(Block.rail.blockID, 0)); - } - } - } - - return true; - } - } - - private void FilterChestMinecartContents(EntityMinecartChest var1) - { - for (int var2 = 0; var2 < var1.getSizeInventory(); ++var2) - { - ItemStack var3 = var1.getStackInSlot(var2); - - if (var3 != null) - { - int var4 = var3.itemID; - - if (var4 == Item.ingotIron.itemID) - { - if (var1.posY > 36.0D) - { - var1.setInventorySlotContents(var2, (ItemStack)null); - } - else - { - var3.stackSize = 1; - } - } - else if (var4 == Item.diamond.itemID) - { - if (var1.posY > 24.0D) - { - var1.setInventorySlotContents(var2, (ItemStack)null); - } - else - { - var3.stackSize = 1; - } - } - else if (var4 == Item.pickaxeIron.itemID) - { - var1.setInventorySlotContents(var2, (ItemStack)null); - } - else if (var4 == Item.redstone.itemID) - { - if (var1.posY > 24.0D) - { - var1.setInventorySlotContents(var2, (ItemStack)null); - } - } - else if (var4 == Item.pumpkinSeeds.itemID) - { - var1.setInventorySlotContents(var2, (ItemStack)null); - } - } - } - } - - /** - * Returns the direction-shifted metadata for blocks that require orientation, e.g. doors, stairs, ladders. - * Parameters: block ID, original metadata - */ - protected int getMetadataWithOffset(int var1, int var2) - { - if (var1 != Block.wood.blockID) - { - return super.getMetadataWithOffset(var1, var2); - } - else - { - if (this.coordBaseMode == 1 || this.coordBaseMode == 3) - { - int var3 = var2 & 3; - int var4 = var2 & 12; - - if (var4 == 4) - { - var4 = 8; - } - else if (var4 == 8) - { - var4 = 4; - } - - var2 = var3 | var4; - } - - return var2; - } - } -} diff --git a/minecraft/betterterrain/structure/component/BTAComponentMineshaftCross.java b/minecraft/betterterrain/structure/component/BTAComponentMineshaftCross.java deleted file mode 100644 index 788255e..0000000 --- a/minecraft/betterterrain/structure/component/BTAComponentMineshaftCross.java +++ /dev/null @@ -1,167 +0,0 @@ -package betterterrain.structure.component; - -import java.util.List; -import java.util.Random; - -import betterterrain.structure.BTAStructureMineshaftPieces; -import net.minecraft.src.Block; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureComponent; -import net.minecraft.src.World; - -public class BTAComponentMineshaftCross extends StructureComponent -{ - private final int corridorDirection; - private final boolean isMultipleFloors; - - public BTAComponentMineshaftCross(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) - { - super(par1); - this.corridorDirection = par4; - this.boundingBox = par3StructureBoundingBox; - this.isMultipleFloors = par3StructureBoundingBox.getYSize() > 3; - } - - public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5) - { - StructureBoundingBox var6 = new StructureBoundingBox(par2, par3, par4, par2, par3 + 2, par4); - - if (par1Random.nextInt(4) == 0) - { - var6.maxY += 4; - } - - switch (par5) - { - case 0: - var6.minX = par2 - 1; - var6.maxX = par2 + 3; - var6.maxZ = par4 + 4; - break; - - case 1: - var6.minX = par2 - 4; - var6.minZ = par4 - 1; - var6.maxZ = par4 + 3; - break; - - case 2: - var6.minX = par2 - 1; - var6.maxX = par2 + 3; - var6.minZ = par4 - 4; - break; - - case 3: - var6.maxX = par2 + 4; - var6.minZ = par4 - 1; - var6.maxZ = par4 + 3; - } - - return StructureComponent.findIntersecting(par0List, var6) != null ? null : var6; - } - - /** - * Initiates construction of the Structure Component picked, at the current Location of StructGen - */ - public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) - { - int var4 = this.getComponentType(); - - switch (this.corridorDirection) - { - case 0: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 1, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 3, var4); - break; - - case 1: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 1, var4); - break; - - case 2: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 1, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 3, var4); - break; - - case 3: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 3, var4); - } - - if (this.isMultipleFloors) - { - if (par3Random.nextBoolean()) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ - 1, 2, var4); - } - - if (par3Random.nextBoolean()) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ + 1, 1, var4); - } - - if (par3Random.nextBoolean()) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ + 1, 3, var4); - } - - if (par3Random.nextBoolean()) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.maxZ + 1, 0, var4); - } - } - } - - /** - * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at - * the end, it adds Fences... - */ - public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) - { - if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox) || this.isStructureBoundingBoxEmpty(par1World, par3StructureBoundingBox)) - { - return false; - } - else - { - if (this.isMultipleFloors) - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.minY + 3 - 1, this.boundingBox.maxZ, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.minY + 3 - 1, this.boundingBox.maxZ - 1, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.maxY - 2, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.maxY - 2, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ - 1, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY + 3, this.boundingBox.minZ + 1, this.boundingBox.maxX - 1, this.boundingBox.minY + 3, this.boundingBox.maxZ - 1, 0, 0, false); - } - else - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ - 1, 0, 0, false); - } - - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.minX + 1, this.boundingBox.maxY, this.boundingBox.minZ + 1, Block.planks.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 1, this.boundingBox.minX + 1, this.boundingBox.maxY, this.boundingBox.maxZ - 1, Block.planks.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.maxX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.minZ + 1, Block.planks.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.maxX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 1, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ - 1, Block.planks.blockID, 0, false); - - for (int var4 = this.boundingBox.minX; var4 <= this.boundingBox.maxX; ++var4) - { - for (int var5 = this.boundingBox.minZ; var5 <= this.boundingBox.maxZ; ++var5) - { - int var6 = this.getBlockIdAtCurrentPosition(par1World, var4, this.boundingBox.minY - 1, var5, par3StructureBoundingBox); - - if (var6 == 0) - { - this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, var4, this.boundingBox.minY - 1, var5, par3StructureBoundingBox); - } - } - } - - return true; - } - } -} diff --git a/minecraft/betterterrain/structure/component/BTAComponentMineshaftStairs.java b/minecraft/betterterrain/structure/component/BTAComponentMineshaftStairs.java deleted file mode 100644 index c52b7ec..0000000 --- a/minecraft/betterterrain/structure/component/BTAComponentMineshaftStairs.java +++ /dev/null @@ -1,101 +0,0 @@ -package betterterrain.structure.component; - -import java.util.List; -import java.util.Random; - -import betterterrain.structure.BTAStructureMineshaftPieces; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureComponent; -import net.minecraft.src.World; - -public class BTAComponentMineshaftStairs extends StructureComponent -{ - public BTAComponentMineshaftStairs(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) - { - super(par1); - this.coordBaseMode = par4; - this.boundingBox = par3StructureBoundingBox; - } - - /** - * Trys to find a valid place to put this component. - */ - public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5) - { - StructureBoundingBox var6 = new StructureBoundingBox(par2, par3 - 5, par4, par2, par3 + 2, par4); - - switch (par5) - { - case 0: - var6.maxX = par2 + 2; - var6.maxZ = par4 + 8; - break; - - case 1: - var6.minX = par2 - 8; - var6.maxZ = par4 + 2; - break; - - case 2: - var6.maxX = par2 + 2; - var6.minZ = par4 - 8; - break; - - case 3: - var6.maxX = par2 + 8; - var6.maxZ = par4 + 2; - } - - return StructureComponent.findIntersecting(par0List, var6) != null ? null : var6; - } - - /** - * Initiates construction of the Structure Component picked, at the current Location of StructGen - */ - public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) - { - int var4 = this.getComponentType(); - - switch (this.coordBaseMode) - { - case 0: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); - break; - - case 1: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, 1, var4); - break; - - case 2: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); - break; - - case 3: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, 3, var4); - } - } - - /** - * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at - * the end, it adds Fences... - */ - public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) - { - if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) - { - return false; - } - else - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 2, 7, 1, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 7, 2, 2, 8, 0, 0, false); - - for (int var4 = 0; var4 < 5; ++var4) - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5 - var4 - (var4 < 4 ? 1 : 0), 2 + var4, 2, 7 - var4, 2 + var4, 0, 0, false); - } - - return true; - } - } -} diff --git a/minecraft/betterterrain/structure/component/BTAComponentScatteredFeatureRedDesertPyramid.java b/minecraft/betterterrain/structure/component/BTAComponentScatteredFeatureRedDesertPyramid.java deleted file mode 100644 index c5cecdc..0000000 --- a/minecraft/betterterrain/structure/component/BTAComponentScatteredFeatureRedDesertPyramid.java +++ /dev/null @@ -1,263 +0,0 @@ -package betterterrain.structure.component; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.ComponentScatteredFeature; -import net.minecraft.src.Direction; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.FCUtilsHardcoreSpawn; -import net.minecraft.src.Item; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.WeightedRandomChestContent; -import net.minecraft.src.World; - -public class BTAComponentScatteredFeatureRedDesertPyramid extends ComponentScatteredFeature -{ - private boolean[] field_74940_h = new boolean[4]; - private static final WeightedRandomChestContent[] m_LootListArray = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.helmetGold.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.plateGold.itemID, 0, 1, 1, 2), new WeightedRandomChestContent(Item.legsGold.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.bootsGold.itemID, 0, 1, 1, 2), new WeightedRandomChestContent(Item.swordGold.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.emerald.itemID, 0, 1, 5, 15), new WeightedRandomChestContent(Item.bone.itemID, 0, 4, 6, 20), new WeightedRandomChestContent(Item.rottenFlesh.itemID, 0, 3, 7, 11), new WeightedRandomChestContent(Item.skull.itemID, 0, 1, 1, 5)}; - private static final WeightedRandomChestContent[] m_LootedLootListArray = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.bone.itemID, 0, 4, 6, 20), new WeightedRandomChestContent(Item.rottenFlesh.itemID, 0, 3, 7, 11), new WeightedRandomChestContent(Item.skull.itemID, 0, 1, 1, 5)}; - - public BTAComponentScatteredFeatureRedDesertPyramid(Random par1Random, int par2, int par3) - { - super(par1Random, par2, 64, par3, 21, 15, 21); - } - - /** - * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at - * the end, it adds Fences... - */ - public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) - { - boolean var4 = FCUtilsHardcoreSpawn.IsInLootedTempleRadius(par1World, par3StructureBoundingBox.getCenterX(), par3StructureBoundingBox.getCenterZ()); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, -4, 0, this.scatteredFeatureSizeX - 1, 0, this.scatteredFeatureSizeZ - 1, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - int var5; - - for (var5 = 1; var5 <= 9; ++var5) - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, var5, var5, var5, this.scatteredFeatureSizeX - 1 - var5, var5, this.scatteredFeatureSizeZ - 1 - var5, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, var5 + 1, var5, var5 + 1, this.scatteredFeatureSizeX - 2 - var5, var5, this.scatteredFeatureSizeZ - 2 - var5, 0, 0, false); - } - - int var6; - - for (var5 = 0; var5 < this.scatteredFeatureSizeX; ++var5) - { - for (var6 = 0; var6 < this.scatteredFeatureSizeZ; ++var6) - { - this.fillCurrentPositionBlocksDownwards(par1World, DecoIntegration.redSandStone.blockID, 0, var5, -5, var6, par3StructureBoundingBox); - } - } - - var5 = this.getMetadataWithOffset(DecoIntegration.redSandStoneStairs.blockID, 3); - var6 = this.getMetadataWithOffset(DecoIntegration.redSandStoneStairs.blockID, 2); - int var7 = this.getMetadataWithOffset(DecoIntegration.redSandStoneStairs.blockID, 0); - int var8 = this.getMetadataWithOffset(DecoIntegration.redSandStoneStairs.blockID, 1); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 9, 4, DecoIntegration.redSandStone.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 10, 1, 3, 10, 3, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, 2, 10, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var6, 2, 10, 4, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var7, 0, 10, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var8, 4, 10, 2, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 5, 0, 0, this.scatteredFeatureSizeX - 1, 9, 4, DecoIntegration.redSandStone.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 4, 10, 1, this.scatteredFeatureSizeX - 2, 10, 3, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, this.scatteredFeatureSizeX - 3, 10, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var6, this.scatteredFeatureSizeX - 3, 10, 4, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var7, this.scatteredFeatureSizeX - 5, 10, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var8, this.scatteredFeatureSizeX - 1, 10, 2, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 0, 0, 12, 4, 4, DecoIntegration.redSandStone.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 1, 0, 11, 3, 4, 0, 0, false); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 9, 1, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 9, 2, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 9, 3, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 10, 3, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 11, 3, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 11, 2, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 11, 1, 1, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 8, 3, 3, DecoIntegration.redSandStone.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 2, 8, 2, 2, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 1, 1, 16, 3, 3, DecoIntegration.redSandStone.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 1, 2, 16, 2, 2, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 4, 5, this.scatteredFeatureSizeX - 6, 4, this.scatteredFeatureSizeZ - 6, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 4, 9, 11, 4, 11, 0, 0, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, 1, 8, 8, 3, 8, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 12, 1, 8, 12, 3, 8, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, 1, 12, 8, 3, 12, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 12, 1, 12, 12, 3, 12, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 5, 4, 4, 11, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 5, 1, 5, this.scatteredFeatureSizeX - 2, 4, 11, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 7, 9, 6, 7, 11, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 7, 7, 9, this.scatteredFeatureSizeX - 7, 7, 11, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 5, 5, 9, 5, 7, 11, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 6, 5, 9, this.scatteredFeatureSizeX - 6, 7, 11, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 5, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 6, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 6, 6, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, this.scatteredFeatureSizeX - 6, 5, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, this.scatteredFeatureSizeX - 6, 6, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, this.scatteredFeatureSizeX - 7, 6, 10, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 4, 4, 2, 6, 4, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 3, 4, 4, this.scatteredFeatureSizeX - 3, 6, 4, 0, 0, false); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, 2, 4, 5, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, 2, 3, 4, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, this.scatteredFeatureSizeX - 3, 4, 5, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, this.scatteredFeatureSizeX - 3, 3, 4, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 3, 2, 2, 3, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 3, 1, 3, this.scatteredFeatureSizeX - 2, 2, 3, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, 0, 1, 1, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, 0, this.scatteredFeatureSizeX - 2, 1, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 1, 1, 2, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 1, this.scatteredFeatureSizeX - 2, 2, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var8, 2, 1, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var7, this.scatteredFeatureSizeX - 3, 1, 2, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 5, 4, 3, 18, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 5, 3, 5, this.scatteredFeatureSizeX - 5, 3, 17, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 1, 5, 4, 2, 16, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 6, 1, 5, this.scatteredFeatureSizeX - 5, 2, 16, 0, 0, false); - int var9; - - for (var9 = 5; var9 <= 17; var9 += 2) - { - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 4, 1, var9, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 4, 2, var9, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, this.scatteredFeatureSizeX - 5, 1, var9, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, this.scatteredFeatureSizeX - 5, 2, var9, par3StructureBoundingBox); - } - - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 10, 0, 7, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 10, 0, 8, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 9, 0, 9, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 11, 0, 9, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 8, 0, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 12, 0, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 7, 0, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 13, 0, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 9, 0, 11, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 11, 0, 11, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 10, 0, 12, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 10, 0, 13, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 10, 0, 10, par3StructureBoundingBox); - - for (var9 = 0; var9 <= this.scatteredFeatureSizeX - 1; var9 += this.scatteredFeatureSizeX - 1) - { - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 2, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 2, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 2, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 3, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 3, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 3, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 4, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, var9, 4, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 4, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 5, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 5, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 5, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 6, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, var9, 6, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 6, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 7, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 7, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 7, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 8, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 8, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 8, 3, par3StructureBoundingBox); - } - - for (var9 = 2; var9 <= this.scatteredFeatureSizeX - 3; var9 += this.scatteredFeatureSizeX - 3 - 2) - { - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 - 1, 2, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 2, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 + 1, 2, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 - 1, 3, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 3, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 + 1, 3, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 - 1, 4, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, var9, 4, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 + 1, 4, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 - 1, 5, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 5, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 + 1, 5, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 - 1, 6, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, var9, 6, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 + 1, 6, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 - 1, 7, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 7, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 + 1, 7, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 - 1, 8, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 8, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 + 1, 8, 0, par3StructureBoundingBox); - } - - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, 4, 0, 12, 6, 0, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 8, 6, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, 6, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 9, 5, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 10, 5, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 11, 5, 0, par3StructureBoundingBox); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, -14, 8, 12, -11, 12, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, -10, 8, 12, -10, 12, DecoIntegration.redSandStone.blockID, 1, DecoIntegration.redSandStone.blockID, 1, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, -9, 8, 12, -9, 12, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, -8, 8, 12, -1, 12, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, -11, 9, 11, -1, 11, 0, 0, false); - this.placeBlockAtCurrentPosition(par1World, Block.pressurePlatePlanks.blockID, 0, 10, -11, 10, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, -13, 9, 11, -13, 11, Block.tnt.blockID, 0, false); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 8, -11, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 8, -10, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 7, -10, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 7, -11, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, -11, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, -10, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 13, -10, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 13, -11, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -11, 8, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -10, 8, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 10, -10, 7, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 10, -11, 7, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -11, 12, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -10, 12, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 10, -10, 13, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 10, -11, 13, par3StructureBoundingBox); - int var10; - int var11; - - for (var9 = 0; var9 < 4; ++var9) - { - if (!this.field_74940_h[var9]) - { - var10 = Direction.offsetX[var9] * 2; - var11 = Direction.offsetZ[var9] * 2; - WeightedRandomChestContent[] var12 = m_LootListArray; - int var13 = 2 + par2Random.nextInt(5); - - if (var4) - { - var12 = m_LootedLootListArray; - var13 /= 2; - } - - WeightedRandomChestContent[] var14 = WeightedRandomChestContent.func_92080_a(var12, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}); - this.field_74940_h[var9] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + var10, -11, 10 + var11, var14, var13); - } - } - - if (var4) - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 0, 9, 10, 0, 10, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, -13, 9, 11, -11, 11, 0, 0, false); - var10 = this.getMetadataWithOffset(Block.ladder.blockID, 5); - var11 = FCBetterThanWolves.fcBlockLadder.SetFacing(0, var10); - - for (int var15 = -13; var15 <= 0; ++var15) - { - this.placeBlockAtCurrentPosition(par1World, FCBetterThanWolves.fcBlockLadder.blockID, var11, 9, var15, 9, par3StructureBoundingBox); - } - } - else - { - this.placeBlockAtCurrentPosition(par1World, Block.enchantmentTable.blockID, 0, 10, 1, 10, par3StructureBoundingBox); - } - - return true; - } -} diff --git a/minecraft/betterterrain/structure/mapgen/BTAMapGenCave.java b/minecraft/betterterrain/structure/mapgen/BTAMapGenCave.java deleted file mode 100644 index b5768e2..0000000 --- a/minecraft/betterterrain/structure/mapgen/BTAMapGenCave.java +++ /dev/null @@ -1,510 +0,0 @@ -package betterterrain.structure.mapgen; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.MathHelper; -import net.minecraft.src.World; - -public class BTAMapGenCave extends BTAMapGenBase -{ - /** - * Generates a larger initial cave node than usual. Called 25% of the time. - */ - protected void generateLargeCaveNode(long par1, int par3, int par4, int[] blockArray, double par6, double par8, double par10) - { - this.generateCaveNode(par1, par3, par4, blockArray, par6, par8, par10, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); - } - - /** - * Generates a node in the current cave system recursion tree. - */ - protected void generateCaveNode(long par1, int par3, int par4, int[] blockArray, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17) - { - double var19 = (double)(par3 * 16 + 8); - double var21 = (double)(par4 * 16 + 8); - float var23 = 0.0F; - float var24 = 0.0F; - Random var25 = new Random(par1); - - if (par16 <= 0) - { - int var26 = this.range * 16 - 16; - par16 = var26 - var25.nextInt(var26 / 4); - } - - boolean var54 = false; - - if (par15 == -1) - { - par15 = par16 / 2; - var54 = true; - } - - int var27 = var25.nextInt(par16 / 2) + par16 / 4; - - for (boolean var28 = var25.nextInt(6) == 0; par15 < par16; ++par15) - { - double var29 = 1.5D + (double)(MathHelper.sin((float)par15 * (float)Math.PI / (float)par16) * par12 * 1.0F); - double var31 = var29 * par17; - float var33 = MathHelper.cos(par14); - float var34 = MathHelper.sin(par14); - par6 += (double)(MathHelper.cos(par13) * var33); - par8 += (double)var34; - par10 += (double)(MathHelper.sin(par13) * var33); - - if (var28) - { - par14 *= 0.92F; - } - else - { - par14 *= 0.7F; - } - - par14 += var24 * 0.1F; - par13 += var23 * 0.1F; - var24 *= 0.9F; - var23 *= 0.75F; - var24 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 2.0F; - var23 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 4.0F; - - if (!var54 && par15 == var27 && par12 > 1.0F && par16 > 0) - { - this.generateCaveNode(var25.nextLong(), par3, par4, blockArray, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 - ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); - this.generateCaveNode(var25.nextLong(), par3, par4, blockArray, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 + ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); - return; - } - - if (var54 || var25.nextInt(4) != 0) - { - double var35 = par6 - var19; - double var37 = par10 - var21; - double var39 = (double)(par16 - par15); - double var41 = (double)(par12 + 2.0F + 16.0F); - - if (var35 * var35 + var37 * var37 - var39 * var39 > var41 * var41) - { - return; - } - - if (par6 >= var19 - 16.0D - var29 * 2.0D && par10 >= var21 - 16.0D - var29 * 2.0D && par6 <= var19 + 16.0D + var29 * 2.0D && par10 <= var21 + 16.0D + var29 * 2.0D) - { - int var55 = MathHelper.floor_double(par6 - var29) - par3 * 16 - 1; - int var36 = MathHelper.floor_double(par6 + var29) - par3 * 16 + 1; - int var56 = MathHelper.floor_double(par8 - var31) - 1; - int var38 = MathHelper.floor_double(par8 + var31) + 1; - int var57 = MathHelper.floor_double(par10 - var29) - par4 * 16 - 1; - int var40 = MathHelper.floor_double(par10 + var29) - par4 * 16 + 1; - - if (var55 < 0) - { - var55 = 0; - } - - if (var36 > 16) - { - var36 = 16; - } - - if (var56 < 1) - { - var56 = 1; - } - - if (var38 > 120) - { - var38 = 120; - } - - if (var57 < 0) - { - var57 = 0; - } - - if (var40 > 16) - { - var40 = 16; - } - - boolean var58 = false; - int var42; - int var45; - - for (var42 = var55; !var58 && var42 < var36; ++var42) - { - for (int var43 = var57; !var58 && var43 < var40; ++var43) - { - for (int var44 = var38 + 1; !var58 && var44 >= var56 - 1; --var44) - { - var45 = (var42 * 16 + var43) * 128 + var44; - - if (var44 >= 0 && var44 < 128) - { - if (blockArray[var45] == Block.waterMoving.blockID || blockArray[var45] == Block.waterStill.blockID) - { - var58 = true; - } - - if (var44 != var56 - 1 && var42 != var55 && var42 != var36 - 1 && var43 != var57 && var43 != var40 - 1) - { - var44 = var56; - } - } - } - } - } - - if (!var58) - { - for (var42 = var55; var42 < var36; ++var42) - { - double var59 = ((double)(var42 + par3 * 16) + 0.5D - par6) / var29; - - for (var45 = var57; var45 < var40; ++var45) - { - double var46 = ((double)(var45 + par4 * 16) + 0.5D - par10) / var29; - int var48 = (var42 * 16 + var45) * 128 + var38; - boolean var49 = false; - - if (var59 * var59 + var46 * var46 < 1.0D) - { - for (int var50 = var38 - 1; var50 >= var56; --var50) - { - double var51 = ((double)var50 + 0.5D - par8) / var31; - - if (var51 > -0.7D && var59 * var59 + var51 * var51 + var46 * var46 < 1.0D) - { - int var53 = blockArray[var48]; - - if (var53 == Block.grass.blockID) - { - var49 = true; - } - - if (var53 == Block.stone.blockID || var53 == Block.dirt.blockID || var53 == Block.grass.blockID || var53 == Block.netherrack.blockID) - { - if (var50 < 10 && !this.worldObj.provider.terrainType.isSky()) - { - blockArray[var48] = (byte)Block.lavaMoving.blockID; - } - else - { - blockArray[var48] = 0; - - if (var49 && blockArray[var48 - 1] == Block.dirt.blockID) - { - blockArray[var48 - 1] = this.worldObj.getBiomeGenForCoords(var42 + par3 * 16, var45 + par4 * 16).topBlock; - } - } - } - } - - --var48; - } - } - } - } - - if (var54) - { - break; - } - } - } - } - } - } - - /** - * Recursively called by generate() (generate) and optionally by itself. - */ - protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, int[] blockArray) - { - int var7 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(40) + 1) + 1); - - if (this.rand.nextInt(15) != 0) - { - var7 = 0; - } - - for (int var8 = 0; var8 < var7; ++var8) - { - double var9 = (double)(par2 * 16 + this.rand.nextInt(16)); - double var11 = (double)this.rand.nextInt(this.rand.nextInt(120) + 8); - double var13 = (double)(par3 * 16 + this.rand.nextInt(16)); - int var15 = 1; - - if (this.rand.nextInt(4) == 0) - { - this.generateLargeCaveNode(this.rand.nextLong(), par4, par5, blockArray, var9, var11, var13); - var15 += this.rand.nextInt(4); - } - - for (int var16 = 0; var16 < var15; ++var16) - { - float var17 = this.rand.nextFloat() * (float)Math.PI * 2.0F; - float var18 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; - float var19 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat(); - - if (this.rand.nextInt(10) == 0) - { - var19 *= this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F; - } - - this.generateCaveNode(this.rand.nextLong(), par4, par5, blockArray, var9, var11, var13, var19, var17, var18, 0, 0, 1.0D); - } - } - } - - //----- 3D array stuff used by simplex generator -----// - /** - * Generates a larger initial cave node than usual. Called 25% of the time. - */ - protected void generateLargeCaveNode(long par1, int par3, int par4, int[][][] blockArray, double par6, double par8, double par10) - { - this.generateCaveNode(par1, par3, par4, blockArray, par6, par8, par10, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); - } - - /** - * Generates a node in the current cave system recursion tree. - */ - protected void generateCaveNode(long par1, int par3, int par4, int[][][] blockArray, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17) - { - double var19 = (double)(par3 * 16 + 8); - double var21 = (double)(par4 * 16 + 8); - float var23 = 0.0F; - float var24 = 0.0F; - Random var25 = new Random(par1); - - if (par16 <= 0) - { - int var26 = this.range * 16 - 16; - par16 = var26 - var25.nextInt(var26 / 4); - } - - boolean var54 = false; - - if (par15 == -1) - { - par15 = par16 / 2; - var54 = true; - } - - int var27 = var25.nextInt(par16 / 2) + par16 / 4; - - for (boolean var28 = var25.nextInt(6) == 0; par15 < par16; ++par15) - { - double var29 = 1.5D + (double)(MathHelper.sin((float)par15 * (float)Math.PI / (float)par16) * par12 * 1.0F); - double var31 = var29 * par17; - float var33 = MathHelper.cos(par14); - float var34 = MathHelper.sin(par14); - par6 += (double)(MathHelper.cos(par13) * var33); - par8 += (double)var34; - par10 += (double)(MathHelper.sin(par13) * var33); - - if (var28) - { - par14 *= 0.92F; - } - else - { - par14 *= 0.7F; - } - - par14 += var24 * 0.1F; - par13 += var23 * 0.1F; - var24 *= 0.9F; - var23 *= 0.75F; - var24 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 2.0F; - var23 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 4.0F; - - if (!var54 && par15 == var27 && par12 > 1.0F && par16 > 0) - { - this.generateCaveNode(var25.nextLong(), par3, par4, blockArray, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 - ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); - this.generateCaveNode(var25.nextLong(), par3, par4, blockArray, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 + ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); - return; - } - - if (var54 || var25.nextInt(4) != 0) - { - double var35 = par6 - var19; - double var37 = par10 - var21; - double var39 = (double)(par16 - par15); - double var41 = (double)(par12 + 2.0F + 16.0F); - - if (var35 * var35 + var37 * var37 - var39 * var39 > var41 * var41) - { - return; - } - - if (par6 >= var19 - 16.0D - var29 * 2.0D && par10 >= var21 - 16.0D - var29 * 2.0D && par6 <= var19 + 16.0D + var29 * 2.0D && par10 <= var21 + 16.0D + var29 * 2.0D) - { - int var55 = MathHelper.floor_double(par6 - var29) - par3 * 16 - 1; - int var36 = MathHelper.floor_double(par6 + var29) - par3 * 16 + 1; - int var56 = MathHelper.floor_double(par8 - var31) - 1; - int var38 = MathHelper.floor_double(par8 + var31) + 1; - int var57 = MathHelper.floor_double(par10 - var29) - par4 * 16 - 1; - int var40 = MathHelper.floor_double(par10 + var29) - par4 * 16 + 1; - - if (var55 < 0) - { - var55 = 0; - } - - if (var36 > 16) - { - var36 = 16; - } - - if (var56 < 1) - { - var56 = 1; - } - - if (var38 > 180) - { - var38 = 180; - } - - if (var57 < 0) - { - var57 = 0; - } - - if (var40 > 16) - { - var40 = 16; - } - - boolean var58 = false; - int var42; - int var45; - - for (var42 = var55; !var58 && var42 < var36; ++var42) - { - for (int var43 = var57; !var58 && var43 < var40; ++var43) - { - for (int var44 = var38 + 1; !var58 && var44 >= var56 - 1; --var44) - { - //var45 = (var42 * 16 + var43) * 128 + var44; - - if (var44 >= 0 && var44 < 128) - { - if (blockArray[var42][var43][var44] == Block.waterMoving.blockID || blockArray[var42][var43][var44] == Block.waterStill.blockID) - { - var58 = true; - } - - if (var44 != var56 - 1 && var42 != var55 && var42 != var36 - 1 && var43 != var57 && var43 != var40 - 1) - { - var44 = var56; - } - } - } - } - } - - if (!var58) - { - for (var42 = var55; var42 < var36; ++var42) - { - double var59 = ((double)(var42 + par3 * 16) + 0.5D - par6) / var29; - - for (var45 = var57; var45 < var40; ++var45) - { - double var46 = ((double)(var45 + par4 * 16) + 0.5D - par10) / var29; - //int var48 = (var42 * 16 + var45) * 128 + var38; - int var48 = var38; - boolean var49 = false; - - if (var59 * var59 + var46 * var46 < 1.0D) - { - for (int var50 = var38 - 1; var50 >= var56; --var50) - { - double var51 = ((double)var50 + 0.5D - par8) / var31; - - if (var51 > -0.7D && var59 * var59 + var51 * var51 + var46 * var46 < 1.0D) - { - int var53 = blockArray[var42][var45][var48]; - - if (var53 == Block.grass.blockID) - { - var49 = true; - } - - if (var53 == Block.stone.blockID || var53 == Block.dirt.blockID || var53 == Block.grass.blockID || var53 == Block.netherrack.blockID) - { - if (var50 < 16 && !this.worldObj.provider.terrainType.isSky()) - { - blockArray[var42][var45][var48] = (byte)Block.lavaMoving.blockID; - } - else - { - blockArray[var42][var45][var48] = 0; - - if (var49 && blockArray[var42][var45][var48 - 1] == Block.dirt.blockID) - { - blockArray[var42][var45][var48 - 1] = this.worldObj.getBiomeGenForCoords(var42 + par3 * 16, var45 + par4 * 16).topBlock; - } - } - } - } - - --var48; - } - } - } - } - - if (var54) - { - break; - } - } - } - } - } - } - - /** - * Recursively called by generate() (generate) and optionally by itself. - */ - protected void recursiveGenerate(World world, int par2, int par3, int par4, int par5, int[][][] blockArray) - { - int var7 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(20) + 1) + 1); - - if (this.rand.nextInt(15) != 0) - { - var7 = 0; - } - - for (int var8 = 0; var8 < var7; ++var8) - { - double var9 = (double)(par2 * 16 + this.rand.nextInt(16)); - double var11 = (double)this.rand.nextInt(this.rand.nextInt(180) + 8); - double var13 = (double)(par3 * 16 + this.rand.nextInt(16)); - int var15 = 1; - - if (this.rand.nextInt(4) == 0) - { - this.generateLargeCaveNode(this.rand.nextLong(), par4, par5, blockArray, var9, var11, var13); - var15 += this.rand.nextInt(4); - } - - for (int var16 = 0; var16 < var15; ++var16) - { - float var17 = this.rand.nextFloat() * (float)Math.PI * 2.0F; - float var18 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; - float var19 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat(); - - if (this.rand.nextInt(10) == 0) - { - var19 *= this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F; - } - - this.generateCaveNode(this.rand.nextLong(), par4, par5, blockArray, var9, var11, var13, var19, var17, var18, 0, 0, 1.0D); - } - } - } -} diff --git a/minecraft/betterterrain/structure/mapgen/BTAMapGenNetherBridge.java b/minecraft/betterterrain/structure/mapgen/BTAMapGenNetherBridge.java deleted file mode 100644 index 4b9af84..0000000 --- a/minecraft/betterterrain/structure/mapgen/BTAMapGenNetherBridge.java +++ /dev/null @@ -1,89 +0,0 @@ -package betterterrain.structure.mapgen; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import net.minecraft.src.FCEntityBlaze; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureNetherBridgeStart; -import net.minecraft.src.StructureStart; - -public class BTAMapGenNetherBridge extends BTAMapGenStructure -{ - protected List m_mobSpawnList = new ArrayList(); - - public BTAMapGenNetherBridge() - { - this.m_mobSpawnList.add(new SpawnListEntry(FCEntityBlaze.class, 10, 2, 3)); - this.m_mobSpawnList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - } - - public List getSpawnList() - { - return this.m_mobSpawnList; - } - - public boolean HasStructureAtLoose(int var1, int var2, int var3) - { - Iterator var4 = this.structureMap.values().iterator(); - StructureStart var5; - StructureBoundingBox var6; - - do - { - if (!var4.hasNext()) - { - return false; - } - - var5 = (StructureStart)var4.next(); - var6 = var5.getBoundingBox(); - } - while (!var5.isSizeableStructure() || !var6.intersectsWith(var1, var3, var1, var3) || var2 < var6.minY || var2 > var6.maxY); - - return true; - } - - public StructureStart GetClosestStructureWithinRangeSq(double var1, double var3, double var5) - { - StructureStart var7 = null; - double var8 = var5; - Iterator var10 = this.structureMap.values().iterator(); - - while (var10.hasNext()) - { - StructureStart var11 = (StructureStart)var10.next(); - StructureBoundingBox var12 = var11.getBoundingBox(); - double var13 = (double)var12.getCenterX(); - double var15 = (double)var12.getCenterZ(); - double var17 = var1 - var13; - double var19 = var3 - var15; - double var21 = var17 * var17 + var19 * var19; - - if (var21 < var8) - { - var7 = var11; - var8 = var21; - } - } - - return var7; - } - - public boolean canSpawnStructureAtCoords(int par1, int par2) - { - int var3 = par1 >> 4; - int var4 = par2 >> 4; - this.rand.setSeed((long)(var3 ^ var4 << 4) ^ this.worldObj.getSeed()); - this.rand.nextInt(); - return this.rand.nextInt(3) != 0 ? false : (par1 != (var3 << 4) + 4 + this.rand.nextInt(8) ? false : par2 == (var4 << 4) + 4 + this.rand.nextInt(8)); - } - - protected StructureStart getStructureStart(int par1, int par2) - { - return new StructureNetherBridgeStart(this.worldObj, this.rand, par1, par2); - } -} diff --git a/minecraft/betterterrain/structure/mapgen/BTAMapGenRavine.java b/minecraft/betterterrain/structure/mapgen/BTAMapGenRavine.java deleted file mode 100644 index ceff725..0000000 --- a/minecraft/betterterrain/structure/mapgen/BTAMapGenRavine.java +++ /dev/null @@ -1,227 +0,0 @@ -package betterterrain.structure.mapgen; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.MathHelper; -import net.minecraft.src.World; - -public class BTAMapGenRavine extends BTAMapGenBase -{ - private float[] field_75046_d = new float[1024]; - - protected void generateRavine(long par1, int par3, int par4, int[] blockArray, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17) - { - Random var19 = new Random(par1); - double var20 = (double)(par3 * 16 + 8); - double var22 = (double)(par4 * 16 + 8); - float var24 = 0.0F; - float var25 = 0.0F; - - if (par16 <= 0) - { - int var26 = this.range * 16 - 16; - par16 = var26 - var19.nextInt(var26 / 4); - } - - boolean var53 = false; - - if (par15 == -1) - { - par15 = par16 / 2; - var53 = true; - } - - float var27 = 1.0F; - - for (int var28 = 0; var28 < 128; ++var28) - { - if (var28 == 0 || var19.nextInt(3) == 0) - { - var27 = 1.0F + var19.nextFloat() * var19.nextFloat() * 1.0F; - } - - this.field_75046_d[var28] = var27 * var27; - } - - for (; par15 < par16; ++par15) - { - double var54 = 1.5D + (double)(MathHelper.sin((float)par15 * (float)Math.PI / (float)par16) * par12 * 1.0F); - double var30 = var54 * par17; - var54 *= (double)var19.nextFloat() * 0.25D + 0.75D; - var30 *= (double)var19.nextFloat() * 0.25D + 0.75D; - float var32 = MathHelper.cos(par14); - float var33 = MathHelper.sin(par14); - par6 += (double)(MathHelper.cos(par13) * var32); - par8 += (double)var33; - par10 += (double)(MathHelper.sin(par13) * var32); - par14 *= 0.7F; - par14 += var25 * 0.05F; - par13 += var24 * 0.05F; - var25 *= 0.8F; - var24 *= 0.5F; - var25 += (var19.nextFloat() - var19.nextFloat()) * var19.nextFloat() * 2.0F; - var24 += (var19.nextFloat() - var19.nextFloat()) * var19.nextFloat() * 4.0F; - - if (var53 || var19.nextInt(4) != 0) - { - double var34 = par6 - var20; - double var36 = par10 - var22; - double var38 = (double)(par16 - par15); - double var40 = (double)(par12 + 2.0F + 16.0F); - - if (var34 * var34 + var36 * var36 - var38 * var38 > var40 * var40) - { - return; - } - - if (par6 >= var20 - 16.0D - var54 * 2.0D && par10 >= var22 - 16.0D - var54 * 2.0D && par6 <= var20 + 16.0D + var54 * 2.0D && par10 <= var22 + 16.0D + var54 * 2.0D) - { - int var55 = MathHelper.floor_double(par6 - var54) - par3 * 16 - 1; - int var35 = MathHelper.floor_double(par6 + var54) - par3 * 16 + 1; - int var56 = MathHelper.floor_double(par8 - var30) - 1; - int var37 = MathHelper.floor_double(par8 + var30) + 1; - int var57 = MathHelper.floor_double(par10 - var54) - par4 * 16 - 1; - int var39 = MathHelper.floor_double(par10 + var54) - par4 * 16 + 1; - - if (var55 < 0) - { - var55 = 0; - } - - if (var35 > 16) - { - var35 = 16; - } - - if (var56 < 1) - { - var56 = 1; - } - - if (var37 > 120) - { - var37 = 120; - } - - if (var57 < 0) - { - var57 = 0; - } - - if (var39 > 16) - { - var39 = 16; - } - - boolean var58 = false; - int var41; - int var44; - - for (var41 = var55; !var58 && var41 < var35; ++var41) - { - for (int var42 = var57; !var58 && var42 < var39; ++var42) - { - for (int var43 = var37 + 1; !var58 && var43 >= var56 - 1; --var43) - { - var44 = (var41 * 16 + var42) * 128 + var43; - - if (var43 >= 0 && var43 < 128) - { - if (blockArray[var44] == Block.waterMoving.blockID || blockArray[var44] == Block.waterStill.blockID) - { - var58 = true; - } - - if (var43 != var56 - 1 && var41 != var55 && var41 != var35 - 1 && var42 != var57 && var42 != var39 - 1) - { - var43 = var56; - } - } - } - } - } - - if (!var58) - { - for (var41 = var55; var41 < var35; ++var41) - { - double var59 = ((double)(var41 + par3 * 16) + 0.5D - par6) / var54; - - for (var44 = var57; var44 < var39; ++var44) - { - double var45 = ((double)(var44 + par4 * 16) + 0.5D - par10) / var54; - int var47 = (var41 * 16 + var44) * 128 + var37; - boolean var48 = false; - - if (var59 * var59 + var45 * var45 < 1.0D) - { - for (int var49 = var37 - 1; var49 >= var56; --var49) - { - double var50 = ((double)var49 + 0.5D - par8) / var30; - - if ((var59 * var59 + var45 * var45) * (double)this.field_75046_d[var49] + var50 * var50 / 6.0D < 1.0D) - { - int var52 = blockArray[var47]; - - if (var52 == Block.grass.blockID) - { - var48 = true; - } - - if (var52 == Block.stone.blockID || var52 == Block.dirt.blockID || var52 == Block.grass.blockID) - { - if (var49 < 10 && !this.worldObj.provider.terrainType.isSky()) - { - blockArray[var47] = (byte)Block.lavaMoving.blockID; - } - else - { - blockArray[var47] = 0; - - if (var48 && blockArray[var47 - 1] == Block.dirt.blockID) - { - blockArray[var47 - 1] = this.worldObj.getBiomeGenForCoords(var41 + par3 * 16, var44 + par4 * 16).topBlock; - } - } - } - } - - --var47; - } - } - } - } - - if (var53) - { - break; - } - } - } - } - } - } - - /** - * Recursively called by generate() (generate) and optionally by itself. - */ - protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, int[] blockArray) - { - if (this.rand.nextInt(50) == 0) - { - double var7 = (double)(par2 * 16 + this.rand.nextInt(16)); - double var9 = (double)(this.rand.nextInt(this.rand.nextInt(40) + 8) + 20); - double var11 = (double)(par3 * 16 + this.rand.nextInt(16)); - byte var13 = 1; - - for (int var14 = 0; var14 < var13; ++var14) - { - float var15 = this.rand.nextFloat() * (float)Math.PI * 2.0F; - float var16 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; - float var17 = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * 2.0F; - this.generateRavine(this.rand.nextLong(), par4, par5, blockArray, var7, var9, var11, var17, var15, var16, 0, 0, 3.0D); - } - } - } -} diff --git a/minecraft/betterterrain/structure/mapgen/BTAMapGenScatteredFeature.java b/minecraft/betterterrain/structure/mapgen/BTAMapGenScatteredFeature.java deleted file mode 100644 index fe86b46..0000000 --- a/minecraft/betterterrain/structure/mapgen/BTAMapGenScatteredFeature.java +++ /dev/null @@ -1,144 +0,0 @@ -package betterterrain.structure.mapgen; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Map.Entry; - -import betterterrain.structure.callable.BTACallableChunkPosHash; -import betterterrain.structure.callable.BTACallableIsFeatureChunk; -import betterterrain.structure.callable.BTACallableStructureType; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.ChunkCoordIntPair; -import net.minecraft.src.CrashReport; -import net.minecraft.src.CrashReportCategory; -import net.minecraft.src.MathHelper; -import net.minecraft.src.ReportedException; -import net.minecraft.src.StructureScatteredFeatureStart; -import net.minecraft.src.StructureStart; -import net.minecraft.src.World; - -public class BTAMapGenScatteredFeature extends BTAMapGenStructure -{ - public static final ArrayList biomelist = new ArrayList(Arrays.asList(new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desertHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills, BiomeGenBase.swampland})); - - /** contains possible spawns for scattered features */ - private List scatteredFeatureSpawnList; - - /** the maximum distance between scattered features */ - private int maxDistanceBetweenScatteredFeatures = 32; - - /** the minimum distance between scattered features */ - private int minDistanceBetweenScatteredFeatures = 8; - - public BTAMapGenScatteredFeature() - { - this.scatteredFeatureSpawnList = new ArrayList(); - } - - /** - * Recursively called by generate() (generate) and optionally by itself. - */ - protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, int[] blockArray) - { - if (!this.structureMap.containsKey(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par2, par3)))) - { - this.rand.nextInt(); - - try - { - if (this.canSpawnStructureAtCoords(par2, par3)) - { - StructureStart var7 = this.getStructureStart(par2, par3); - this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par2, par3)), var7); - } - } - catch (Throwable var10) - { - CrashReport var8 = CrashReport.makeCrashReport(var10, "Exception preparing structure feature"); - CrashReportCategory var9 = var8.makeCategory("Feature being prepared"); - var9.addCrashSectionCallable("Is feature chunk", new BTACallableIsFeatureChunk(this, par2, par3)); - var9.addCrashSection("Chunk location", String.format("%d,%d", new Object[] {Integer.valueOf(par2), Integer.valueOf(par3)})); - var9.addCrashSectionCallable("Chunk pos hash", new BTACallableChunkPosHash(this, par2, par3)); - var9.addCrashSectionCallable("Structure type", new BTACallableStructureType(this)); - throw new ReportedException(var8); - } - } - } - - public BTAMapGenScatteredFeature(Map par1Map) - { - this(); - Iterator var2 = par1Map.entrySet().iterator(); - - while (var2.hasNext()) - { - Entry var3 = (Entry)var2.next(); - - if (((String)var3.getKey()).equals("distance")) - { - this.maxDistanceBetweenScatteredFeatures = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.maxDistanceBetweenScatteredFeatures, this.minDistanceBetweenScatteredFeatures + 1); - } - } - } - - public boolean canSpawnStructureAtCoords(int par1, int par2) - { - int var3 = par1; - int var4 = par2; - - if (par1 < 0) - { - par1 -= this.maxDistanceBetweenScatteredFeatures - 1; - } - - if (par2 < 0) - { - par2 -= this.maxDistanceBetweenScatteredFeatures - 1; - } - - int var5 = par1 / this.maxDistanceBetweenScatteredFeatures; - int var6 = par2 / this.maxDistanceBetweenScatteredFeatures; - Random var7 = this.worldObj.setRandomSeed(var5, var6, 14357617); - var5 *= this.maxDistanceBetweenScatteredFeatures; - var6 *= this.maxDistanceBetweenScatteredFeatures; - var5 += var7.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures); - var6 += var7.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures); - - boolean isValidBiome = false; - - if (var3 == var5 && var4 == var6) - { - BiomeGenBase var8 = this.worldObj.getWorldChunkManager().getBiomeGenAt(var3 * 16 + 8, var4 * 16 + 8); - Iterator var9 = biomelist.iterator(); - - while (var9.hasNext()) - { - BiomeGenBase var10 = (BiomeGenBase)var9.next(); - - if (var8 == var10) - { - return this.worldObj.getTopSolidOrLiquidBlock(par1, par2) >= this.worldObj.provider.getAverageGroundLevel(); - } - } - } - - return false; - } - - protected StructureStart getStructureStart(int par1, int par2) - { - return new StructureScatteredFeatureStart(this.worldObj, this.rand, par1, par2); - } - - /** - * returns possible spawns for scattered features - */ - public List getScatteredFeatureSpawnList() - { - return this.scatteredFeatureSpawnList; - } -} diff --git a/minecraft/betterterrain/structure/mapgen/BTAMapGenStronghold.java b/minecraft/betterterrain/structure/mapgen/BTAMapGenStronghold.java deleted file mode 100644 index ab15906..0000000 --- a/minecraft/betterterrain/structure/mapgen/BTAMapGenStronghold.java +++ /dev/null @@ -1,159 +0,0 @@ -package betterterrain.structure.mapgen; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Map.Entry; - -import betterterrain.world.BTAWorldChunkManager; -import net.minecraft.src.ChunkCoordIntPair; -import net.minecraft.src.ChunkPosition; -import net.minecraft.src.ComponentStrongholdStairs2; -import net.minecraft.src.MathHelper; -import net.minecraft.src.StructureStart; -import net.minecraft.src.StructureStrongholdStart; - -public class BTAMapGenStronghold extends BTAMapGenStructure -{ - /** - * is spawned false and set true once the defined BiomeGenBases were compared with the present ones - */ - private boolean ranBiomeCheck; - private ChunkCoordIntPair[] structureCoords; - private double field_82671_h; - private int field_82672_i; - - public BTAMapGenStronghold() - { - this.structureCoords = new ChunkCoordIntPair[3]; - this.field_82671_h = 32.0D; - this.field_82672_i = 3; - } - - public BTAMapGenStronghold(Map par1Map) - { - this.structureCoords = new ChunkCoordIntPair[3]; - this.field_82671_h = 32.0D; - this.field_82672_i = 3; - Iterator var2 = par1Map.entrySet().iterator(); - - while (var2.hasNext()) - { - Entry var3 = (Entry)var2.next(); - - if (((String)var3.getKey()).equals("distance")) - { - this.field_82671_h = MathHelper.func_82713_a((String)var3.getValue(), this.field_82671_h, 1.0D); - } - else if (((String)var3.getKey()).equals("count")) - { - this.structureCoords = new ChunkCoordIntPair[MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.structureCoords.length, 1)]; - } - else if (((String)var3.getKey()).equals("spread")) - { - this.field_82672_i = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.field_82672_i, 1); - } - } - } - - public boolean canSpawnStructureAtCoords(int par1, int par2) - { - if (!this.ranBiomeCheck) - { - Random var3 = new Random(); - var3.setSeed(this.worldObj.getSeed()); - double var4 = var3.nextDouble() * Math.PI * 2.0D; - int var6 = 1; - - for (int var7 = 0; var7 < this.structureCoords.length; ++var7) - { - double var8 = (1.25D * (double)var6 + var3.nextDouble()) * this.field_82671_h * (double)var6; - int var10 = (int)Math.round(Math.cos(var4) * var8); - int var11 = (int)Math.round(Math.sin(var4) * var8); - ChunkPosition var13 = ((BTAWorldChunkManager) this.worldObj.getWorldChunkManager()).findBiomePositionForStronghold((var10 << 4) + 8, (var11 << 4) + 8, 112, var3); - - if (var13 != null) - { - var10 = var13.x >> 4; - var11 = var13.z >> 4; - } - - this.structureCoords[var7] = new ChunkCoordIntPair(var10, var11); - var4 += (Math.PI * 2D) * (double)var6 / (double)this.field_82672_i; - - if (var7 == this.field_82672_i) - { - var6 += 2 + var3.nextInt(5); - this.field_82672_i += 1 + var3.nextInt(2); - } - } - - this.ranBiomeCheck = true; - } - - ChunkCoordIntPair[] var14 = this.structureCoords; - int var15 = var14.length; - - for (int var5 = 0; var5 < var15; ++var5) - { - ChunkCoordIntPair var16 = var14[var5]; - - if (par1 == var16.chunkXPos && par2 == var16.chunkZPos) - { - return true; - } - } - - return false; - } - - /** - * Returns a list of other locations at which the structure generation has been run, or null if not relevant to this - * structure generator. - */ - protected List getCoordList() - { - ArrayList var1 = new ArrayList(); - ChunkCoordIntPair[] var2 = this.structureCoords; - int var3 = var2.length; - - for (int var4 = 0; var4 < var3; ++var4) - { - ChunkCoordIntPair var5 = var2[var4]; - - if (var5 != null) - { - var1.add(var5.getChunkPosition(64)); - } - } - - return var1; - } - - protected StructureStart getStructureStart(int par1, int par2) - { - if (this.worldObj.provider.terrainType.isSky()) { - StructureStrongholdStart var3; - - for (var3 = new StructureStrongholdStart(this.worldObj, this.rand, par1, par2); var3.getComponents().isEmpty() || ((ComponentStrongholdStairs2)var3.getComponents().get(0)).strongholdPortalRoom == null; var3 = new StructureStrongholdStart(this.worldObj, this.rand, par1, par2)) - { - ; - } - - return var3; - } - else { - StructureStrongholdStart var3; - - for (var3 = new StructureStrongholdStart(this.worldObj, this.rand, par1, par2); var3.getComponents().isEmpty() || ((ComponentStrongholdStairs2)var3.getComponents().get(0)).strongholdPortalRoom == null; var3 = new StructureStrongholdStart(this.worldObj, this.rand, par1, par2)) - { - ; - } - - return var3; - } - } -} diff --git a/minecraft/betterterrain/structure/mapgen/BTAMapGenVillage.java b/minecraft/betterterrain/structure/mapgen/BTAMapGenVillage.java deleted file mode 100644 index e9729b7..0000000 --- a/minecraft/betterterrain/structure/mapgen/BTAMapGenVillage.java +++ /dev/null @@ -1,89 +0,0 @@ -package betterterrain.structure.mapgen; - -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Map.Entry; - -import net.minecraft.src.MapGenVillage; -import net.minecraft.src.MathHelper; -import net.minecraft.src.StructureStart; -import net.minecraft.src.StructureVillageStart; - -public class BTAMapGenVillage extends BTAMapGenStructure -{ - /** World terrain type, 0 for normal, 1 for flat map */ - private int terrainType; - private int field_82665_g; - private int field_82666_h; - - public BTAMapGenVillage() - { - this.terrainType = 0; - this.field_82665_g = 32; - this.field_82666_h = 8; - } - - public BTAMapGenVillage(Map par1Map) - { - this(); - Iterator var2 = par1Map.entrySet().iterator(); - - while (var2.hasNext()) - { - Entry var3 = (Entry)var2.next(); - - if (((String)var3.getKey()).equals("size")) - { - this.terrainType = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.terrainType, 0); - } - else if (((String)var3.getKey()).equals("distance")) - { - this.field_82665_g = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.field_82665_g, this.field_82666_h + 1); - } - } - } - - public boolean canSpawnStructureAtCoords(int par1, int par2) - { - int var3 = par1; - int var4 = par2; - - if (par1 < 0) - { - par1 -= this.field_82665_g - 1; - } - - if (par2 < 0) - { - par2 -= this.field_82665_g - 1; - } - - int var5 = par1 / this.field_82665_g; - int var6 = par2 / this.field_82665_g; - Random var7 = this.worldObj.setRandomSeed(var5, var6, 10387312); - var5 *= this.field_82665_g; - var6 *= this.field_82665_g; - var5 += var7.nextInt(this.field_82665_g - this.field_82666_h); - var6 += var7.nextInt(this.field_82665_g - this.field_82666_h); - - if (var3 == var5 && var4 == var6) - { - boolean var8 = this.worldObj.getWorldChunkManager().areBiomesViable(var3 * 16 + 8, var4 * 16 + 8, 0, MapGenVillage.villageSpawnBiomes); - - if (var8) - { - return true; - } - } - - return false; - } - - protected StructureStart getStructureStart(int par1, int par2) - { - return new StructureVillageStart(this.worldObj, this.rand, par1, par2, this.terrainType); - } -} diff --git a/minecraft/betterterrain/world/config/AddonConfigurationInfo.java b/minecraft/betterterrain/world/config/AddonConfigurationInfo.java deleted file mode 100644 index 6106b72..0000000 --- a/minecraft/betterterrain/world/config/AddonConfigurationInfo.java +++ /dev/null @@ -1,60 +0,0 @@ -package betterterrain.world.config; - -import java.util.Map; - -import com.google.gson.JsonObject; - -import betterterrain.AddonVersion; -import betterterrain.BTAAddon; -import net.minecraft.src.FCAddOnHandler; - -public class AddonConfigurationInfo { - private String name; - private AddonVersion version; - private Map settings; - - public final JsonObject toJsonObject() { - JsonObject root = new JsonObject(); - - root.addProperty("name", name); - root.addProperty("version", version.toString()); - root.add("settings", exportSettings()); - - return root; - } - - public final void parseJsonObject(JsonObject json) { - this.name = json.get("name").getAsString(); - this.version = AddonVersion.fromString(json.get("version").getAsString(), BTAAddon.getAddonByInternalName(this.name)); - - this.parseConfigSettings(json.get("settings").getAsJsonObject()); - } - - /** - * Should be overriden to store additional addon-specific world generation settings - */ - public JsonObject exportSettings() { - return new JsonObject(); - } - - /** - * Should be overriden to parse additional addon-specific world generation settings - */ - public void parseConfigSettings(JsonObject settings) {} - - public AddonVersion getVersion() { - return version; - } - - public void setVersion(AddonVersion version) { - this.version = version; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/minecraft/betterterrain/world/config/WorldConfigurationInfo.java b/minecraft/betterterrain/world/config/WorldConfigurationInfo.java deleted file mode 100644 index 4f7e151..0000000 --- a/minecraft/betterterrain/world/config/WorldConfigurationInfo.java +++ /dev/null @@ -1,290 +0,0 @@ -package betterterrain.world.config; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.JsonParser; - -import betterterrain.BTAVersion; -import betterterrain.BTAAddon; -import betterterrain.BTAMod; -import betterterrain.biome.BTABiome; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.biome.BiomeInfo; -import betterterrain.world.generate.TerrainGenerator; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.FCAddOn; -import net.minecraft.src.FCAddOnHandler; - -public class WorldConfigurationInfo { - private ArrayList biomeInfoList = new ArrayList(); - private ArrayList biomesForGeneration = new ArrayList(); - - // Values initialized to default values prior to setting introduction - // Initialized values are different from the default values - private BTAVersion btaVersion = BTAVersion.V1_1_3; - private int oceanSize = 10; - private boolean generatePerlinBeaches = false; - private boolean wideRivers = false; - - private boolean climatized = false; - private int biomeSize = 2; - private TerrainGenerator generator = TerrainGenerator.CLASSIC; - - private Map addonInfoList = new HashMap(); - - public static WorldConfigurationInfo createDefaultConfiguration(boolean isDeco) { - WorldConfigurationInfo info = new WorldConfigurationInfo(); - - info.setBTAVersion(BTAMod.getInstance().currentVersion); - info.setOceanSize(5); - info.setGeneratePerlinBeaches(true); - info.setWideRivers(true); - info.setBiomeSize(1); - info.setGenerator(TerrainGenerator.CLASSIC); - - info.generateBiomeInfoListFromBiomes(BiomeConfiguration.getBiomeList(), true, false); - - // Climates default to off if not enough biomes are installed - cutoff is somewhat arbitrary - info.setClimatized(info.biomeInfoList.size() > 16); - - if (!isDeco) { - for (BiomeInfo b : info.getBiomeInfoList()) { - if (b.isDecoOnly()) { - b.setEnabled(false); - } - } - } - - for (BiomeInfo b : info.biomeInfoList) { - if (b.getEnabled()) { - info.biomesForGeneration.add((BTABiome) BiomeGenBase.biomeList[b.getID()]); - } - } - - for (FCAddOn mod : FCAddOnHandler.m_ModList.values()) { - if (mod instanceof BTAAddon) { - BTAAddon addon = (BTAAddon) mod; - AddonConfigurationInfo addonInfo = addon.createDefaultConfigInfo(); - info.addonInfoList.put(addon, addonInfo); - } - } - - return info; - } - - public static WorldConfigurationInfo createInfoFromString(String infoString) { - WorldConfigurationInfo info; - - if (!infoString.startsWith("{")) { - info = WorldConfigurationInfoLegacy.createInfoFromString(infoString); - } - else { - info = new WorldConfigurationInfo(); - info.setInfoFromString(infoString); - } - - return info; - } - - private void setInfoFromString(String infoString) { - JsonObject root = JsonParser.parseString(infoString).getAsJsonObject(); - btaVersion = BTAVersion.fromString(root.get("version").getAsString()); - - JsonObject globalSettings = root.get("global_settings").getAsJsonObject(); - oceanSize = globalSettings.get("ocean_size").getAsInt(); - generatePerlinBeaches = globalSettings.get("better_beaches").getAsBoolean(); - - if (globalSettings.has("wide_rivers")) { - wideRivers = globalSettings.get("wide_rivers").getAsBoolean(); - } - - climatized = globalSettings.get("climates").getAsBoolean(); - biomeSize = globalSettings.get("biome_size").getAsInt(); - generator = TerrainGenerator.fromName(globalSettings.get("generator").getAsString()); - - JsonObject biomes = globalSettings.get("biomes").getAsJsonObject(); - - for (Entry biomeEntry : biomes.entrySet()) { - int biomeID = BTABiome.getIDFromInternalName(biomeEntry.getKey()); - - try { - BiomeInfo biomeInfo = BiomeConfiguration.getBiomeInfoMap().get(biomeID); - biomeInfo.setEnabled(biomeEntry.getValue().getAsBoolean()); - - this.biomeInfoList.add(biomeInfo); - } - catch (NullPointerException e) { - throw new JsonParseException("Could not find biome info for biome id: " + biomeID + " (" + biomeEntry.getKey() + ")"); - } - } - - this.setBiomesForGenerationFromInfo(this.biomeInfoList); - - JsonArray addons = root.get("addons").getAsJsonArray(); - - for (JsonElement element : addons) { - JsonObject addonObject = element.getAsJsonObject(); - - BTAAddon addon = (BTAAddon) BTAAddon.getAddonByInternalName(addonObject.get("name").getAsString()); - AddonConfigurationInfo addonInfo = addon.createConfigInfo(); - addonInfo.parseJsonObject(addonObject); - - addonInfoList.put(addon, addonInfo); - } - } - - public String toString() { - JsonObject root = new JsonObject(); - root.addProperty("version", btaVersion.toString()); - - JsonObject globalSettings = new JsonObject(); - globalSettings.addProperty("ocean_size", oceanSize); - globalSettings.addProperty("better_beaches", generatePerlinBeaches); - globalSettings.addProperty("wide_rivers", wideRivers); - globalSettings.addProperty("climates", climatized); - globalSettings.addProperty("biome_size", biomeSize); - globalSettings.addProperty("generator", generator.name); - - JsonObject biomes = new JsonObject(); - - for (BiomeInfo biomeInfo : this.biomeInfoList) { - biomes.addProperty(((BTABiome) BiomeGenBase.biomeList[biomeInfo.getID()]).getInternalName(), biomeInfo.getEnabled()); - } - - globalSettings.add("biomes", biomes); - - root.add("global_settings", globalSettings); - - JsonArray addons = new JsonArray(); - - for (AddonConfigurationInfo addonInfo : addonInfoList.values()) { - addons.add(addonInfo.toJsonObject()); - } - - root.add("addons", addons); - - return root.toString(); - } - - public void generateBiomeInfoListFromBiomes(ArrayList biomeList, boolean allowDeco, boolean legacyCompatibility) { - for (BTABiome b : biomeList) { - boolean addBiome = false; - - if (b.isDecoOnly()) { - if (allowDeco) { - addBiome = true; - } - } - else if (b.isLegacyCompatible() || !legacyCompatibility) { - addBiome = true; - } - - if (addBiome) { - this.biomeInfoList.add(BiomeConfiguration.getBiomeInfoMap().get(b.biomeID).copy().setEnabled(true)); - } - } - } - - public ArrayList getBiomeInfoList() { - return biomeInfoList; - } - - public void setBiomeInfoList(ArrayList biomeInfoList) { - this.biomeInfoList = biomeInfoList; - } - - public ArrayList getBiomesForGeneration() { - return biomesForGeneration; - } - - public WorldConfigurationInfo setBiomesForGeneration(ArrayList biomesForGeneration) { - this.biomesForGeneration = biomesForGeneration; - return this; - } - - public WorldConfigurationInfo setBiomesForGenerationFromInfo(ArrayList biomeInfoListToUse) { - if (this.biomesForGeneration == null) - this.biomesForGeneration = new ArrayList(); - - for (BiomeInfo b : biomeInfoListToUse) { - if (b.getEnabled()) { - this.biomesForGeneration.add((BTABiome) BiomeGenBase.biomeList[b.getID()]); - } - } - - return this; - } - - public BTAVersion getBTAVersion() { - return btaVersion; - } - - public void setBTAVersion(BTAVersion btaVersion) { - this.btaVersion = btaVersion; - } - - public int getOceanSize() { - return oceanSize; - } - - public WorldConfigurationInfo setOceanSize(int oceanSize) { - this.oceanSize = oceanSize; - return this; - } - - public boolean generatePerlinBeaches() { - return generatePerlinBeaches; - } - - public WorldConfigurationInfo setGeneratePerlinBeaches(boolean generateBeaches) { - this.generatePerlinBeaches = generateBeaches; - return this; - } - public boolean hasWideRivers() { - return wideRivers; - } - - public void setWideRivers(boolean wideRivers) { - this.wideRivers = wideRivers; - } - - public boolean isClimatized() { - return climatized; - } - - public WorldConfigurationInfo setClimatized(boolean climatized) { - this.climatized = climatized; - return this; - } - - public int getBiomeSize() { - return biomeSize; - } - - public void setBiomeSize(int biomeSize) { - this.biomeSize = biomeSize; - } - - public TerrainGenerator getGenerator() { - return generator; - } - - public WorldConfigurationInfo setGenerator(TerrainGenerator generator) { - this.generator = generator; - return this; - } - - public static interface Condition { - public boolean satisfiesContraints(WorldConfigurationInfo info); - } -} diff --git a/minecraft/betterterrain/world/generate/BTADefaultChunkProvider.java b/minecraft/betterterrain/world/generate/BTADefaultChunkProvider.java deleted file mode 100644 index 22c49e8..0000000 --- a/minecraft/betterterrain/world/generate/BTADefaultChunkProvider.java +++ /dev/null @@ -1,665 +0,0 @@ -package betterterrain.world.generate; - -import java.util.List; -import java.util.Random; - -import betterterrain.BTAVersion; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.structure.mapgen.BTAMapGenBase; -import betterterrain.structure.mapgen.BTAMapGenCave; -import betterterrain.structure.mapgen.BTAMapGenMineshaft; -import betterterrain.structure.mapgen.BTAMapGenNetherBridge; -import betterterrain.structure.mapgen.BTAMapGenRavine; -import betterterrain.structure.mapgen.BTAMapGenScatteredFeature; -import betterterrain.structure.mapgen.BTAMapGenStronghold; -import betterterrain.structure.mapgen.BTAMapGenVillage; -import betterterrain.world.BTAChunk; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.BetaNoiseOctaves; -import betterterrain.world.generate.surface.NoShorelineSurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.BlockSand; -import net.minecraft.src.Chunk; -import net.minecraft.src.ChunkPosition; -import net.minecraft.src.EnumCreatureType; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.IProgressUpdate; -import net.minecraft.src.MathHelper; -import net.minecraft.src.NoiseGeneratorOctaves; -import net.minecraft.src.SpawnerAnimals; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenDungeons; -import net.minecraft.src.WorldGenFlowers; -import net.minecraft.src.WorldGenLakes; -import net.minecraft.src.WorldType; - -public class BTADefaultChunkProvider implements BTAChunkProvider -{ - /** RNG. */ - private Random rand; - - private NoiseGeneratorOctaves blockNoiseGen1; - private NoiseGeneratorOctaves blockNoiseGen2; - private NoiseGeneratorOctaves blockModifierNoiseGen; - public NoiseGeneratorOctaves biomeHeightNoiseGen; - - private NoiseGeneratorOctaves soilDepthNoiseGen; - - /** Reference to the World object. */ - private World worldObj; - - /** are map structures going to be generated (e.g. strongholds) */ - private final boolean mapFeaturesEnabled; - - /** Holds the overall noise array used in chunk generation */ - private double[] noiseArray; - private double[] soilDepthNoise = new double[256]; - private BTAMapGenBase caveGenerator = new BTAMapGenCave(); - - /** Holds Stronghold Generator */ - private BTAMapGenStronghold strongholdGenerator = new BTAMapGenStronghold(); - - /** Holds Village Generator */ - public BTAMapGenVillage villageGenerator = new BTAMapGenVillage(); - - /** Holds Mineshaft Generator */ - private BTAMapGenMineshaft mineshaftGenerator = new BTAMapGenMineshaft(); - protected BTAMapGenScatteredFeature scatteredFeatureGenerator = new BTAMapGenScatteredFeature(); - - /** Holds ravine generator */ - private BTAMapGenBase ravineGenerator = new BTAMapGenRavine(); - - /** The biomes that are used to generate the chunk */ - private BiomeGenBase[] biomesForGeneration; - - double[] blockModifierNoise; - double[] blockNoise1; - double[] blockNoise2; - double[] biomeHeightNoise; - - private double[] sandNoise = new double[256]; - private double[] gravelNoise = new double[256]; - private BetaNoiseOctaves sandNoiseGen; - - /** - * Used to store the 5x5 parabolic field that is used during terrain generation. - */ - float[] parabolicField; - int[][] field_73219_j = new int[32][32]; - private Random m_structureRand; - - public WorldConfigurationInfo generatorInfo; - private long seed; - private int parabolicRadius = 2; - - public BTADefaultChunkProvider(World world, long seed, boolean mapFeaturesEnabled, WorldConfigurationInfo generatorInfo) - { - this.worldObj = world; - this.mapFeaturesEnabled = mapFeaturesEnabled; - this.rand = new Random(seed); - this.m_structureRand = new Random(seed); - this.generatorInfo = generatorInfo; - this.blockNoiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); - this.blockNoiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); - this.blockModifierNoiseGen = new NoiseGeneratorOctaves(this.rand, 8); - this.soilDepthNoiseGen = new NoiseGeneratorOctaves(this.rand, 4); - this.biomeHeightNoiseGen = new NoiseGeneratorOctaves(this.rand, 16); - this.sandNoiseGen = new BetaNoiseOctaves(this.rand, 4); - this.seed = seed; - - SurfaceBuilder.initForNoiseField(this.seed); - } - - /** - * Generates the shape of the terrain for the chunk though its all stone though the water is frozen if the - * temperature is low enough - */ - public void generateTerrain(int chunkX, int chunkZ, int[] blockArray) - { - byte var4 = 4; - byte var5 = 16; - byte var6 = 63; - int var7 = var4 + 1; - byte var8 = 17; - int var9 = var4 + 1; - this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, chunkX * 4 - 2, chunkZ * 4 - 2, var7 + 5, var9 + 5); - - if (this.generatorInfo.getBTAVersion().isVersionAtLeast(BTAVersion.V1_4_0)) { - this.noiseArray = SurfaceBuilder.initializeNoiseField(this.rand, this.seed, this.noiseArray, chunkX * var4, 0, chunkZ * var4, var7, var8, var9, biomesForGeneration); - } - else { - this.noiseArray = this.initializeNoiseField(this.noiseArray, chunkX * var4, 0, chunkZ * var4, var7, var8, var9); - } - - for (int var10 = 0; var10 < var4; ++var10) - { - for (int var11 = 0; var11 < var4; ++var11) - { - for (int var12 = 0; var12 < var5; ++var12) - { - double var13 = 0.125D; - double var15 = this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0]; - double var17 = this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0]; - double var19 = this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0]; - double var21 = this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0]; - double var23 = (this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13; - double var25 = (this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13; - double var27 = (this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13; - double var29 = (this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13; - - for (int var31 = 0; var31 < 8; ++var31) - { - double var32 = 0.25D; - double var34 = var15; - double var36 = var17; - double var38 = (var19 - var15) * var32; - double var40 = (var21 - var17) * var32; - - for (int var42 = 0; var42 < 4; ++var42) - { - int var43 = var42 + var10 * 4 << 11 | 0 + var11 * 4 << 7 | var12 * 8 + var31; - short var44 = 128; - var43 -= var44; - double var45 = 0.25D; - double var47 = (var36 - var34) * var45; - double var49 = var34 - var47; - - for (int var51 = 0; var51 < 4; ++var51) - { - if ((var49 += var47) > 0.0D /*&& (biomesForGeneration[var42 + var10 * 4 << 4 | 0 + var11 * 4] != BTABiomeConfiguration.valleyMountains || (var43 & 127) < 90)*/) - { - blockArray[var43 += var44] = (byte)Block.stone.blockID; - } - else if (var12 * 8 + var31 < var6) - { - blockArray[var43 += var44] = (byte)Block.waterStill.blockID; - } - else - { - blockArray[var43 += var44] = 0; - } - } - - var34 += var38; - var36 += var40; - } - - var15 += var23; - var17 += var25; - var19 += var27; - var21 += var29; - } - } - } - } - } - - /** - * loads or generates the chunk at the chunk location specified - */ - public Chunk loadChunk(int par1, int par2) - { - return this.provideChunk(par1, par2); - } - - /** - * 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 - */ - public Chunk provideChunk(int chunkX, int chunkZ) - { - this.rand.setSeed((long)chunkX * 341873128712L + (long)chunkZ * 132897987541L); - int[] blockArray = new int[32768]; - int[] metaArray = new int[32768]; - this.generateTerrain(chunkX, chunkZ, blockArray); - - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16); - SurfaceBuilder.replaceSurface(this.rand, this.seed, chunkX, chunkZ, blockArray, metaArray, biomesForGeneration, generatorInfo, this.worldObj.provider.terrainType); - - this.caveGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.ravineGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.villageGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.strongholdGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.scatteredFeatureGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - } - - Chunk chunk = new BTAChunk(this.worldObj, blockArray, metaArray, chunkX, chunkZ); - byte[] chunkBiomeArray = chunk.getBiomeArray(); - - for (int i = 0; i < chunkBiomeArray.length; ++i) - { - chunkBiomeArray[i] = (byte)this.biomesForGeneration[i].biomeID; - } - - chunk.generateSkylightMap(); - return chunk; - } - - /** - * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the - * size. - */ - private double[] initializeNoiseField(double[] noiseArray, int posX, int posY, int posZ, int sizeX, int sizeY, int sizeZ) { - if (noiseArray == null) { - noiseArray = new double[sizeX * sizeY * sizeZ]; - } - - //Parabolic field is used for smoothing between biomes - int parabolicDiameter = parabolicRadius * 2 + 1; - - if (this.parabolicField == null) { - this.parabolicField = new float[(int) Math.pow(parabolicDiameter, 2)]; - - for (int i = -parabolicRadius; i <= parabolicRadius; ++i) { - for (int k = -parabolicRadius; k <= parabolicRadius; ++k) { - float parabolicValue = 10.0F / MathHelper.sqrt_float((float)(i * i + k * k) + 0.2F); - this.parabolicField[i + parabolicRadius + (k + parabolicRadius) * parabolicDiameter] = parabolicValue; - } - } - } - - double octaveScalarXZ = 684.412D; - double octaveScalarY = 684.412D; - this.biomeHeightNoise = this.biomeHeightNoiseGen.generateNoiseOctaves(this.biomeHeightNoise, posX, posZ, sizeX, sizeZ, 200.0D, 200.0D, 0.5D); - this.blockModifierNoise = this.blockModifierNoiseGen.generateNoiseOctaves(this.blockModifierNoise, posX, posY, posZ, sizeX, sizeY, sizeZ, octaveScalarXZ / 80.0D, octaveScalarY / 160.0D, octaveScalarXZ / 80.0D); - this.blockNoise1 = this.blockNoiseGen1.generateNoiseOctaves(this.blockNoise1, posX, posY, posZ, sizeX, sizeY, sizeZ, octaveScalarXZ, octaveScalarY, octaveScalarXZ); - this.blockNoise2 = this.blockNoiseGen2.generateNoiseOctaves(this.blockNoise2, posX, posY, posZ, sizeX, sizeY, sizeZ, octaveScalarXZ, octaveScalarY, octaveScalarXZ); - int biomeHeightNoiseIndex = 0; - int blockNoiseIndex = 0; - - //Iterates through the entire noise array for population - //Loops first through x and z, getting biome height data, then iterates through y values - for (int i = 0; i < sizeX; ++i) { - for (int k = 0; k < sizeZ; ++k) { - float biomeMaxHeightSample = 0.0F; - float biomeMinHeightSample = 0.0F; - float biomeModifierTotal = 0.0F; - BiomeGenBase biome = this.biomesForGeneration[i + parabolicRadius + (k + parabolicRadius) * (sizeX + parabolicDiameter)]; - - //Gets biome height values influenced by neighboring biomes - //Weights provided by the parabolic field - for (int c = -parabolicRadius; c <= parabolicRadius; ++c) { - for (int d = -parabolicRadius; d <= parabolicRadius; ++d) { - BiomeGenBase biomeNeighbor = this.biomesForGeneration[i + c + parabolicRadius + (k + d + parabolicRadius) * (sizeX + parabolicDiameter)]; - float biomeHeightModifierValue = this.parabolicField[c + parabolicRadius + (d + parabolicRadius) * parabolicDiameter] / (biomeNeighbor.minHeight + 2.0F); - - if (biomeNeighbor.minHeight > biome.minHeight) { - biomeHeightModifierValue /= 2.0F; - } - - biomeMaxHeightSample += biomeNeighbor.maxHeight * biomeHeightModifierValue; - biomeMinHeightSample += biomeNeighbor.minHeight * biomeHeightModifierValue; - biomeModifierTotal += biomeHeightModifierValue; - } - } - - biomeMaxHeightSample /= biomeModifierTotal; - biomeMinHeightSample /= biomeModifierTotal; - biomeMaxHeightSample = biomeMaxHeightSample * 0.9F + 0.1F; - biomeMinHeightSample = (biomeMinHeightSample * 4.0F - 1.0F) / 8.0F; - - //Gets the value from the biome noise array to modify the biome height values above - double biomeHeightNoiseModifier = this.biomeHeightNoise[biomeHeightNoiseIndex] / 8000.0D; - biomeHeightNoiseIndex++; - - if (biomeHeightNoiseModifier < 0.0D) { - biomeHeightNoiseModifier = -biomeHeightNoiseModifier * 0.3D; - } - - biomeHeightNoiseModifier = biomeHeightNoiseModifier * 3.0D - 2.0D; - - if (biomeHeightNoiseModifier < 0.0D) { - biomeHeightNoiseModifier /= 2.0D; - - if (biomeHeightNoiseModifier < -1.0D){ - biomeHeightNoiseModifier = -1.0D; - } - - biomeHeightNoiseModifier /= 2.8D; - } - else { - if (biomeHeightNoiseModifier > 1.0D) { - biomeHeightNoiseModifier = 1.0D; - } - - biomeHeightNoiseModifier /= 8.0D; - } - - //After biome height information has been processed, iterates through y values - for (int j = 0; j < sizeY; ++j) { - //Modifies biome height for x/z based on the current y value - double biomeMinHeightDouble = (double) biomeMinHeightSample; - double biomeMaxHeightDouble = (double) biomeMaxHeightSample; - biomeMinHeightDouble += biomeHeightNoiseModifier * 0.2D; - biomeMinHeightDouble = biomeMinHeightDouble * (double) sizeY / 16.0D; - double biomeMinHeightModified = (double) sizeY / 2.0D + biomeMinHeightDouble * 4.0D; - double noiseSample = 0.0D; - double biomeHeightValue = ((double) j - biomeMinHeightModified) * 12.0D / biomeMaxHeightDouble; - - if (biomeHeightValue < 0.0D) { - biomeHeightValue *= 4.0D; - } - - //Samples the noise fields at the current location - double blockNoiseModifierSample = (this.blockModifierNoise[blockNoiseIndex] / 10.0D + 1.0D) / 2.0D; - - double blockNoiseSample1 = this.blockNoise1[blockNoiseIndex] / 512.0D; - double blockNoiseSample2 = this.blockNoise2[blockNoiseIndex] / 512.0D; - - //Combines block noise fields depending on the value of the modifier sample - if (blockNoiseModifierSample < 0.0D) { - noiseSample = blockNoiseSample1; - } - else if (blockNoiseModifierSample > 1.0D) { - noiseSample = blockNoiseSample2; - } - else { - noiseSample = blockNoiseSample1 + (blockNoiseSample2 - blockNoiseSample1) * blockNoiseModifierSample; - } - - //Factors biome height calculations into final noise values - noiseSample -= biomeHeightValue; - - //Modifies noise at the top of the section - if (j > sizeY - 4) { - double sectionHeightModifier = (double)((float)(j - (sizeY - 4)) / 3.0F); - noiseSample = noiseSample * (1.0D - sectionHeightModifier) + -10.0D * sectionHeightModifier; - } - - noiseArray[blockNoiseIndex] = noiseSample; - blockNoiseIndex++; - } - } - } - - return noiseArray; - } - - /** - * Checks to see if a chunk exists at x, y - */ - public boolean chunkExists(int par1, int par2) - { - return true; - } - - /** - * Populates chunk with ores etc etc - */ - public void populate(IChunkProvider chunkProvider, int chunkX, int chunkZ) - { - BlockSand.fallInstantly = true; - int x = chunkX * 16; - int z = chunkZ * 16; - BiomeGenBase b = this.worldObj.getBiomeGenForCoords(x + 16, z + 16); - this.rand.setSeed(this.worldObj.getSeed()); - long var7 = this.rand.nextLong() / 2L * 2L + 1L; - long var9 = this.rand.nextLong() / 2L * 2L + 1L; - long var11 = this.rand.nextLong() / 2L * 2L + 1L; - long var13 = this.rand.nextLong() / 2L * 2L + 1L; - this.rand.setSeed((long)chunkX * var7 + (long)chunkZ * var9 ^ this.worldObj.getSeed()); - boolean var15 = false; - - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, chunkX, chunkZ); - this.m_structureRand.setSeed((long)chunkX * var11 + (long)chunkZ * var13 ^ this.worldObj.getSeed()); - var15 = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, chunkX, chunkZ); - this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, chunkX, chunkZ); - this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, chunkX, chunkZ); - } - - int var16; - int var17; - int var18; - - if (!var15 && this.rand.nextInt(4) == 0) - { - var16 = x + this.rand.nextInt(16) + 8; - var17 = this.rand.nextInt(128); - var18 = z + this.rand.nextInt(16) + 8; - (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, var16, var17, var18); - } - - if (!var15 && this.rand.nextInt(8) == 0) - { - var16 = x + this.rand.nextInt(16) + 8; - var17 = this.rand.nextInt(this.rand.nextInt(120) + 8); - var18 = z + this.rand.nextInt(16) + 8; - - if (var17 < 63 || this.rand.nextInt(10) == 0) - { - (new WorldGenLakes(Block.lavaStill.blockID)).generate(this.worldObj, this.rand, var16, var17, var18); - } - } - - for (var16 = 0; var16 < 8; ++var16) - { - var17 = x + this.rand.nextInt(16) + 8; - var18 = this.rand.nextInt(128); - int var19 = z + this.rand.nextInt(16) + 8; - - if ((new WorldGenDungeons()).generate(this.worldObj, this.rand, var17, var18, var19)) - { - ; - } - } - - if (b instanceof BTABiome) { - SurfaceBuilder surfaceBuilder = ((BTABiome) b).getSurfaceBuilder(); - - if (surfaceBuilder != null) { - surfaceBuilder.decorateSurface(worldObj, this.rand, (BTABiome) b, x, z, this.generatorInfo); - } - - ((BTABiome) b).decorate(this.worldObj, this.rand, x, z, this.generatorInfo); - } - else { - b.decorate(this.worldObj, this.rand, x, z); - } - SpawnerAnimals.performWorldGenSpawning(this.worldObj, b, x + 8, z + 8, 16, 16, this.rand); - - x += 8; - z += 8; - - for (var16 = 0; var16 < 16; ++var16) - { - for (var17 = 0; var17 < 16; ++var17) - { - var18 = this.worldObj.getPrecipitationHeight(x + var16, z + var17); - - if (this.worldObj.isBlockFreezable(var16 + x, var18 - 1, var17 + z)) - { - this.worldObj.setBlock(var16 + x, var18 - 1, var17 + z, Block.ice.blockID, 0, 2); - } - - if (this.worldObj.canSnowAt(var16 + x, var18, var17 + z)) - { - this.worldObj.setBlock(var16 + x, var18, var17 + z, Block.snow.blockID, 0, 2); - } - } - } - - BlockSand.fallInstantly = false; - this.BTWPostProcessChunk(this.worldObj, x - 8, z - 8); - } - - /** - * 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. - */ - public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) - { - return true; - } - - public void func_104112_b() {} - - /** - * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. - */ - public boolean unloadQueuedChunks() - { - return false; - } - - /** - * Returns if the IChunkProvider supports saving. - */ - public boolean canSave() - { - return true; - } - - /** - * Converts the instance data to a readable string. - */ - public String makeString() - { - return "RandomLevelSource"; - } - - /** - * Returns a list of creatures of the specified type that can spawn at the given location. - */ - public List getPossibleCreatures(EnumCreatureType creatureType, int x, int y, int z) { - BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(x, z); - - if (biome != null) { - if (creatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(x, y, z)) { - List spawnList = this.scatteredFeatureGenerator.getScatteredFeatureSpawnList(); - - if (spawnList != null) { - return spawnList; - } - else { - return biome.getSpawnableList(creatureType); - } - } - else { - return biome.getSpawnableList(creatureType); - } - } - else { - return null; - } - } - - @Override - public List getPossibleCreaturesStructuresOnly(EnumCreatureType creatureType, int x, int y, int z) { - BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(x, z); - - if (biome != null) { - if (creatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(x, y, z)) { - List spawnList = this.scatteredFeatureGenerator.getScatteredFeatureSpawnList(); - - if (spawnList != null) { - return spawnList; - } - } - } - - return null; - } - - public boolean doesStructureExistAtCoords(int x, int y, int z) { - return this.scatteredFeatureGenerator.hasStructureAt(x, y, z); - } - - /** - * Returns the location of the closest structure of the specified type. If not found returns null. - */ - public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) - { - return "Stronghold".equals(par2Str) && this.strongholdGenerator != null ? this.strongholdGenerator.getNearestInstance(par1World, par3, par4, par5) : null; - } - - public int getLoadedChunkCount() - { - return 0; - } - - public void recreateStructures(int par1, int par2) - { - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generate(this, this.worldObj, par1, par2, (int[])null); - this.villageGenerator.generate(this, this.worldObj, par1, par2, (int[])null); - this.strongholdGenerator.generate(this, this.worldObj, par1, par2, (int[])null); - this.scatteredFeatureGenerator.generate(this, this.worldObj, par1, par2, (int[])null); - } - } - - private void BTWPostProcessChunk(World var1, int var2, int var3) - { - if (var1.provider.dimensionId == 0) - { - this.GenerateStrata(var1, var2, var3); - this.GenerateAdditionalBrownMushrooms(var1, var2, var3); - } - } - - private void GenerateAdditionalBrownMushrooms(World var1, int var2, int var3) - { - if (var1.rand.nextInt(4) == 0) - { - WorldGenFlowers var4 = new WorldGenFlowers(Block.mushroomBrown.blockID); - int var5 = var2 + var1.rand.nextInt(16) + 8; - int var6 = var1.rand.nextInt(25); - int var7 = var3 + var1.rand.nextInt(16) + 8; - var4.generate(var1, var1.rand, var5, var6, var7); - } - } - - private void GenerateStrata(World var1, int var2, int var3) - { - Chunk var4 = var1.getChunkFromChunkCoords(var2 >> 4, var3 >> 4); - - for (int var5 = 0; var5 < 16; ++var5) - { - for (int var6 = 0; var6 < 16; ++var6) - { - int var7 = 0; - int var8; - int var9; - - for (var8 = 24 + var1.rand.nextInt(2); var7 <= var8; ++var7) - { - var9 = var4.getBlockID(var5, var7, var6); - - if (var9 == Block.stone.blockID) - { - var4.setBlockMetadata(var5, var7, var6, 2); - } - } - - for (var8 = 48 + var1.rand.nextInt(2); var7 <= var8; ++var7) - { - var9 = var4.getBlockID(var5, var7, var6); - - if (var9 == Block.stone.blockID) - { - var4.setBlockMetadata(var5, var7, var6, 1); - } - } - } - } - } - - @Override - public boolean isNether() { - return false; - } - - @Override - public BTAMapGenNetherBridge getNetherBridgeGenerator() { - return null; - } -} diff --git a/minecraft/betterterrain/world/type/BetaWorldType.java b/minecraft/betterterrain/world/type/BetaWorldType.java deleted file mode 100644 index d904cf9..0000000 --- a/minecraft/betterterrain/world/type/BetaWorldType.java +++ /dev/null @@ -1,101 +0,0 @@ -package betterterrain.world.type; - -import betterterrain.world.BetaChunkManager; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.config.WorldConfigurationInfoLegacy; -import betterterrain.world.generate.BetaChunkProvider; -import betterterrain.world.generate.EndChunkProvider; -import betterterrain.world.generate.NetherChunkProvider; -import net.minecraft.src.ChunkProviderHell; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.World; -import net.minecraft.src.WorldChunkManager; -import net.minecraft.src.WorldType; - -public class BetaWorldType extends WorldType { - public BetaWorldType(int par1, String par2Str) { - super(par1, par2Str); - } - - /** - * Gets the translation key for the name of this world type. - */ - public String getTranslateName() - { - return "Beta"; - } - - @Override - public WorldChunkManager getChunkManager(World world, String generatorOptions) { - WorldConfigurationInfo info; - - if (generatorOptions.equals("")) { - info = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(this.isDeco()); - } - else { - info = WorldConfigurationInfo.createInfoFromString(generatorOptions); - } - - return new BetaChunkManager(world, info); - } - - @Override - public IChunkProvider getChunkProviderOverworld(World world, long seed, boolean mapFeaturesEnabled, String generatorOptions) { - WorldConfigurationInfo info; - - if (generatorOptions.equals("")) { - info = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(this.isDeco()); - } - else { - info = WorldConfigurationInfo.createInfoFromString(generatorOptions); - } - - return new BetaChunkProvider(world, seed, mapFeaturesEnabled, info); - } - - @Override - public IChunkProvider getChunkProviderNether(World world, long seed, String generatorOptions) { - WorldConfigurationInfo info; - - if (generatorOptions.equals("")) { - info = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(this.isDeco()); - } - else { - info = WorldConfigurationInfo.createInfoFromString(generatorOptions); - } - - if (this.isDeco()) { - return new NetherChunkProvider(world, seed, info); - } - else { - return new ChunkProviderHell(world, seed); - } - } - - @Override - public IChunkProvider getChunkProviderEnd(World world, long seed) { - return new EndChunkProvider(world, seed); - } - - @Override - public boolean hasDeco() { - return true; - } - - @Override - public boolean isBTA() { - return true; - } - - public boolean hasOceans() { - return false; - } - - public boolean canPerlinBeachesBeToggled() { - return false; - } - - public boolean getDefaultPerlinBeachState() { - return true; - } -} \ No newline at end of file diff --git a/minecraft/betterterrain/world/type/SkyWorldType.java b/minecraft/betterterrain/world/type/SkyWorldType.java deleted file mode 100644 index 20d6924..0000000 --- a/minecraft/betterterrain/world/type/SkyWorldType.java +++ /dev/null @@ -1,119 +0,0 @@ -package betterterrain.world.type; - -import betterterrain.world.BetaChunkManager; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.config.WorldConfigurationInfoLegacy; -import betterterrain.world.generate.EndChunkProvider; -import betterterrain.world.generate.SkyChunkProvider; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.World; -import net.minecraft.src.WorldChunkManager; -import net.minecraft.src.WorldType; - -public class SkyWorldType extends WorldType { - public SkyWorldType(int par1, String par2Str) { - super(par1, par2Str); - } - - /** - * Gets the translation key for the name of this world type. - */ - public String getTranslateName() - { - return "Skylands"; - } - - @Override - public WorldChunkManager getChunkManager(World world, String generatorOptions) { - WorldConfigurationInfo info; - - if (generatorOptions.equals("")) { - info = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(this.isDeco()); - } - else { - info = WorldConfigurationInfo.createInfoFromString(generatorOptions); - } - - return new BetaChunkManager(world, info); - } - - @Override - public IChunkProvider getChunkProviderOverworld(World world, long seed, boolean mapFeaturesEnabled, String generatorOptions) { - WorldConfigurationInfo info; - - if (generatorOptions.equals("")) { - info = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(this.isDeco()); - } - else { - info = WorldConfigurationInfo.createInfoFromString(generatorOptions); - } - - return new SkyChunkProvider(world, seed, mapFeaturesEnabled, info); - } - - @Override - public IChunkProvider getChunkProviderNether(World world, long seed, String generatorOptions) { - WorldConfigurationInfo info; - - if (generatorOptions.equals("")) { - info = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(this.isDeco()); - } - else { - info = WorldConfigurationInfo.createInfoFromString(generatorOptions); - } - - return new SkyChunkProvider(world, seed, true, info).setNether(); - } - - @Override - public IChunkProvider getChunkProviderEnd(World world, long seed) { - return new EndChunkProvider(world, seed); - } - - @Override - public float getCloudHeight() { - return -8F; - } - - @Override - public int getAverageGroundLevel() { - return 16; - } - - @Override - public double getHorizon() { - return 0F; - } - - @Override - public int[] getStrataLevels() { - return new int[] {48, 32}; - } - - @Override - public boolean isSky() { - return true; - } - - @Override - public boolean hasDeco() { - return true; - } - - @Override - public boolean isBTA() { - return true; - } - - public boolean hasOceans() { - return false; - } - - public boolean canPerlinBeachesBeToggled() { - return false; - } - - public boolean getDefaultPerlinBeachState() { - return false; - } -} \ No newline at end of file diff --git a/minecraft/net/minecraft/src/BiomeDecorator.java b/minecraft/net/minecraft/src/BiomeDecorator.java deleted file mode 100644 index 277a222..0000000 --- a/minecraft/net/minecraft/src/BiomeDecorator.java +++ /dev/null @@ -1,426 +0,0 @@ -package net.minecraft.src; - -import java.util.Random; - -public class BiomeDecorator implements FCIBiomeDecorator -{ - /** The world the BiomeDecorator is currently decorating */ - protected World currentWorld; - - /** The Biome Decorator's random number generator. */ - protected Random randomGenerator; - - /** The X-coordinate of the chunk currently being decorated */ - protected int chunk_X; - - /** The Z-coordinate of the chunk currently being decorated */ - protected int chunk_Z; - - /** The biome generator object. */ - protected BiomeGenBase biome; - - /** The clay generator. */ - protected WorldGenerator clayGen = new WorldGenClay(4); - - /** The sand generator. */ - protected WorldGenerator sandGen; - - /** The gravel generator. */ - protected WorldGenerator gravelAsSandGen; - - /** The dirt generator. */ - protected WorldGenerator dirtGen; - protected WorldGenerator gravelGen; - protected WorldGenerator coalGen; - protected WorldGenerator ironGen; - - /** Field that holds gold WorldGenMinable */ - protected WorldGenerator goldGen; - - /** Field that holds redstone WorldGenMinable */ - protected WorldGenerator redstoneGen; - - /** Field that holds diamond WorldGenMinable */ - protected WorldGenerator diamondGen; - - /** Field that holds Lapis WorldGenMinable */ - protected WorldGenerator lapisGen; - - /** Field that holds one of the plantYellow WorldGenFlowers */ - protected WorldGenerator plantYellowGen; - - /** Field that holds one of the plantRed WorldGenFlowers */ - protected WorldGenerator plantRedGen; - - /** Field that holds mushroomBrown WorldGenFlowers */ - protected WorldGenerator mushroomBrownGen; - - /** Field that holds mushroomRed WorldGenFlowers */ - protected WorldGenerator mushroomRedGen; - - /** Field that holds big mushroom generator */ - protected WorldGenerator bigMushroomGen; - - /** Field that holds WorldGenReed */ - protected WorldGenerator reedGen; - - /** Field that holds WorldGenCactus */ - protected WorldGenerator cactusGen; - - /** The water lily generation! */ - protected WorldGenerator waterlilyGen; - - /** Amount of waterlilys per chunk. */ - protected int waterlilyPerChunk; - - /** - * The number of trees to attempt to generate per chunk. Up to 10 in forests, none in deserts. - */ - public int treesPerChunk; - - /** - * The number of yellow flower patches to generate per chunk. The game generates much less than this number, since - * it attempts to generate them at a random altitude. - */ - protected int flowersPerChunk; - - /** The amount of tall grass to generate per chunk. */ - protected int grassPerChunk; - - /** - * The number of dead bushes to generate per chunk. Used in deserts and swamps. - */ - protected int deadBushPerChunk; - - /** - * The number of extra mushroom patches per chunk. It generates 1/4 this number in brown mushroom patches, and 1/8 - * this number in red mushroom patches. These mushrooms go beyond the default base number of mushrooms. - */ - protected int mushroomsPerChunk; - - /** - * The number of reeds to generate per chunk. Reeds won't generate if the randomly selected placement is unsuitable. - */ - protected int reedsPerChunk; - - /** - * The number of cactus plants to generate per chunk. Cacti only work on sand. - */ - protected int cactiPerChunk; - - /** - * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. - */ - protected int sandPerChunk; - - /** - * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. There - * appear to be two separate fields for this. - */ - protected int sandPerChunk2; - - /** - * The number of clay patches to generate per chunk. Only generates when part of it is underwater. - */ - protected int clayPerChunk; - - /** Amount of big mushrooms per chunk */ - protected int bigMushroomsPerChunk; - - /** True if decorator should generate surface lava & water */ - public boolean generateLakes; - - public BiomeDecorator(BiomeGenBase par1BiomeGenBase) - { - this.sandGen = new WorldGenSand(7, Block.sand.blockID); - this.gravelAsSandGen = new WorldGenSand(6, Block.gravel.blockID); - this.dirtGen = new WorldGenMinable(Block.dirt.blockID, 32); - this.gravelGen = new WorldGenMinable(Block.gravel.blockID, 32); - this.coalGen = new WorldGenMinable(Block.oreCoal.blockID, 16); - this.ironGen = new WorldGenMinable(Block.oreIron.blockID, 8); - this.goldGen = new WorldGenMinable(Block.oreGold.blockID, 8); - this.redstoneGen = new WorldGenMinable(Block.oreRedstone.blockID, 7); - this.diamondGen = new WorldGenMinable(Block.oreDiamond.blockID, 7); - this.lapisGen = new WorldGenMinable(Block.oreLapis.blockID, 6); - this.plantYellowGen = new WorldGenFlowers(Block.plantYellow.blockID); - this.plantRedGen = new WorldGenFlowers(Block.plantRed.blockID); - this.mushroomBrownGen = new WorldGenFlowers(Block.mushroomBrown.blockID); - this.mushroomRedGen = new WorldGenFlowers(Block.mushroomRed.blockID); - this.bigMushroomGen = new WorldGenBigMushroom(); - this.reedGen = new WorldGenReed(); - this.cactusGen = new WorldGenCactus(); - this.waterlilyGen = new WorldGenWaterlily(); - this.waterlilyPerChunk = 0; - this.treesPerChunk = 0; - this.flowersPerChunk = 2; - this.grassPerChunk = 1; - this.deadBushPerChunk = 0; - this.mushroomsPerChunk = 0; - this.reedsPerChunk = 0; - this.cactiPerChunk = 0; - this.sandPerChunk = 1; - this.sandPerChunk2 = 3; - this.clayPerChunk = 1; - this.bigMushroomsPerChunk = 0; - this.generateLakes = true; - this.biome = par1BiomeGenBase; - } - - /** - * Decorates the world. Calls code that was formerly (pre-1.8) in ChunkProviderGenerate.populate - */ - @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - if (this.currentWorld != null) - { - throw new RuntimeException("Already decorating!!"); - } - else - { - this.currentWorld = par1World; - this.randomGenerator = par2Random; - this.chunk_X = par3; - this.chunk_Z = par4; - this.decorate(); - this.currentWorld = null; - this.randomGenerator = null; - } - } - - /** - * The method that does the work of actually decorating chunks - */ - protected void decorate() - { - this.generateOres(); - int var1; - int var2; - int var3; - - for (var1 = 0; var1 < this.sandPerChunk2; ++var1) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.sandGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); - } - - for (var1 = 0; var1 < this.clayPerChunk; ++var1) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.clayGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); - } - - for (var1 = 0; var1 < this.sandPerChunk; ++var1) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.sandGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); - } - - var1 = this.treesPerChunk; - - if (this.randomGenerator.nextInt(10) == 0) - { - ++var1; - } - - int var4; - - for (var2 = 0; var2 < var1; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - WorldGenerator var5 = this.biome.getRandomWorldGenForTrees(this.randomGenerator); - var5.setScale(1.0D, 1.0D, 1.0D); - var5.generate(this.currentWorld, this.randomGenerator, var3, this.currentWorld.getHeightValue(var3, var4), var4); - } - - for (var2 = 0; var2 < this.bigMushroomsPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, var3, this.currentWorld.getHeightValue(var3, var4), var4); - } - - int var7; - - for (var2 = 0; var2 < this.flowersPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.plantYellowGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - - if (this.randomGenerator.nextInt(4) == 0) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.plantRedGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - } - - for (var2 = 0; var2 < this.grassPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - WorldGenerator var6 = this.biome.getRandomWorldGenForGrass(this.randomGenerator); - var6.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - - for (var2 = 0; var2 < this.deadBushPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - (new WorldGenDeadBush(Block.deadBush.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - - for (var2 = 0; var2 < this.waterlilyPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - - for (var7 = this.randomGenerator.nextInt(128); var7 > 0 && this.currentWorld.getBlockId(var3, var7 - 1, var4) == 0; --var7) - { - ; - } - - this.waterlilyGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); - } - - for (var2 = 0; var2 < this.mushroomsPerChunk; ++var2) - { - if (this.randomGenerator.nextInt(4) == 0) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - var7 = this.currentWorld.getHeightValue(var3, var4); - this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); - } - - if (this.randomGenerator.nextInt(8) == 0) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - var7 = this.randomGenerator.nextInt(128); - this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); - } - } - - if (this.randomGenerator.nextInt(4) == 0) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.randomGenerator.nextInt(128); - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4); - } - - if (this.randomGenerator.nextInt(8) == 0) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.randomGenerator.nextInt(128); - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4); - } - - for (var2 = 0; var2 < this.reedsPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - var7 = this.randomGenerator.nextInt(128); - this.reedGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); - } - - for (var2 = 0; var2 < 10; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.reedGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - - if (this.randomGenerator.nextInt(32) == 0) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.randomGenerator.nextInt(128); - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, var2, var3, var4); - } - - for (var2 = 0; var2 < this.cactiPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.cactusGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - - if (this.generateLakes) - { - for (var2 = 0; var2 < 50; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(this.randomGenerator.nextInt(120) + 8); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - (new WorldGenLiquids(Block.waterMoving.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - - for (var2 = 0; var2 < 20; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(this.randomGenerator.nextInt(this.randomGenerator.nextInt(112) + 8) + 8); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - (new WorldGenLiquids(Block.lavaMoving.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - } - - FCAddOnHandler.decorateWorld(this, this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z, this.biome); - } - - /** - * Standard ore generation helper. Generates most ores. - */ - protected void genStandardOre1(int par1, WorldGenerator par2WorldGenerator, int par3, int par4) - { - for (int var5 = 0; var5 < par1; ++var5) - { - int var6 = this.chunk_X + this.randomGenerator.nextInt(16); - int var7 = this.randomGenerator.nextInt(par4 - par3) + par3; - int var8 = this.chunk_Z + this.randomGenerator.nextInt(16); - par2WorldGenerator.generate(this.currentWorld, this.randomGenerator, var6, var7, var8); - } - } - - /** - * Standard ore generation helper. Generates Lapis Lazuli. - */ - protected void genStandardOre2(int par1, WorldGenerator par2WorldGenerator, int par3, int par4) - { - for (int var5 = 0; var5 < par1; ++var5) - { - int var6 = this.chunk_X + this.randomGenerator.nextInt(16); - int var7 = this.randomGenerator.nextInt(par4) + this.randomGenerator.nextInt(par4) + (par3 - par4); - int var8 = this.chunk_Z + this.randomGenerator.nextInt(16); - par2WorldGenerator.generate(this.currentWorld, this.randomGenerator, var6, var7, var8); - } - } - - /** - * Generates ores in the current chunk - */ - protected void generateOres() - { - this.genStandardOre1(20, this.dirtGen, 0, 128); - this.genStandardOre1(10, this.gravelGen, 0, 128); - this.genStandardOre1(20, this.coalGen, 0, 128); - this.genStandardOre1(20, this.ironGen, 0, 64); - this.genStandardOre1(2, this.goldGen, 0, 32); - this.genStandardOre1(8, this.redstoneGen, 0, 16); - this.genStandardOre1(1, this.diamondGen, 0, 16); - this.genStandardOre2(1, this.lapisGen, 16, 16); - } -} diff --git a/minecraft/net/minecraft/src/BlockAnvil.java b/minecraft/net/minecraft/src/BlockAnvil.java deleted file mode 100644 index eab1b3e..0000000 --- a/minecraft/net/minecraft/src/BlockAnvil.java +++ /dev/null @@ -1,197 +0,0 @@ -package net.minecraft.src; - -import java.util.List; - -import betterbiomes.BetterBiomesMod; -import betterterrain.BTAMod; - -public class BlockAnvil extends BlockSand -{ - static { - BTAMod.getInstance(); - - try { - if (Class.forName("betterbiomes.BetterBiomesMod") != null) { - BetterBiomesMod.getInstance(); - } - } catch (ClassNotFoundException e) { - // Don't do anything - } - } - - /** List of types/statues the Anvil can be in. */ - public static final String[] statuses = new String[] {"intact", "slightlyDamaged", "veryDamaged"}; - private static final String[] anvilIconNames = new String[] {"anvil_top", "anvil_top_damaged_1", "anvil_top_damaged_2"}; - public int field_82521_b = 0; - private Icon[] iconArray; - - protected BlockAnvil(int par1) - { - super(par1, Material.anvil); - this.setLightOpacity(0); - this.setCreativeTab(CreativeTabs.tabDecorations); - } - - /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) - */ - public boolean renderAsNormalBlock() - { - return false; - } - - /** - * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two - * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. - */ - public boolean isOpaqueCube() - { - return false; - } - - /** - * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata - */ - public Icon getIcon(int par1, int par2) - { - if (this.field_82521_b == 3 && par1 == 1) - { - int var3 = (par2 >> 2) % this.iconArray.length; - return this.iconArray[var3]; - } - else - { - return this.blockIcon; - } - } - - /** - * When this method is called, your block should register all the icons it needs with the given IconRegister. This - * is the only chance you get to register icons. - */ - public void registerIcons(IconRegister par1IconRegister) - { - this.blockIcon = par1IconRegister.registerIcon("anvil_base"); - this.iconArray = new Icon[anvilIconNames.length]; - - for (int var2 = 0; var2 < this.iconArray.length; ++var2) - { - this.iconArray[var2] = par1IconRegister.registerIcon(anvilIconNames[var2]); - } - } - - /** - * Called when the block is placed in the world. - */ - public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving, ItemStack par6ItemStack) - { - int var7 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - int var8 = par1World.getBlockMetadata(par2, par3, par4) >> 2; - ++var7; - var7 %= 4; - - if (var7 == 0) - { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 | var8 << 2, 2); - } - - if (var7 == 1) - { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 3 | var8 << 2, 2); - } - - if (var7 == 2) - { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 0 | var8 << 2, 2); - } - - if (var7 == 3) - { - par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 | var8 << 2, 2); - } - } - - /** - * Called upon block activation (right click on the block.) - */ - public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) - { - if (par1World.isRemote) - { - return true; - } - else - { - par5EntityPlayer.displayGUIAnvil(par2, par3, par4); - return true; - } - } - - /** - * The type of render function that is called for this block - */ - public int getRenderType() - { - return 35; - } - - /** - * Determines the damage on the item the block drops. Used in cloth and wood. - */ - public int damageDropped(int par1) - { - return par1 >> 2; - } - - /** - * Updates the blocks bounds based on its current state. Args: world, x, y, z - */ - public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) - { - int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 3; - - if (var5 != 3 && var5 != 1) - { - this.setBlockBounds(0.125F, 0.0F, 0.0F, 0.875F, 1.0F, 1.0F); - } - else - { - this.setBlockBounds(0.0F, 0.0F, 0.125F, 1.0F, 1.0F, 0.875F); - } - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) - { - par3List.add(new ItemStack(par1, 1, 0)); - par3List.add(new ItemStack(par1, 1, 1)); - par3List.add(new ItemStack(par1, 1, 2)); - } - - /** - * Called when the falling block entity for this block is created - */ - protected void onStartFalling(EntityFallingSand par1EntityFallingSand) - { - par1EntityFallingSand.setIsAnvil(true); - } - - /** - * Called when the falling block entity for this block hits the ground and turns back into a block - */ - public void onFinishFalling(World par1World, int par2, int par3, int par4, int par5) - { - par1World.playAuxSFX(1022, par2, par3, par4, 0); - } - - /** - * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given - * coordinates. Args: blockAccess, x, y, z, side - */ - public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) - { - return true; - } -} diff --git a/minecraft/net/minecraft/src/ChunkProviderServer.java b/minecraft/net/minecraft/src/ChunkProviderServer.java deleted file mode 100644 index a7e141c..0000000 --- a/minecraft/net/minecraft/src/ChunkProviderServer.java +++ /dev/null @@ -1,404 +0,0 @@ -package net.minecraft.src; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -public class ChunkProviderServer implements IChunkProvider -{ - /** - * used by unload100OldestChunks to iterate the loadedChunkHashMap for unload (underlying assumption, first in, - * first out) - */ - private Set chunksToUnload = new HashSet(); - private Chunk defaultEmptyChunk; - private IChunkProvider currentChunkProvider; - private IChunkLoader currentChunkLoader; - - /** - * if this is false, the defaultEmptyChunk will be returned by the provider - */ - public boolean loadChunkOnProvideRequest = true; - private LongHashMap loadedChunkHashMap = new LongHashMap(); - private List loadedChunks = new ArrayList(); - private WorldServer worldObj; - - public ChunkProviderServer(WorldServer par1WorldServer, IChunkLoader par2IChunkLoader, IChunkProvider par3IChunkProvider) - { - this.defaultEmptyChunk = new EmptyChunk(par1WorldServer, 0, 0); - this.worldObj = par1WorldServer; - this.currentChunkLoader = par2IChunkLoader; - this.currentChunkProvider = par3IChunkProvider; - } - - /** - * Checks to see if a chunk exists at x, y - */ - public boolean chunkExists(int par1, int par2) - { - return this.loadedChunkHashMap.containsItem(ChunkCoordIntPair.chunkXZ2Int(par1, par2)); - } - - /** - * marks chunk for unload by "unload100OldestChunks" if there is no spawn point, or if the center of the chunk is - * outside 200 blocks (x or z) of the spawn - */ - // FCMOD: Added (server only) to provide alias to match client naming - /* - public void unloadChunksIfNotNearSpawn( int par1, int par2 ) - { - dropChunk( par1, par2 ); - } - */ - // END FCMOD - public void unloadChunksIfNotNearSpawn(int par1, int par2) - { - if (this.worldObj.provider.canRespawnHere()) - { - // FCCHUNK: Decide on updates around original spawn - // FCMOD: Changed - /* - ChunkCoordinates var3 = this.worldObj.getSpawnPoint(); - int var4 = par1 * 16 + 8 - var3.posX; - int var5 = par2 * 16 + 8 - var3.posZ; - short var6 = 128; - - if (var4 < -var6 || var4 > var6 || var5 < -var6 || var5 > var6) - */ - if ( !IsSpawnChunk( par1, par2 ) ) - // END FCMOD - { - this.chunksToUnload.add(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par1, par2))); - } - } - else - { - this.chunksToUnload.add(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par1, par2))); - } - } - - /** - * marks all chunks for unload, ignoring those near the spawn - */ - public void unloadAllChunks() - { - Iterator var1 = this.loadedChunks.iterator(); - - while (var1.hasNext()) - { - Chunk var2 = (Chunk)var1.next(); - this.unloadChunksIfNotNearSpawn(var2.xPosition, var2.zPosition); - } - } - - /** - * loads or generates the chunk at the chunk location specified - */ - public Chunk loadChunk(int par1, int par2) - { - long var3 = ChunkCoordIntPair.chunkXZ2Int(par1, par2); - this.chunksToUnload.remove(Long.valueOf(var3)); - Chunk var5 = (Chunk)this.loadedChunkHashMap.getValueByKey(var3); - - if (var5 == null) - { - var5 = this.safeLoadChunk(par1, par2); - - if (var5 == null) - { - if (this.currentChunkProvider == null) - { - var5 = this.defaultEmptyChunk; - } - else - { - try - { - var5 = this.currentChunkProvider.provideChunk(par1, par2); - } - catch (Throwable var9) - { - CrashReport var7 = CrashReport.makeCrashReport(var9, "Exception generating new chunk"); - CrashReportCategory var8 = var7.makeCategory("Chunk to be generated"); - var8.addCrashSection("Location", String.format("%d,%d", new Object[] {Integer.valueOf(par1), Integer.valueOf(par2)})); - var8.addCrashSection("Position hash", Long.valueOf(var3)); - var8.addCrashSection("Generator", this.currentChunkProvider.makeString()); - throw new ReportedException(var7); - } - } - } - - this.loadedChunkHashMap.add(var3, var5); - this.loadedChunks.add(var5); - - if (var5 != null) - { - var5.onChunkLoad(); - } - - var5.populateChunk(this, this, par1, par2); - } - - return var5; - } - - /** - * 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 - */ - public Chunk provideChunk(int par1, int par2) - { - Chunk var3 = (Chunk)this.loadedChunkHashMap.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(par1, par2)); - return var3 == null ? (!this.worldObj.findingSpawnPoint && !this.loadChunkOnProvideRequest ? this.defaultEmptyChunk : this.loadChunk(par1, par2)) : var3; - } - - /** - * used by loadChunk, but catches any exceptions if the load fails. - */ - private Chunk safeLoadChunk(int par1, int par2) - { - if (this.currentChunkLoader == null) - { - return null; - } - else - { - try - { - Chunk var3 = this.currentChunkLoader.loadChunk(this.worldObj, par1, par2); - - if (var3 != null) - { - var3.lastSaveTime = this.worldObj.getTotalWorldTime(); - - if (this.currentChunkProvider != null) - { - this.currentChunkProvider.recreateStructures(par1, par2); - } - } - - return var3; - } - catch (Exception var4) - { - var4.printStackTrace(); - return null; - } - } - } - - /** - * used by saveChunks, but catches any exceptions if the save fails. - */ - private void safeSaveExtraChunkData(Chunk par1Chunk) - { - if (this.currentChunkLoader != null) - { - try - { - this.currentChunkLoader.saveExtraChunkData(this.worldObj, par1Chunk); - } - catch (Exception var3) - { - var3.printStackTrace(); - } - } - } - - /** - * used by saveChunks, but catches any exceptions if the save fails. - */ - private void safeSaveChunk(Chunk par1Chunk) - { - if (this.currentChunkLoader != null) - { - try - { - par1Chunk.lastSaveTime = this.worldObj.getTotalWorldTime(); - this.currentChunkLoader.saveChunk(this.worldObj, par1Chunk); - } - catch (IOException var3) - { - var3.printStackTrace(); - } - catch (MinecraftException var4) - { - var4.printStackTrace(); - } - } - } - - /** - * Populates chunk with ores etc etc - */ - public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) - { - Chunk var4 = this.provideChunk(par2, par3); - - if (!var4.isTerrainPopulated) - { - var4.isTerrainPopulated = true; - - if (this.currentChunkProvider != null) - { - this.currentChunkProvider.populate(par1IChunkProvider, par2, par3); - var4.setChunkModified(); - } - } - } - - /** - * 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. - */ - public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) - { - int var3 = 0; - - for (int var4 = 0; var4 < this.loadedChunks.size(); ++var4) - { - Chunk var5 = (Chunk)this.loadedChunks.get(var4); - - if (par1) - { - this.safeSaveExtraChunkData(var5); - } - - if (var5.needsSaving(par1)) - { - this.safeSaveChunk(var5); - var5.isModified = false; - ++var3; - - if (var3 == 24 && !par1) - { - return false; - } - } - } - - return true; - } - - public void func_104112_b() - { - if (this.currentChunkLoader != null) - { - this.currentChunkLoader.saveExtraData(); - } - } - - /** - * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. - */ - public boolean unloadQueuedChunks() - { - if (!this.worldObj.canNotSave) - { - for (int var1 = 0; var1 < 100; ++var1) - { - if (!this.chunksToUnload.isEmpty()) - { - Long var2 = (Long)this.chunksToUnload.iterator().next(); - Chunk var3 = (Chunk)this.loadedChunkHashMap.getValueByKey(var2.longValue()); - var3.onChunkUnload(); - this.safeSaveChunk(var3); - this.safeSaveExtraChunkData(var3); - this.chunksToUnload.remove(var2); - this.loadedChunkHashMap.remove(var2.longValue()); - this.loadedChunks.remove(var3); - } - } - - if (this.currentChunkLoader != null) - { - this.currentChunkLoader.chunkTick(); - } - } - - return this.currentChunkProvider.unloadQueuedChunks(); - } - - /** - * Returns if the IChunkProvider supports saving. - */ - public boolean canSave() - { - return !this.worldObj.canNotSave; - } - - /** - * Converts the instance data to a readable string. - */ - public String makeString() - { - return "ServerChunkCache: " + this.loadedChunkHashMap.getNumHashElements() + " Drop: " + this.chunksToUnload.size(); - } - - /** - * 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) - { - return this.currentChunkProvider.getPossibleCreatures(par1EnumCreatureType, par2, par3, par4); - } - - /** - * Returns the location of the closest structure of the specified type. If not found returns null. - */ - public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) - { - return this.currentChunkProvider.findClosestStructure(par1World, par2Str, par3, par4, par5); - } - - public int getLoadedChunkCount() - { - return this.loadedChunkHashMap.getNumHashElements(); - } - - public void recreateStructures(int par1, int par2) {} - - // FCMOD: Added - public IChunkProvider GetCurrentProvider() - { - // client - return currentChunkProvider; - // server - //return serverChunkGenerator; - } - - protected boolean IsSpawnChunk( int iChunkX, int iChunkZ ) - { - if ( worldObj.provider.canRespawnHere() ) - { - ChunkCoordinates var3 = this.worldObj.getSpawnPoint(); - - // uses the same math as addPlayer in PlayerManager for consistent results - - int iSpawnChunkX = worldObj.worldInfo.getSpawnX() >> 4; - int iSpawnChunkZ = worldObj.worldInfo.getSpawnZ() >> 4; - - int iChunkViewDistance = - worldObj.getMinecraftServer().getConfigurationManager().getViewDistance(); - - return iChunkX >= iSpawnChunkX - iChunkViewDistance && - iChunkX <= iSpawnChunkX + iChunkViewDistance && - iChunkZ >= iSpawnChunkZ - iChunkViewDistance && - iChunkZ <= iSpawnChunkZ + iChunkViewDistance; - } - - return false; - } - - public void ForceAddToChunksToUnload( int iChunkX, int iChunkZ ) - { - // client - chunksToUnload.add( Long.valueOf( ChunkCoordIntPair.chunkXZ2Int( iChunkX, iChunkZ ) ) ); - // server - //droppedChunksSet.add( Long.valueOf( ChunkCoordIntPair.chunkXZ2Int( iChunkX, iChunkZ ) ) ); - } - // END FCMOD -} diff --git a/minecraft/net/minecraft/src/ComponentMineshaftRoom.java b/minecraft/net/minecraft/src/ComponentMineshaftRoom.java deleted file mode 100644 index fb8aee4..0000000 --- a/minecraft/net/minecraft/src/ComponentMineshaftRoom.java +++ /dev/null @@ -1,137 +0,0 @@ -package net.minecraft.src; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Random; - -import betterterrain.structure.BTAStructureMineshaftPieces; - -public class ComponentMineshaftRoom extends StructureComponent -{ - /** List of other Mineshaft components linked to this room. */ - private List roomsLinkedToTheRoom = new LinkedList(); - - public ComponentMineshaftRoom(int par1, Random par2Random, int par3, int par4) - { - super(par1); - this.boundingBox = new StructureBoundingBox(par3, 50, par4, par3 + 7 + par2Random.nextInt(6), 54 + par2Random.nextInt(6), par4 + 7 + par2Random.nextInt(6)); - } - - /** - * Initiates construction of the Structure Component picked, at the current Location of StructGen - */ - public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) - { - int var4 = this.getComponentType(); - int var6 = this.boundingBox.getYSize() - 3 - 1; - - if (var6 <= 0) - { - var6 = 1; - } - - int var5; - StructureComponent var7; - StructureBoundingBox var8; - - for (var5 = 0; var5 < this.boundingBox.getXSize(); var5 += 4) - { - var5 += par3Random.nextInt(this.boundingBox.getXSize()); - - if (var5 + 3 > this.boundingBox.getXSize()) - { - break; - } - - var7 = BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + var5, this.boundingBox.minY + par3Random.nextInt(var6) + 1, this.boundingBox.minZ - 1, 2, var4); - - if (var7 != null) - { - var8 = var7.getBoundingBox(); - this.roomsLinkedToTheRoom.add(new StructureBoundingBox(var8.minX, var8.minY, this.boundingBox.minZ, var8.maxX, var8.maxY, this.boundingBox.minZ + 1)); - } - } - - for (var5 = 0; var5 < this.boundingBox.getXSize(); var5 += 4) - { - var5 += par3Random.nextInt(this.boundingBox.getXSize()); - - if (var5 + 3 > this.boundingBox.getXSize()) - { - break; - } - - var7 = BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + var5, this.boundingBox.minY + par3Random.nextInt(var6) + 1, this.boundingBox.maxZ + 1, 0, var4); - - if (var7 != null) - { - var8 = var7.getBoundingBox(); - this.roomsLinkedToTheRoom.add(new StructureBoundingBox(var8.minX, var8.minY, this.boundingBox.maxZ - 1, var8.maxX, var8.maxY, this.boundingBox.maxZ)); - } - } - - for (var5 = 0; var5 < this.boundingBox.getZSize(); var5 += 4) - { - var5 += par3Random.nextInt(this.boundingBox.getZSize()); - - if (var5 + 3 > this.boundingBox.getZSize()) - { - break; - } - - var7 = BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + par3Random.nextInt(var6) + 1, this.boundingBox.minZ + var5, 1, var4); - - if (var7 != null) - { - var8 = var7.getBoundingBox(); - this.roomsLinkedToTheRoom.add(new StructureBoundingBox(this.boundingBox.minX, var8.minY, var8.minZ, this.boundingBox.minX + 1, var8.maxY, var8.maxZ)); - } - } - - for (var5 = 0; var5 < this.boundingBox.getZSize(); var5 += 4) - { - var5 += par3Random.nextInt(this.boundingBox.getZSize()); - - if (var5 + 3 > this.boundingBox.getZSize()) - { - break; - } - - var7 = BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + par3Random.nextInt(var6) + 1, this.boundingBox.minZ + var5, 3, var4); - - if (var7 != null) - { - var8 = var7.getBoundingBox(); - this.roomsLinkedToTheRoom.add(new StructureBoundingBox(this.boundingBox.maxX - 1, var8.minY, var8.minZ, this.boundingBox.maxX, var8.maxY, var8.maxZ)); - } - } - } - - /** - * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at - * the end, it adds Fences... - */ - public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) - { - if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) - { - return false; - } - else - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX, this.boundingBox.minY, this.boundingBox.maxZ, Block.dirt.blockID, 0, true); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY + 1, this.boundingBox.minZ, this.boundingBox.maxX, Math.min(this.boundingBox.minY + 3, this.boundingBox.maxY), this.boundingBox.maxZ, 0, 0, false); - Iterator var4 = this.roomsLinkedToTheRoom.iterator(); - - while (var4.hasNext()) - { - StructureBoundingBox var5 = (StructureBoundingBox)var4.next(); - this.fillWithBlocks(par1World, par3StructureBoundingBox, var5.minX, var5.maxY - 2, var5.minZ, var5.maxX, var5.maxY, var5.maxZ, 0, 0, false); - } - - this.randomlyRareFillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY + 4, this.boundingBox.minZ, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ, 0, false); - return true; - } - } -} diff --git a/minecraft/net/minecraft/src/ComponentScatteredFeature.java b/minecraft/net/minecraft/src/ComponentScatteredFeature.java deleted file mode 100644 index 1c68327..0000000 --- a/minecraft/net/minecraft/src/ComponentScatteredFeature.java +++ /dev/null @@ -1,72 +0,0 @@ -package net.minecraft.src; - -import java.util.Random; - -public abstract class ComponentScatteredFeature extends StructureComponent -{ - /** The size of the bounding box for this feature in the X axis */ - protected final int scatteredFeatureSizeX; - - /** The size of the bounding box for this feature in the Y axis */ - protected final int scatteredFeatureSizeY; - - /** The size of the bounding box for this feature in the Z axis */ - protected final int scatteredFeatureSizeZ; - protected int field_74936_d = -1; - - protected ComponentScatteredFeature(Random par1Random, int par2, int par3, int par4, int par5, int par6, int par7) - { - super(0); - this.scatteredFeatureSizeX = par5; - this.scatteredFeatureSizeY = par6; - this.scatteredFeatureSizeZ = par7; - this.coordBaseMode = par1Random.nextInt(4); - - switch (this.coordBaseMode) - { - case 0: - case 2: - this.boundingBox = new StructureBoundingBox(par2, par3, par4, par2 + par5 - 1, par3 + par6 - 1, par4 + par7 - 1); - break; - - default: - this.boundingBox = new StructureBoundingBox(par2, par3, par4, par2 + par7 - 1, par3 + par6 - 1, par4 + par5 - 1); - } - } - - protected boolean func_74935_a(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3) - { - if (this.field_74936_d >= 0) - { - return true; - } - else - { - int var4 = 0; - int var5 = 0; - - for (int var6 = this.boundingBox.minZ; var6 <= this.boundingBox.maxZ; ++var6) - { - for (int var7 = this.boundingBox.minX; var7 <= this.boundingBox.maxX; ++var7) - { - if (par2StructureBoundingBox.isVecInside(var7, 64, var6)) - { - var4 += Math.max(par1World.getTopSolidOrLiquidBlock(var7, var6), par1World.provider.getAverageGroundLevel()); - ++var5; - } - } - } - - if (var5 == 0) - { - return false; - } - else - { - this.field_74936_d = var4 / var5; - this.boundingBox.offset(0, this.field_74936_d - this.boundingBox.minY + par3, 0); - return true; - } - } - } -} diff --git a/minecraft/net/minecraft/src/FCEntitySkeleton.java b/minecraft/net/minecraft/src/FCEntitySkeleton.java deleted file mode 100644 index 3992e2f..0000000 --- a/minecraft/net/minecraft/src/FCEntitySkeleton.java +++ /dev/null @@ -1,246 +0,0 @@ -package net.minecraft.src; - -import betterterrain.world.generate.BTAChunkProvider; - -public class FCEntitySkeleton extends EntitySkeleton -{ - private FCEntityAISkeletonArrowAttack m_aiRangedAttack; - private EntityAIAttackOnCollide m_aiMeleeAttack; - private static final float m_fEnchantmentProbability = 0.0125F; - private static final float m_fArmorEnchantmentProbability = 0.05F; - private static final float m_fPickUpLootProability = 0.15F; - - public FCEntitySkeleton(World var1) - { - super(var1); - this.tasks.RemoveAllTasksOfClass(EntityAIWander.class); - this.tasks.addTask(5, new FCEntityAIWanderSimple(this, this.moveSpeed)); - } - - protected void entityInit() - { - super.entityInit(); - this.m_aiRangedAttack = new FCEntityAISkeletonArrowAttack(this, 0.25F, 60, 15.0F); - this.m_aiMeleeAttack = new EntityAIAttackOnCollide(this, EntityPlayer.class, 0.31F, false); - } - - public void PreInitCreature() { - if (this.worldObj.provider.dimensionId == -1) { - /*if (this.worldObj.provider.terrainType.isBTA()) { - if (!(this.worldObj.chunkProvider instanceof ChunkProviderServer)) { - if (((BTAIChunkProvider) this.worldObj.chunkProvider).doesStructureExistAtCoords((int) this.posX, (int) this.posY, (int) this.posZ) && - ((BTAIChunkProvider) this.worldObj.chunkProvider).getPossibleCreaturesStructuresOnly(EnumCreatureType.monster, (int) this.posX, (int) this.posY, (int) this.posZ).contains(this.getClass())) { - this.setSkeletonType(1); - } - } - } - else*/ if (this.getRNG().nextInt(5) > 0) { - this.setSkeletonType(1); - } - } - } - - /** - * Initialize this creature. - */ - public void initCreature() - { - if (this.getSkeletonType() == 1) - { - this.setCurrentItemOrArmor(0, new ItemStack(Item.swordStone)); - } - else - { - this.addRandomArmor(); - this.func_82162_bC(); - } - - this.setCombatTask(); - this.setCanPickUpLoot(this.rand.nextFloat() < 0.15F); - } - - public void SpawnerInitCreature() - { - this.setCombatTask(); - this.setCanPickUpLoot(this.rand.nextFloat() < 0.15F); - } - - /** - * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons - * use this to react to sunlight and start to burn. - */ - public void onLivingUpdate() - { - this.CheckForCatchFireInSun(); - - if (this.worldObj.isRemote && this.getSkeletonType() == 1) - { - this.setSize(0.72F, 2.34F); - } - - this.EntityMobOnLivingUpdate(); - } - - /** - * Returns the item ID for the item the mob drops on death. - */ - protected int getDropItemId() - { - return 0; - } - - /** - * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param - * par2 - Level of Looting used to kill this mob. - */ - protected void dropFewItems(boolean var1, int var2) - { - int var3; - int var4; - - if (this.getSkeletonType() == 0 && this.worldObj.provider.dimensionId != -1 && this.getHeldItem() != null && this.getHeldItem().itemID == Item.bow.itemID) - { - var3 = this.rand.nextInt(3 + var2); - - for (var4 = 0; var4 < var3; ++var4) - { - this.dropItem(FCBetterThanWolves.fcItemRottenArrow.itemID, 1); - } - } - - var3 = this.rand.nextInt(3 + var2); - - for (var4 = 0; var4 < var3; ++var4) - { - this.dropItem(Item.bone.itemID, 1); - } - } - - protected void dropRareDrop(int var1) {} - - /** - * Attack the specified entity using a ranged attack. - */ - public void attackEntityWithRangedAttack(EntityLiving var1, float var2) - { - Object var3 = null; - - if (this.worldObj.provider.dimensionId == -1) - { - var3 = new FCEntityInfiniteArrow(this.worldObj, this, var1, 1.6F, 12.0F); - } - else - { - var3 = new FCEntityRottenArrow(this.worldObj, this, var1, 1.6F, 12.0F); - } - - int var4 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem()); - - if (var4 > 0) - { - ((EntityArrow)var3).setDamage(((EntityArrow)var3).getDamage() + (double)var4 * 0.5D + 0.5D); - } - - int var5 = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem()); - - if (var5 > 0) - { - ((EntityArrow)var3).setKnockbackStrength(var5); - } - - int var6 = EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()); - - if (var6 > 0 || this.getSkeletonType() == 1 || this.isBurning() && this.rand.nextFloat() < 0.3F) - { - ((EntityArrow)var3).setFire(100); - } - - this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld((Entity)var3); - } - - /** - * sets this entity's combat AI. - */ - public void setCombatTask() - { - this.tasks.removeTask(this.m_aiMeleeAttack); - this.tasks.removeTask(this.m_aiRangedAttack); - ItemStack var1 = this.getHeldItem(); - - if (var1 != null && var1.itemID == Item.bow.itemID) - { - this.tasks.addTask(4, this.m_aiRangedAttack); - } - else - { - this.tasks.addTask(4, this.m_aiMeleeAttack); - } - } - - /** - * Checks to make sure the light is not too bright where the mob is spawning - */ - protected boolean isValidLightLevel() - { - return this.worldObj.provider.dimensionId == -1 ? true : super.isValidLightLevel(); - } - - public void CheckForScrollDrop() - { - if (this.getSkeletonType() == 0 && this.rand.nextInt(1000) == 0) - { - ItemStack var1 = null; - - if (this.worldObj.provider.dimensionId == -1) - { - var1 = new ItemStack(FCBetterThanWolves.fcItemArcaneScroll, 1, Enchantment.infinity.effectId); - } - else - { - var1 = new ItemStack(FCBetterThanWolves.fcItemArcaneScroll, 1, Enchantment.projectileProtection.effectId); - } - - this.entityDropItem(var1, 0.0F); - } - } - - protected void dropHead() - { - if (this.getSkeletonType() == 1) - { - this.entityDropItem(new ItemStack(Item.skull.itemID, 1, 1), 0.0F); - } - else - { - this.entityDropItem(new ItemStack(Item.skull.itemID, 1, 0), 0.0F); - } - } - - protected void func_82162_bC() - { - if (this.getHeldItem() != null && this.rand.nextFloat() < 0.0125F) - { - EnchantmentHelper.addRandomEnchantment(this.rand, this.getHeldItem(), 7 * this.rand.nextInt(6)); - this.equipmentDropChances[0] = 0.99F; - } - - for (int var1 = 0; var1 < 4; ++var1) - { - ItemStack var2 = this.getCurrentArmor(var1); - - if (var2 != null && this.rand.nextFloat() < 0.05F) - { - EnchantmentHelper.addRandomEnchantment(this.rand, var2, 7 * this.rand.nextInt(6)); - } - } - } - - /** - * Called when the entity is attacked. - */ - public boolean attackEntityFrom(DamageSource var1, int var2) - { - return var1 != DamageSource.cactus ? super.attackEntityFrom(var1, var2) : false; - } -} diff --git a/minecraft/net/minecraft/src/GenLayer.java b/minecraft/net/minecraft/src/GenLayer.java deleted file mode 100644 index 5178f78..0000000 --- a/minecraft/net/minecraft/src/GenLayer.java +++ /dev/null @@ -1,160 +0,0 @@ -package net.minecraft.src; - -public abstract class GenLayer -{ - /** seed from World#getWorldSeed that is used in the LCG prng */ - private long worldGenSeed; - - /** parent GenLayer that was provided via the constructor */ - protected GenLayer parent; - - /** - * final part of the LCG prng that uses the chunk X, Z coords along with the other two seeds to generate - * pseudorandom numbers - */ - private long chunkSeed; - - /** base seed to the LCG prng provided via the constructor */ - private long baseSeed; - - /** - * the first array item is a linked list of the bioms, the second is the zoom function, the third is the same as the - * first. - */ - public static GenLayer[] initializeAllBiomeGenerators(long par0, WorldType par2WorldType) - { - GenLayerIsland var3 = new GenLayerIsland(1L); - GenLayerFuzzyZoom var9 = new GenLayerFuzzyZoom(2000L, var3); - GenLayerAddIsland var10 = new GenLayerAddIsland(1L, var9); - GenLayerZoom var11 = new GenLayerZoom(2001L, var10); - var10 = new GenLayerAddIsland(2L, var11); - GenLayerAddSnow var12 = new GenLayerAddSnow(2L, var10); - var11 = new GenLayerZoom(2002L, var12); - var10 = new GenLayerAddIsland(3L, var11); - var11 = new GenLayerZoom(2003L, var10); - var10 = new GenLayerAddIsland(4L, var11); - GenLayerAddMushroomIsland var15 = new GenLayerAddMushroomIsland(5L, var10); - byte var4 = 4; - - if (par2WorldType == WorldType.LARGE_BIOMES) - { - var4 = 6; - } - - GenLayer var5 = GenLayerZoom.magnify(1000L, var15, 0); - GenLayerRiverInit var13 = new GenLayerRiverInit(100L, var5); - var5 = GenLayerZoom.magnify(1000L, var13, var4 + 2); - GenLayerRiver var14 = new GenLayerRiver(1L, var5); - GenLayerSmooth var16 = new GenLayerSmooth(1000L, var14); - GenLayer var6 = GenLayerZoom.magnify(1000L, var15, 0); - GenLayerBiome var17 = new GenLayerBiome(200L, var6, par2WorldType); - var6 = GenLayerZoom.magnify(1000L, var17, 2); - Object var18 = new GenLayerHills(1000L, var6); - - for (int var7 = 0; var7 < var4; ++var7) - { - var18 = new GenLayerZoom((long)(1000 + var7), (GenLayer)var18); - - if (var7 == 0) - { - var18 = new GenLayerAddIsland(3L, (GenLayer)var18); - } - - if (var7 == 1) - { - var18 = new GenLayerShore(1000L, (GenLayer)var18); - } - - if (var7 == 1) - { - var18 = new GenLayerSwampRivers(1000L, (GenLayer)var18); - } - } - - GenLayerSmooth var19 = new GenLayerSmooth(1000L, (GenLayer)var18); - GenLayerRiverMix var20 = new GenLayerRiverMix(100L, var19, var16); - GenLayerVoronoiZoom var8 = new GenLayerVoronoiZoom(10L, var20); - var20.initWorldGenSeed(par0); - var8.initWorldGenSeed(par0); - return new GenLayer[] {var20, var8, var20}; - } - - public GenLayer(long par1) - { - this.baseSeed = par1; - this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L; - this.baseSeed += par1; - this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L; - this.baseSeed += par1; - this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L; - this.baseSeed += par1; - } - - /** - * Initialize layer's local worldGenSeed based on its own baseSeed and the world's global seed (passed in as an - * argument). - */ - public void initWorldGenSeed(long par1) - { - this.worldGenSeed = par1; - - if (this.parent != null) - { - this.parent.initWorldGenSeed(par1); - } - - this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L; - this.worldGenSeed += this.baseSeed; - this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L; - this.worldGenSeed += this.baseSeed; - this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L; - this.worldGenSeed += this.baseSeed; - } - - /** - * Initialize layer's current chunkSeed based on the local worldGenSeed and the (x,z) chunk coordinates. - */ - public void initChunkSeed(long par1, long par3) - { - this.chunkSeed = this.worldGenSeed; - this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; - this.chunkSeed += par1; - this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; - this.chunkSeed += par3; - this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; - this.chunkSeed += par1; - this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; - this.chunkSeed += par3; - } - - /** - * returns a LCG pseudo random number from [0, x). Args: int x - */ - protected int nextInt(int par1) - { - int var2 = (int)((this.chunkSeed >> 24) % (long)par1); - - if (var2 < 0) - { - var2 += par1; - } - - this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; - this.chunkSeed += this.worldGenSeed; - return var2; - } - - /** - * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall - * amounts, or biomeList[] indices based on the particular GenLayer subclass. - */ - public abstract int[] getInts(int var1, int var2, int var3, int var4); - - public long getWorldGenSeed() { - return worldGenSeed; - } - - public long getChunkSeed() { - return chunkSeed; - } -} diff --git a/minecraft/net/minecraft/src/GuiCreateWorld.java b/minecraft/net/minecraft/src/GuiCreateWorld.java deleted file mode 100644 index d4a80ff..0000000 --- a/minecraft/net/minecraft/src/GuiCreateWorld.java +++ /dev/null @@ -1,561 +0,0 @@ -package net.minecraft.src; - -import java.util.Random; -import org.lwjgl.input.Keyboard; - -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.gui.GeneratorOptionsGui; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.surface.SurfaceBuilder; - -public class GuiCreateWorld extends GuiScreen -{ - private GuiScreen parentGuiScreen; - private GuiTextField textboxWorldName; - private GuiTextField textboxSeed; - private String folderName; - - /** hardcore', 'creative' or 'survival */ - private String gameMode = "survival"; - private boolean generateStructures = true; - private boolean commandsAllowed = false; - - /** True iif player has clicked buttonAllowCommands at least once */ - private boolean commandsToggled = false; - - /** toggles when GUIButton 7 is pressed */ - private boolean bonusItems = false; - - /** True if and only if gameMode.equals("hardcore") */ - private boolean isHardcore = false; - private boolean createClicked; - - /** - * True if the extra options (Seed box, structure toggle button, world type button, etc.) are being shown - */ - private boolean moreOptions; - - /** The GUIButton that you click to change game modes. */ - private GuiButton buttonGameMode; - - /** - * The GUIButton that you click to get to options like the seed when creating a world. - */ - private GuiButton moreWorldOptions; - - /** The GuiButton in the 'More World Options' screen. Toggles ON/OFF */ - private GuiButton buttonGenerateStructures; - private GuiButton buttonBonusItems; - - /** The GuiButton in the more world options screen. */ - private GuiButton buttonWorldType; - private GuiButton buttonAllowCommands; - - /** GuiButton in the more world options screen. */ - private GuiButton buttonCustomize; - - private GuiButton buttonIsDeco; - private boolean isDeco; - - private GuiButton buttonCustomizeBTA; - - /** The first line of text describing the currently selected game mode. */ - private String gameModeDescriptionLine1; - - /** The second line of text describing the currently selected game mode. */ - private String gameModeDescriptionLine2; - - /** The current textboxSeed text */ - private String seed; - - /** E.g. New World, Neue Welt, Nieuwe wereld, Neuvo Mundo */ - private String localizedNewWorldText; - private int worldTypeId = 4; - - /** Generator options to use when creating the world. */ - public String generatorOptionsToUse = ""; - - /** - * If the world name is one of these, it'll be surrounded with underscores. - */ - private static final String[] ILLEGAL_WORLD_NAMES = new String[] {"CON", "COM", "PRN", "AUX", "CLOCK$", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}; - - public GuiCreateWorld(GuiScreen par1GuiScreen) - { - this.parentGuiScreen = par1GuiScreen; - this.seed = ""; - this.localizedNewWorldText = StatCollector.translateToLocal("selectWorld.newWorld"); - } - - /** - * Called from the main game loop to update the screen. - */ - public void updateScreen() - { - this.textboxWorldName.updateCursorCounter(); - this.textboxSeed.updateCursorCounter(); - } - - /** - * Adds the buttons (and other controls) to the screen in question. - */ - public void initGui() - { - StringTranslate var1 = StringTranslate.getInstance(); - Keyboard.enableRepeatEvents(true); - this.buttonList.clear(); - this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, var1.translateKey("selectWorld.create"))); - this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, var1.translateKey("gui.cancel"))); - this.buttonList.add(this.buttonGameMode = new GuiButton(2, this.width / 2 - 75, 115, 150, 20, var1.translateKey("selectWorld.gameMode"))); - this.buttonList.add(this.moreWorldOptions = new GuiButton(3, this.width / 2 - 75, 187, 150, 20, var1.translateKey("selectWorld.moreWorldOptions"))); - this.buttonList.add(this.buttonGenerateStructures = new GuiButton(4, this.width / 2 - 155, 100, 150, 20, var1.translateKey("selectWorld.mapFeatures"))); - this.buttonGenerateStructures.drawButton = false; - this.buttonList.add(this.buttonBonusItems = new GuiButton(7, this.width / 2 + 5, 151, 150, 20, var1.translateKey("selectWorld.bonusItems"))); - this.buttonBonusItems.drawButton = false; - this.buttonList.add(this.buttonWorldType = new GuiButton(5, this.width / 2 + 5, 100, 150, 20, var1.translateKey("selectWorld.mapType"))); - this.buttonWorldType.drawButton = false; - this.buttonList.add(this.buttonAllowCommands = new GuiButton(6, this.width / 2 - 155, 151, 150, 20, var1.translateKey("selectWorld.allowCommands"))); - this.buttonAllowCommands.drawButton = false; - this.buttonList.add(this.buttonCustomize = new GuiButton(8, this.width / 2 + 5, 120, 150, 20, var1.translateKey("selectWorld.customizeType"))); - this.buttonCustomize.drawButton = false; - this.buttonList.add(this.buttonCustomizeBTA = new GuiButton(10, this.width / 2 + 5, 120, 150, 20, var1.translateKey("selectWorld.customizeType"))); - this.buttonCustomizeBTA.drawButton = false; - - this.isDeco = DecoIntegration.isDecoInstalled(); - - this.textboxWorldName = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20); - this.textboxWorldName.setFocused(true); - this.textboxWorldName.setText(this.localizedNewWorldText); - this.textboxSeed = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20); - this.textboxSeed.setText(this.seed); - this.func_82288_a(this.moreOptions); - this.makeUseableName(); - this.updateButtonText(); - } - - /** - * Makes a the name for a world save folder based on your world name, replacing specific characters for _s and - * appending -s to the end until a free name is available. - */ - private void makeUseableName() - { - this.folderName = this.textboxWorldName.getText().trim(); - char[] var1 = ChatAllowedCharacters.allowedCharactersArray; - int var2 = var1.length; - - for (int var3 = 0; var3 < var2; ++var3) - { - char var4 = var1[var3]; - this.folderName = this.folderName.replace(var4, '_'); - } - - if (MathHelper.stringNullOrLengthZero(this.folderName)) - { - this.folderName = "World"; - } - - this.folderName = func_73913_a(this.mc.getSaveLoader(), this.folderName); - } - - private void updateButtonText() - { - StringTranslate var1 = StringTranslate.getInstance(); - this.buttonGameMode.displayString = var1.translateKey("selectWorld.gameMode") + " " + var1.translateKey("selectWorld.gameMode." + this.gameMode); - this.gameModeDescriptionLine1 = var1.translateKey("selectWorld.gameMode." + this.gameMode + ".line1"); - this.gameModeDescriptionLine2 = var1.translateKey("selectWorld.gameMode." + this.gameMode + ".line2"); - this.buttonGenerateStructures.displayString = var1.translateKey("selectWorld.mapFeatures") + " "; - - if (this.generateStructures) - { - this.buttonGenerateStructures.displayString = this.buttonGenerateStructures.displayString + var1.translateKey("options.on"); - } - else - { - this.buttonGenerateStructures.displayString = this.buttonGenerateStructures.displayString + var1.translateKey("options.off"); - } - - this.buttonBonusItems.displayString = var1.translateKey("selectWorld.bonusItems") + " "; - - if (this.bonusItems && !this.isHardcore) - { - this.buttonBonusItems.displayString = this.buttonBonusItems.displayString + var1.translateKey("options.on"); - } - else - { - this.buttonBonusItems.displayString = this.buttonBonusItems.displayString + var1.translateKey("options.off"); - } - - this.buttonWorldType.displayString = var1.translateKey("selectWorld.mapType") + " " + var1.translateKey(WorldType.worldTypes[this.worldTypeId].getTranslateName()); - this.buttonAllowCommands.displayString = var1.translateKey("selectWorld.allowCommands") + " "; - - if (this.commandsAllowed && !this.isHardcore) - { - this.buttonAllowCommands.displayString = this.buttonAllowCommands.displayString + var1.translateKey("options.on"); - } - else - { - this.buttonAllowCommands.displayString = this.buttonAllowCommands.displayString + var1.translateKey("options.off"); - } - } - - public static String func_73913_a(ISaveFormat par0ISaveFormat, String par1Str) - { - par1Str = par1Str.replaceAll("[\\./\"]", "_"); - String[] var2 = ILLEGAL_WORLD_NAMES; - int var3 = var2.length; - - for (int var4 = 0; var4 < var3; ++var4) - { - String var5 = var2[var4]; - - if (par1Str.equalsIgnoreCase(var5)) - { - par1Str = "_" + par1Str + "_"; - } - } - - while (par0ISaveFormat.getWorldInfo(par1Str) != null) - { - par1Str = par1Str + "-"; - } - - return par1Str; - } - - /** - * Called when the screen is unloaded. Used to disable keyboard repeat events - */ - public void onGuiClosed() - { - Keyboard.enableRepeatEvents(false); - } - - /** - * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). - */ - protected void actionPerformed(GuiButton par1GuiButton) - { - if (par1GuiButton.enabled) - { - if (par1GuiButton.id == 1) - { - this.mc.displayGuiScreen(this.parentGuiScreen); - } - else if (par1GuiButton.id == 0) - { - this.mc.displayGuiScreen((GuiScreen)null); - - if (this.createClicked) - { - return; - } - - this.createClicked = true; - long var2 = (new Random()).nextLong(); - String var4 = this.textboxSeed.getText(); - - if (!MathHelper.stringNullOrLengthZero(var4)) - { - try - { - long var5 = Long.parseLong(var4); - - if (var5 != 0L) - { - var2 = var5; - } - } - catch (NumberFormatException var7) - { - var2 = (long)var4.hashCode(); - } - } - - EnumGameType var8 = EnumGameType.getByName(this.gameMode); - - WorldType type = WorldType.worldTypes[this.worldTypeId]; - - if (isDeco && type.hasDeco()) { - type = WorldType.worldTypes[this.worldTypeId + 1]; - } - - WorldSettings var6 = new WorldSettings(var2, var8, this.generateStructures, this.isHardcore, type); - - if (WorldType.worldTypes[this.worldTypeId].isBTA() && this.generatorOptionsToUse.equals("")) { - this.generatorOptionsToUse = WorldConfigurationInfo.createDefaultConfiguration(isDeco).toString(); - - System.out.println(this.generatorOptionsToUse); - - SurfaceBuilder.defaultBuilder.hasBeenInit = false; - SurfaceBuilder.legacyBuilder.hasBeenInit = false; - - for (BiomeGenBase b : WorldConfigurationInfo.createInfoFromString(this.generatorOptionsToUse).getBiomesForGeneration()) { - if (b instanceof BTABiome) { - SurfaceBuilder builder = ((BTABiome) b).getSurfaceBuilder(); - - if (builder != null) { - builder.hasBeenInit = false; - } - } - } - } - var6.func_82750_a(this.generatorOptionsToUse); - - if (this.bonusItems && !this.isHardcore) - { - var6.enableBonusChest(); - } - - if (this.commandsAllowed && !this.isHardcore) - { - var6.enableCommands(); - } - - this.mc.launchIntegratedServer(this.folderName, this.textboxWorldName.getText().trim(), var6); - } - else if (par1GuiButton.id == 3) - { - this.func_82287_i(); - } - else if (par1GuiButton.id == 2) - { - if (this.gameMode.equals("survival")) - { - if (!this.commandsToggled) - { - this.commandsAllowed = false; - } - - this.isHardcore = false; - this.gameMode = "hardcore"; - this.isHardcore = true; - this.buttonAllowCommands.enabled = false; - this.buttonBonusItems.enabled = false; - this.updateButtonText(); - } - else if (this.gameMode.equals("hardcore")) - { - if (!this.commandsToggled) - { - this.commandsAllowed = true; - } - - this.isHardcore = false; - this.gameMode = "creative"; - this.updateButtonText(); - this.isHardcore = false; - this.buttonAllowCommands.enabled = true; - this.buttonBonusItems.enabled = true; - } - else - { - if (!this.commandsToggled) - { - this.commandsAllowed = false; - } - - this.gameMode = "survival"; - this.updateButtonText(); - this.buttonAllowCommands.enabled = true; - this.buttonBonusItems.enabled = true; - this.isHardcore = false; - } - - this.updateButtonText(); - } - else if (par1GuiButton.id == 4) - { - this.generateStructures = !this.generateStructures; - this.updateButtonText(); - } - else if (par1GuiButton.id == 7) - { - this.bonusItems = !this.bonusItems; - this.updateButtonText(); - } - else if (par1GuiButton.id == 5) - { - ++this.worldTypeId; - - if (this.worldTypeId >= WorldType.worldTypes.length) - { - this.worldTypeId = 0; - } - - while (WorldType.worldTypes[this.worldTypeId] == null || !WorldType.worldTypes[this.worldTypeId].getCanBeCreated()) - { - ++this.worldTypeId; - - if (this.worldTypeId >= WorldType.worldTypes.length) - { - this.worldTypeId = 0; - } - } - - this.generatorOptionsToUse = ""; - this.updateButtonText(); - this.func_82288_a(this.moreOptions); - } - else if (par1GuiButton.id == 6) - { - this.commandsToggled = true; - this.commandsAllowed = !this.commandsAllowed; - this.updateButtonText(); - } - else if (par1GuiButton.id == 8) - { - this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.generatorOptionsToUse)); - } - else if (par1GuiButton.id == 9) { - isDeco = !isDeco; - this.updateButtonText(); - } - else if (par1GuiButton.id == 10) { - this.mc.displayGuiScreen(new GeneratorOptionsGui(this, this.generatorOptionsToUse)); - } - } - } - - private void func_82287_i() - { - this.func_82288_a(!this.moreOptions); - } - - private void func_82288_a(boolean par1) - { - this.moreOptions = par1; - this.buttonGameMode.drawButton = !this.moreOptions; - this.buttonGenerateStructures.drawButton = this.moreOptions; - this.buttonBonusItems.drawButton = this.moreOptions; - this.buttonBonusItems.enabled = this.moreOptions; - this.buttonWorldType.drawButton = this.moreOptions; - this.buttonAllowCommands.drawButton = this.moreOptions; - this.buttonCustomize.drawButton = this.moreOptions && WorldType.worldTypes[this.worldTypeId] == WorldType.FLAT; - this.buttonCustomizeBTA.drawButton = this.moreOptions && (WorldType.worldTypes[this.worldTypeId].isBTA()); - StringTranslate var2; - - if (this.moreOptions) - { - var2 = StringTranslate.getInstance(); - this.moreWorldOptions.displayString = var2.translateKey("gui.done"); - //this.moreWorldOptions.xPosition = this.width / 2 - 155; - } - else - { - var2 = StringTranslate.getInstance(); - this.moreWorldOptions.displayString = var2.translateKey("selectWorld.moreWorldOptions"); - //this.moreWorldOptions.xPosition = this.width / 2 - 75; - } - } - - /** - * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). - */ - protected void keyTyped(char par1, int par2) - { - if (this.textboxWorldName.isFocused() && !this.moreOptions) - { - this.textboxWorldName.textboxKeyTyped(par1, par2); - this.localizedNewWorldText = this.textboxWorldName.getText(); - } - else if (this.textboxSeed.isFocused() && this.moreOptions) - { - this.textboxSeed.textboxKeyTyped(par1, par2); - this.seed = this.textboxSeed.getText(); - } - - if (par1 == 13) - { - this.actionPerformed((GuiButton)this.buttonList.get(0)); - } - - ((GuiButton)this.buttonList.get(0)).enabled = this.textboxWorldName.getText().length() > 0; - this.makeUseableName(); - } - - /** - * Called when the mouse is clicked. - */ - protected void mouseClicked(int par1, int par2, int par3) - { - super.mouseClicked(par1, par2, par3); - - if (this.moreOptions) - { - this.textboxSeed.mouseClicked(par1, par2, par3); - } - else - { - this.textboxWorldName.mouseClicked(par1, par2, par3); - } - } - - /** - * Draws the screen and all the components in it. - */ - public void drawScreen(int par1, int par2, float par3) - { - StringTranslate var4 = StringTranslate.getInstance(); - this.drawDefaultBackground(); - this.drawCenteredString(this.fontRenderer, var4.translateKey("selectWorld.create"), this.width / 2, 20, 16777215); - - if (this.moreOptions) - { - this.drawString(this.fontRenderer, var4.translateKey("selectWorld.enterSeed"), this.width / 2 - 100, 47, 10526880); - this.drawString(this.fontRenderer, var4.translateKey("selectWorld.seedInfo"), this.width / 2 - 100, 85, 10526880); - this.drawString(this.fontRenderer, var4.translateKey("selectWorld.mapFeatures.info"), this.width / 2 - 150, 122, 10526880); - this.drawString(this.fontRenderer, var4.translateKey("selectWorld.allowCommands.info"), this.width / 2 - 150, 172, 10526880); - this.textboxSeed.drawTextBox(); - } - else - { - this.drawString(this.fontRenderer, var4.translateKey("selectWorld.enterName"), this.width / 2 - 100, 47, 10526880); - this.drawString(this.fontRenderer, var4.translateKey("selectWorld.resultFolder") + " " + this.folderName, this.width / 2 - 100, 85, 10526880); - this.textboxWorldName.drawTextBox(); - this.drawString(this.fontRenderer, this.gameModeDescriptionLine1, this.width / 2 - 100, 137, 10526880); - this.drawString(this.fontRenderer, this.gameModeDescriptionLine2, this.width / 2 - 100, 149, 10526880); - } - - super.drawScreen(par1, par2, par3); - } - - public void func_82286_a(WorldInfo par1WorldInfo) - { - this.localizedNewWorldText = StatCollector.translateToLocalFormatted("selectWorld.newWorld.copyOf", new Object[] {par1WorldInfo.getWorldName()}); - this.seed = par1WorldInfo.getSeed() + ""; - this.worldTypeId = par1WorldInfo.getTerrainType().getWorldTypeID(); - this.generatorOptionsToUse = par1WorldInfo.getGeneratorOptions(); - this.generateStructures = par1WorldInfo.isMapFeaturesEnabled(); - this.commandsAllowed = par1WorldInfo.areCommandsAllowed(); - - if (par1WorldInfo.isHardcoreModeEnabled()) - { - this.gameMode = "hardcore"; - } - else if (par1WorldInfo.getGameType().isSurvivalOrAdventure()) - { - this.gameMode = "survival"; - } - else if (par1WorldInfo.getGameType().isCreative()) - { - this.gameMode = "creative"; - } - - WorldType currentType = WorldType.worldTypes[this.worldTypeId]; - this.isDeco = currentType.isDeco(); - this.worldTypeId = currentType.getParent().getWorldTypeID(); - } - - public boolean isDeco() { - return isDeco; - } - - public void setDeco(boolean isDeco) { - this.isDeco = isDeco; - } - - public int getWorldTypeId() { - return worldTypeId; - } -} diff --git a/minecraft/net/minecraft/src/GuiScreen.java b/minecraft/net/minecraft/src/GuiScreen.java deleted file mode 100644 index 6c4aff3..0000000 --- a/minecraft/net/minecraft/src/GuiScreen.java +++ /dev/null @@ -1,312 +0,0 @@ -package net.minecraft.src; - -import java.awt.Toolkit; -import java.awt.datatransfer.ClipboardOwner; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.StringSelection; -import java.awt.datatransfer.Transferable; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.Minecraft; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - -public class GuiScreen extends Gui -{ - public static final boolean isMacOs = Minecraft.getOs() == EnumOS.MACOS; - - /** Reference to the Minecraft object. */ - public Minecraft mc; - - /** The width of the screen object. */ - public int width; - - /** The height of the screen object. */ - public int height; - - /** A list of all the buttons in this container. */ - public List buttonList = new ArrayList(); - public boolean allowUserInput = false; - - /** The FontRenderer used by GuiScreen */ - public FontRenderer fontRenderer; - public GuiParticle guiParticles; - - /** The button that was just pressed. */ - private GuiButton selectedButton = null; - private int eventButton = 0; - private long field_85043_c = 0L; - private int field_92018_d = 0; - - /** - * Draws the screen and all the components in it. - */ - public void drawScreen(int par1, int par2, float par3) - { - for (int var4 = 0; var4 < this.buttonList.size(); ++var4) - { - GuiButton var5 = (GuiButton)this.buttonList.get(var4); - var5.drawButton(this.mc, par1, par2); - } - } - - /** - * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). - */ - protected void keyTyped(char par1, int par2) - { - if (par2 == 1) - { - this.mc.displayGuiScreen((GuiScreen)null); - this.mc.setIngameFocus(); - } - } - - /** - * Returns a string stored in the system clipboard. - */ - public static String getClipboardString() - { - try - { - Transferable var0 = Toolkit.getDefaultToolkit().getSystemClipboard().getContents((Object)null); - - if (var0 != null && var0.isDataFlavorSupported(DataFlavor.stringFlavor)) - { - return (String)var0.getTransferData(DataFlavor.stringFlavor); - } - } - catch (Exception var1) - { - ; - } - - return ""; - } - - /** - * store a string in the system clipboard - */ - public static void setClipboardString(String par0Str) - { - try - { - StringSelection var1 = new StringSelection(par0Str); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(var1, (ClipboardOwner)null); - } - catch (Exception var2) - { - ; - } - } - - /** - * Called when the mouse is clicked. - */ - protected void mouseClicked(int par1, int par2, int par3) - { - if (par3 == 0) - { - for (int var4 = 0; var4 < this.buttonList.size(); ++var4) - { - GuiButton var5 = (GuiButton)this.buttonList.get(var4); - - if (var5.mousePressed(this.mc, par1, par2)) - { - this.selectedButton = var5; - this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); - this.actionPerformed(var5); - } - } - } - } - - /** - * Called when the mouse is moved or a mouse button is released. Signature: (mouseX, mouseY, which) which==-1 is - * mouseMove, which==0 or which==1 is mouseUp - */ - protected void mouseMovedOrUp(int par1, int par2, int par3) - { - if (this.selectedButton != null && par3 == 0) - { - this.selectedButton.mouseReleased(par1, par2); - this.selectedButton = null; - } - } - - protected void func_85041_a(int par1, int par2, int par3, long par4) {} - - /** - * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). - */ - protected void actionPerformed(GuiButton par1GuiButton) {} - - /** - * Causes the screen to lay out its subcomponents again. This is the equivalent of the Java call - * Container.validate() - */ - public void setWorldAndResolution(Minecraft par1Minecraft, int par2, int par3) - { - this.guiParticles = new GuiParticle(par1Minecraft); - this.mc = par1Minecraft; - this.fontRenderer = par1Minecraft.fontRenderer; - this.width = par2; - this.height = par3; - this.buttonList.clear(); - this.initGui(); - } - - /** - * Adds the buttons (and other controls) to the screen in question. - */ - public void initGui() {} - - /** - * Delegates mouse and keyboard input. - */ - public void handleInput() - { - while (Mouse.next()) - { - this.handleMouseInput(); - } - - while (Keyboard.next()) - { - this.handleKeyboardInput(); - } - } - - /** - * Handles mouse input. - */ - public void handleMouseInput() - { - int var1 = Mouse.getEventX() * this.width / this.mc.displayWidth; - int var2 = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; - - if (Mouse.getEventButtonState()) - { - if (this.mc.gameSettings.touchscreen && this.field_92018_d++ > 0) - { - return; - } - - this.eventButton = Mouse.getEventButton(); - this.field_85043_c = Minecraft.getSystemTime(); - this.mouseClicked(var1, var2, this.eventButton); - } - else if (Mouse.getEventButton() != -1) - { - if (this.mc.gameSettings.touchscreen && --this.field_92018_d > 0) - { - return; - } - - this.eventButton = -1; - this.mouseMovedOrUp(var1, var2, Mouse.getEventButton()); - } - else if (this.eventButton != -1 && this.field_85043_c > 0L) - { - long var3 = Minecraft.getSystemTime() - this.field_85043_c; - this.func_85041_a(var1, var2, this.eventButton, var3); - } - } - - /** - * Handles keyboard input. - */ - public void handleKeyboardInput() - { - if (Keyboard.getEventKeyState()) - { - int var1 = Keyboard.getEventKey(); - char var2 = Keyboard.getEventCharacter(); - - if (var1 == 87) - { - this.mc.toggleFullscreen(); - return; - } - - if (isMacOs && var1 == 28 && var2 == 0) - { - var1 = 29; - } - - this.keyTyped(var2, var1); - } - } - - /** - * Called from the main game loop to update the screen. - */ - public void updateScreen() {} - - /** - * Called when the screen is unloaded. Used to disable keyboard repeat events - */ - public void onGuiClosed() {} - - /** - * Draws either a gradient over the background screen (when it exists) or a flat gradient over background.png - */ - public void drawDefaultBackground() - { - this.drawWorldBackground(0); - } - - public void drawWorldBackground(int par1) - { - if (this.mc.theWorld != null) - { - this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680); - } - else - { - this.drawBackground(par1); - } - } - - /** - * Draws the background (i is always 0 as of 1.2.2) - */ - public void drawBackground(int par1) - { - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_FOG); - Tessellator var2 = Tessellator.instance; - this.mc.renderEngine.bindTexture("/gui/background.png"); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - float var3 = 32.0F; - var2.startDrawingQuads(); - var2.setColorOpaque_I(4210752); - var2.addVertexWithUV(0.0D, (double)this.height, 0.0D, 0.0D, (double)((float)this.height / var3 + (float)par1)); - var2.addVertexWithUV((double)this.width, (double)this.height, 0.0D, (double)((float)this.width / var3), (double)((float)this.height / var3 + (float)par1)); - var2.addVertexWithUV((double)this.width, 0.0D, 0.0D, (double)((float)this.width / var3), (double)par1); - var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, (double)par1); - var2.draw(); - } - - /** - * Returns true if this GUI should pause the game when it is displayed in single-player - */ - public boolean doesGuiPauseGame() - { - return true; - } - - public void confirmClicked(boolean par1, int par2) {} - - public static boolean isCtrlKeyDown() - { - boolean var0 = Keyboard.isKeyDown(28) && Keyboard.getEventCharacter() == 0; - return Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157) || isMacOs && (var0 || Keyboard.isKeyDown(219) || Keyboard.isKeyDown(220)); - } - - public static boolean isShiftKeyDown() - { - return Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54); - } -} diff --git a/minecraft/net/minecraft/src/MapGenVillage.java b/minecraft/net/minecraft/src/MapGenVillage.java deleted file mode 100644 index 0b23f58..0000000 --- a/minecraft/net/minecraft/src/MapGenVillage.java +++ /dev/null @@ -1,88 +0,0 @@ -package net.minecraft.src; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Map.Entry; - -public class MapGenVillage extends MapGenStructure -{ - /** A list of all the biomes villages can spawn in. */ - public static final ArrayList villageSpawnBiomes = new ArrayList(Arrays.asList(new BiomeGenBase[] {BiomeGenBase.plains, BiomeGenBase.desert})); - - /** World terrain type, 0 for normal, 1 for flat map */ - private int terrainType; - private int field_82665_g; - private int field_82666_h; - - public MapGenVillage() - { - this.terrainType = 0; - this.field_82665_g = 32; - this.field_82666_h = 8; - } - - public MapGenVillage(Map par1Map) - { - this(); - Iterator var2 = par1Map.entrySet().iterator(); - - while (var2.hasNext()) - { - Entry var3 = (Entry)var2.next(); - - if (((String)var3.getKey()).equals("size")) - { - this.terrainType = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.terrainType, 0); - } - else if (((String)var3.getKey()).equals("distance")) - { - this.field_82665_g = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.field_82665_g, this.field_82666_h + 1); - } - } - } - - protected boolean canSpawnStructureAtCoords(int par1, int par2) - { - int var3 = par1; - int var4 = par2; - - if (par1 < 0) - { - par1 -= this.field_82665_g - 1; - } - - if (par2 < 0) - { - par2 -= this.field_82665_g - 1; - } - - int var5 = par1 / this.field_82665_g; - int var6 = par2 / this.field_82665_g; - Random var7 = this.worldObj.setRandomSeed(var5, var6, 10387312); - var5 *= this.field_82665_g; - var6 *= this.field_82665_g; - var5 += var7.nextInt(this.field_82665_g - this.field_82666_h); - var6 += var7.nextInt(this.field_82665_g - this.field_82666_h); - - if (var3 == var5 && var4 == var6) - { - boolean var8 = this.worldObj.getWorldChunkManager().areBiomesViable(var3 * 16 + 8, var4 * 16 + 8, 0, villageSpawnBiomes); - - if (var8) - { - return true; - } - } - - return false; - } - - protected StructureStart getStructureStart(int par1, int par2) - { - return new StructureVillageStart(this.worldObj, this.rand, par1, par2, this.terrainType); - } -} diff --git a/minecraft/net/minecraft/src/Material.java b/minecraft/net/minecraft/src/Material.java deleted file mode 100644 index 6b35b03..0000000 --- a/minecraft/net/minecraft/src/Material.java +++ /dev/null @@ -1,296 +0,0 @@ -package net.minecraft.src; - -public class Material -{ - public static final Material air = new MaterialTransparent(MapColor.airColor); - - /** The material used by BlockGrass. */ - public static final Material grass = (new Material(MapColor.grassColor)).setRequiresTool(); - public static final Material ground = (new Material(MapColor.dirtColor)).setRequiresTool(); - public static final Material wood = (new Material(MapColor.woodColor)).setBurning().SetMobsCantSpawnOn().SetAxesEfficientOn().setDoesNotBreakSaw(); - public static final Material rock = (new Material(MapColor.stoneColor)).setRequiresTool(); - public static final Material iron = (new Material(MapColor.ironColor)).setRequiresTool(); - public static final Material anvil = (new Material(MapColor.ironColor)).setRequiresTool().setImmovableMobility(); - public static final Material water = (new MaterialLiquid(MapColor.waterColor)).setNoPushMobility(); - public static final Material lava = (new MaterialLiquid(MapColor.tntColor)).setNoPushMobility(); - public static final Material leaves = (new Material(MapColor.foliageColor)).setBurning().setTranslucent().setNoPushMobility().SetAxesEfficientOn().SetAxesTreatAsVegetation().setDoesNotBreakSaw(); - public static final Material plants = (new MaterialLogic(MapColor.foliageColor)).setNoPushMobility().SetAxesEfficientOn().SetAxesTreatAsVegetation().setDoesNotBreakSaw(); - public static final Material vine = (new MaterialLogic(MapColor.foliageColor)).setBurning().setNoPushMobility().setReplaceable().SetAxesEfficientOn().SetAxesTreatAsVegetation().setDoesNotBreakSaw(); - public static final Material sponge = new Material(MapColor.clothColor); - public static final Material cloth = (new Material(MapColor.clothColor)).setBurning().SetAxesEfficientOn().setDoesNotBreakSaw(); - public static final Material fire = (new MaterialTransparent(MapColor.airColor)).setNoPushMobility(); - public static final Material sand = (new Material(MapColor.sandColor)).setRequiresTool(); - public static final Material circuits = (new MaterialLogic(MapColor.airColor)).setNoPushMobility(); - public static final Material glass = (new Material(MapColor.airColor)).setTranslucent().setAlwaysHarvested(); - public static final Material redstoneLight = (new Material(MapColor.airColor)).setAlwaysHarvested(); - public static final Material tnt = (new Material(MapColor.tntColor)).setBurning().setTranslucent(); - public static final Material coral = (new Material(MapColor.foliageColor)).setNoPushMobility(); - public static final Material ice = (new Material(MapColor.iceColor)).setTranslucent().setAlwaysHarvested(); - public static final Material snow = (new MaterialLogic(MapColor.snowColor)).setReplaceable().setTranslucent().setRequiresTool().setNoPushMobility().setDoesNotBreakSaw(); - - /** The material for crafted snow. */ - public static final Material craftedSnow = (new Material(MapColor.snowColor)).setRequiresTool().setDoesNotBreakSaw(); - public static final Material cactus = (new Material(MapColor.foliageColor)).setTranslucent().setNoPushMobility().SetMobsCantSpawnOn().setDoesNotBreakSaw(); - public static final Material clay = new Material(MapColor.clayColor); - - /** pumpkin */ - public static final Material pumpkin = (new Material(MapColor.foliageColor)).setNoPushMobility().SetAxesEfficientOn().setDoesNotBreakSaw(); - public static final Material dragonEgg = (new Material(MapColor.foliageColor)).setNoPushMobility(); - - /** Material used for portals */ - public static final Material portal = (new MaterialPortal(MapColor.airColor)).setImmovableMobility(); - - /** Cake's material, see BlockCake */ - public static final Material cake = (new Material(MapColor.airColor)).setNoPushMobility(); - - /** Web's material. */ - public static final Material web = (new MaterialWeb(MapColor.clothColor)).setRequiresTool().setNoPushMobility(); - - /** Pistons' material. */ - public static final Material piston = (new Material(MapColor.stoneColor)).setImmovableMobility(); - - /** Bool defining if the block can burn or not. */ - private boolean canBurn; - - /** - * Determines whether blocks with this material can be "overwritten" by other blocks when placed - eg snow, vines - * and tall grass. - */ - private boolean replaceable; - - /** Indicates if the material is translucent */ - private boolean isTranslucent; - - /** The color index used to draw the blocks of this material on maps. */ - public final MapColor materialMapColor; - - /** - * Determines if the material can be harvested without a tool (or with the wrong tool) - */ - private boolean requiresNoTool = true; - - /** - * Mobility information flag. 0 indicates that this block is normal, 1 indicates that it can't push other blocks, 2 - * indicates that it can't be pushed. - */ - private int mobilityFlag; - private boolean field_85159_M; - - public Material(MapColor par1MapColor) - { - this.materialMapColor = par1MapColor; - } - - /** - * Returns if blocks of these materials are liquids. - */ - public boolean isLiquid() - { - return false; - } - - public boolean isSolid() - { - return true; - } - - /** - * Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true - */ - public boolean getCanBlockGrass() - { - return true; - } - - /** - * Returns if this material is considered solid or not - */ - public boolean blocksMovement() - { - return true; - } - - /** - * Marks the material as translucent - */ - // FCMOD: Changed - //private Material setTranslucent() - protected Material setTranslucent() - // END FCMOD - { - this.isTranslucent = true; - return this; - } - - /** - * Makes blocks with this material require the correct tool to be harvested. - */ - public Material setRequiresTool() - { - this.requiresNoTool = false; - return this; - } - - /** - * Set the canBurn bool to True and return the current object. - */ - protected Material setBurning() - { - this.canBurn = true; - return this; - } - - /** - * Returns if the block can burn or not. - */ - public boolean getCanBurn() - { - return this.canBurn; - } - - /** - * Sets {@link #replaceable} to true. - */ - public Material setReplaceable() - { - this.replaceable = true; - return this; - } - - /** - * Returns whether the material can be replaced by other blocks when placed - eg snow, vines and tall grass. - */ - public boolean isReplaceable() - { - return this.replaceable; - } - - /** - * Indicate if the material is opaque - */ - public boolean isOpaque() - { - return this.isTranslucent ? false : this.blocksMovement(); - } - - /** - * Returns true if the material can be harvested without a tool (or with the wrong tool) - */ - public boolean isToolNotRequired() - { - return this.requiresNoTool; - } - - /** - * Returns the mobility information of the material, 0 = free, 1 = can't push but can move over, 2 = total - * immobility and stop pistons. - */ - public int getMaterialMobility() - { - return this.mobilityFlag; - } - - /** - * This type of material can't be pushed, but pistons can move over it. - */ - protected Material setNoPushMobility() - { - this.mobilityFlag = 1; - return this; - } - - /** - * This type of material can't be pushed, and pistons are blocked to move. - */ - protected Material setImmovableMobility() - { - this.mobilityFlag = 2; - return this; - } - - /** - * Set as harvestable in any case. - */ - protected Material setAlwaysHarvested() - { - this.field_85159_M = true; - return this; - } - - /** - * Check to see if we can harvest it in any case. - */ - public boolean isAlwaysHarvested() - { - return this.field_85159_M; - } - - // FCMOD: Added New - private boolean canMobsSpawnOn = true; - private boolean canNetherMobsSpawnOn = false; - private boolean axesEfficientOn = false; - private boolean axesTreatAsVegetation = false; - private boolean breaksSaw = true; - - public boolean GetMobsCanSpawnOn( int iDimension ) - { - if ( iDimension == -1 ) - { - return canNetherMobsSpawnOn; - } - - return canMobsSpawnOn; - } - - public Material SetMobsCantSpawnOn() - { - canMobsSpawnOn = false; - - return this; - } - - public Material SetNetherMobsCanSpawnOn() - { - canNetherMobsSpawnOn = true; - - return this; - } - - public boolean GetAxesEfficientOn() - { - return axesEfficientOn; - } - - public Material SetAxesEfficientOn() - { - axesEfficientOn = true; - - return this; - } - - /** - * If true, this material doesn't damage axes or consume hunger if the - * harvesting axe is of sufficient quality - */ - public boolean GetAxesTreatAsVegetation() - { - return axesTreatAsVegetation; - } - - public Material SetAxesTreatAsVegetation() - { - axesTreatAsVegetation = true; - - return this; - } - - public boolean breaksSaw() { - return breaksSaw; - } - - public Material setDoesNotBreakSaw() { - this.breaksSaw = false; - return this; - } - // END FCMOD -} diff --git a/minecraft/net/minecraft/src/StructureComponent.java b/minecraft/net/minecraft/src/StructureComponent.java deleted file mode 100644 index 9904169..0000000 --- a/minecraft/net/minecraft/src/StructureComponent.java +++ /dev/null @@ -1,877 +0,0 @@ -package net.minecraft.src; - -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -public abstract class StructureComponent -{ - protected StructureBoundingBox boundingBox; - - /** switches the Coordinate System base off the Bounding Box */ - protected int coordBaseMode; - - /** The type ID of this component. */ - protected int componentType; - - protected StructureComponent(int par1) - { - this.componentType = par1; - this.coordBaseMode = -1; - } - - /** - * Initiates construction of the Structure Component picked, at the current Location of StructGen - */ - public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) {} - - /** - * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at - * the end, it adds Fences... - */ - public abstract boolean addComponentParts(World var1, Random var2, StructureBoundingBox var3); - - public StructureBoundingBox getBoundingBox() - { - return this.boundingBox; - } - - /** - * Returns the component type ID of this component. - */ - public int getComponentType() - { - return this.componentType; - } - - /** - * Discover if bounding box can fit within the current bounding box object. - */ - public static StructureComponent findIntersecting(List par0List, StructureBoundingBox par1StructureBoundingBox) - { - Iterator var2 = par0List.iterator(); - StructureComponent var3; - - do - { - if (!var2.hasNext()) - { - return null; - } - - var3 = (StructureComponent)var2.next(); - } - while (var3.getBoundingBox() == null || !var3.getBoundingBox().intersectsWith(par1StructureBoundingBox)); - - return var3; - } - - public ChunkPosition getCenter() - { - return new ChunkPosition(this.boundingBox.getCenterX(), this.boundingBox.getCenterY(), this.boundingBox.getCenterZ()); - } - - /** - * checks the entire StructureBoundingBox for Liquids - */ - protected boolean isLiquidInStructureBoundingBox(World par1World, StructureBoundingBox par2StructureBoundingBox) - { - int var3 = Math.max(this.boundingBox.minX - 1, par2StructureBoundingBox.minX); - int var4 = Math.max(this.boundingBox.minY - 1, par2StructureBoundingBox.minY); - int var5 = Math.max(this.boundingBox.minZ - 1, par2StructureBoundingBox.minZ); - int var6 = Math.min(this.boundingBox.maxX + 1, par2StructureBoundingBox.maxX); - int var7 = Math.min(this.boundingBox.maxY + 1, par2StructureBoundingBox.maxY); - int var8 = Math.min(this.boundingBox.maxZ + 1, par2StructureBoundingBox.maxZ); - int var9; - int var10; - int var11; - - for (var9 = var3; var9 <= var6; ++var9) - { - for (var10 = var5; var10 <= var8; ++var10) - { - var11 = par1World.getBlockId(var9, var4, var10); - - if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid()) - { - return true; - } - - var11 = par1World.getBlockId(var9, var7, var10); - - if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid()) - { - return true; - } - } - } - - for (var9 = var3; var9 <= var6; ++var9) - { - for (var10 = var4; var10 <= var7; ++var10) - { - var11 = par1World.getBlockId(var9, var10, var5); - - if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid()) - { - return true; - } - - var11 = par1World.getBlockId(var9, var10, var8); - - if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid()) - { - return true; - } - } - } - - for (var9 = var5; var9 <= var8; ++var9) - { - for (var10 = var4; var10 <= var7; ++var10) - { - var11 = par1World.getBlockId(var3, var10, var9); - - if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid()) - { - return true; - } - - var11 = par1World.getBlockId(var6, var10, var9); - - if (var11 > 0 && Block.blocksList[var11].blockMaterial.isLiquid()) - { - return true; - } - } - } - - return false; - } - - /** - * checks the entire StructureBoundingBox for Liquids - */ - protected boolean isStructureBoundingBoxEmpty(World world, StructureBoundingBox bb) - { - int minX = Math.max(this.boundingBox.minX - 1, bb.minX); - int minY = Math.max(this.boundingBox.minY - 1, bb.minY); - int minZ = Math.max(this.boundingBox.minZ - 1, bb.minZ); - int maxX = Math.min(this.boundingBox.maxX + 1, bb.maxX); - int maxY = Math.min(this.boundingBox.maxY + 1, bb.maxY); - int maxZ = Math.min(this.boundingBox.maxZ + 1, bb.maxZ); - - for (int i = minX; i < maxX; i++) { - for (int j = minY; j < maxY; j++) { - for (int k = minZ; k < maxZ; k++) { - if (world.getBlockId(i, j, k) != 0) { - return false; - } - } - } - } - - return true; - } - - protected int getXWithOffset(int par1, int par2) - { - switch (this.coordBaseMode) - { - case 0: - case 2: - return this.boundingBox.minX + par1; - - case 1: - return this.boundingBox.maxX - par2; - - case 3: - return this.boundingBox.minX + par2; - - default: - return par1; - } - } - - protected int getYWithOffset(int par1) - { - return this.coordBaseMode == -1 ? par1 : par1 + this.boundingBox.minY; - } - - protected int getZWithOffset(int par1, int par2) - { - switch (this.coordBaseMode) - { - case 0: - return this.boundingBox.minZ + par2; - - case 1: - case 3: - return this.boundingBox.minZ + par1; - - case 2: - return this.boundingBox.maxZ - par2; - - default: - return par2; - } - } - - /** - * Returns the direction-shifted metadata for blocks that require orientation, e.g. doors, stairs, ladders. - * Parameters: block ID, original metadata - */ - protected int getMetadataWithOffset(int par1, int par2) - { - if (par1 == Block.rail.blockID) - { - if (this.coordBaseMode == 1 || this.coordBaseMode == 3) - { - if (par2 == 1) - { - return 0; - } - - return 1; - } - } - else if (par1 != Block.doorWood.blockID && par1 != Block.doorIron.blockID && par1 != FCBetterThanWolves.fcBlockDoorWood.blockID) - { - if (par1 != Block.stairsCobblestone.blockID && par1 != Block.stairsWoodOak.blockID && par1 != Block.stairsNetherBrick.blockID && par1 != Block.stairsStoneBrick.blockID && par1 != Block.stairsSandStone.blockID) - { - if (par1 == Block.ladder.blockID) - { - if (this.coordBaseMode == 0) - { - if (par2 == 2) - { - return 3; - } - - if (par2 == 3) - { - return 2; - } - } - else if (this.coordBaseMode == 1) - { - if (par2 == 2) - { - return 4; - } - - if (par2 == 3) - { - return 5; - } - - if (par2 == 4) - { - return 2; - } - - if (par2 == 5) - { - return 3; - } - } - else if (this.coordBaseMode == 3) - { - if (par2 == 2) - { - return 5; - } - - if (par2 == 3) - { - return 4; - } - - if (par2 == 4) - { - return 2; - } - - if (par2 == 5) - { - return 3; - } - } - } - else if (par1 == Block.stoneButton.blockID) - { - if (this.coordBaseMode == 0) - { - if (par2 == 3) - { - return 4; - } - - if (par2 == 4) - { - return 3; - } - } - else if (this.coordBaseMode == 1) - { - if (par2 == 3) - { - return 1; - } - - if (par2 == 4) - { - return 2; - } - - if (par2 == 2) - { - return 3; - } - - if (par2 == 1) - { - return 4; - } - } - else if (this.coordBaseMode == 3) - { - if (par2 == 3) - { - return 2; - } - - if (par2 == 4) - { - return 1; - } - - if (par2 == 2) - { - return 3; - } - - if (par2 == 1) - { - return 4; - } - } - } - else if (par1 != Block.tripWireSource.blockID && (Block.blocksList[par1] == null || !(Block.blocksList[par1] instanceof BlockDirectional))) - { - if (par1 == Block.pistonBase.blockID || par1 == Block.pistonStickyBase.blockID || par1 == Block.lever.blockID || par1 == Block.dispenser.blockID) - { - if (this.coordBaseMode == 0) - { - if (par2 == 2 || par2 == 3) - { - return Facing.oppositeSide[par2]; - } - } - else if (this.coordBaseMode == 1) - { - if (par2 == 2) - { - return 4; - } - - if (par2 == 3) - { - return 5; - } - - if (par2 == 4) - { - return 2; - } - - if (par2 == 5) - { - return 3; - } - } - else if (this.coordBaseMode == 3) - { - if (par2 == 2) - { - return 5; - } - - if (par2 == 3) - { - return 4; - } - - if (par2 == 4) - { - return 2; - } - - if (par2 == 5) - { - return 3; - } - } - } - } - else if (this.coordBaseMode == 0) - { - if (par2 == 0 || par2 == 2) - { - return Direction.rotateOpposite[par2]; - } - } - else if (this.coordBaseMode == 1) - { - if (par2 == 2) - { - return 1; - } - - if (par2 == 0) - { - return 3; - } - - if (par2 == 1) - { - return 2; - } - - if (par2 == 3) - { - return 0; - } - } - else if (this.coordBaseMode == 3) - { - if (par2 == 2) - { - return 3; - } - - if (par2 == 0) - { - return 1; - } - - if (par2 == 1) - { - return 2; - } - - if (par2 == 3) - { - return 0; - } - } - } - else if (this.coordBaseMode == 0) - { - if (par2 == 2) - { - return 3; - } - - if (par2 == 3) - { - return 2; - } - } - else if (this.coordBaseMode == 1) - { - if (par2 == 0) - { - return 2; - } - - if (par2 == 1) - { - return 3; - } - - if (par2 == 2) - { - return 0; - } - - if (par2 == 3) - { - return 1; - } - } - else if (this.coordBaseMode == 3) - { - if (par2 == 0) - { - return 2; - } - - if (par2 == 1) - { - return 3; - } - - if (par2 == 2) - { - return 1; - } - - if (par2 == 3) - { - return 0; - } - } - } - else if (this.coordBaseMode == 0) - { - if (par2 == 0) - { - return 2; - } - - if (par2 == 2) - { - return 0; - } - } - else - { - if (this.coordBaseMode == 1) - { - return par2 + 1 & 3; - } - - if (this.coordBaseMode == 3) - { - return par2 + 3 & 3; - } - } - - return par2; - } - - /** - * current Position depends on currently set Coordinates mode, is computed here - */ - protected void placeBlockAtCurrentPosition(World par1World, int par2, int par3, int par4, int par5, int par6, StructureBoundingBox par7StructureBoundingBox) - { - int var8 = this.getXWithOffset(par4, par6); - int var9 = this.getYWithOffset(par5); - int var10 = this.getZWithOffset(par4, par6); - - if (par7StructureBoundingBox.isVecInside(var8, var9, var10)) - { - par1World.setBlock(var8, var9, var10, par2, par3, 2); - } - } - - protected int getBlockIdAtCurrentPosition(World par1World, int par2, int par3, int par4, StructureBoundingBox par5StructureBoundingBox) - { - int var6 = this.getXWithOffset(par2, par4); - int var7 = this.getYWithOffset(par3); - int var8 = this.getZWithOffset(par2, par4); - return !par5StructureBoundingBox.isVecInside(var6, var7, var8) ? 0 : par1World.getBlockId(var6, var7, var8); - } - - /** - * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int - * maxZ) - */ - protected void fillWithAir(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8) - { - for (int var9 = par4; var9 <= par7; ++var9) - { - for (int var10 = par3; var10 <= par6; ++var10) - { - for (int var11 = par5; var11 <= par8; ++var11) - { - this.placeBlockAtCurrentPosition(par1World, 0, 0, var10, var9, var11, par2StructureBoundingBox); - } - } - } - } - - /** - * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int - * maxZ, int placeBlockId, int replaceBlockId, boolean alwaysreplace) - */ - protected void fillWithBlocks(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8, int par9, int par10, boolean par11) - { - for (int var12 = par4; var12 <= par7; ++var12) - { - for (int var13 = par3; var13 <= par6; ++var13) - { - for (int var14 = par5; var14 <= par8; ++var14) - { - if (!par11 || this.getBlockIdAtCurrentPosition(par1World, var13, var12, var14, par2StructureBoundingBox) != 0) - { - if (var12 != par4 && var12 != par7 && var13 != par3 && var13 != par6 && var14 != par5 && var14 != par8) - { - this.placeBlockAtCurrentPosition(par1World, par10, 0, var13, var12, var14, par2StructureBoundingBox); - } - else - { - this.placeBlockAtCurrentPosition(par1World, par9, 0, var13, var12, var14, par2StructureBoundingBox); - } - } - } - } - } - } - - /** - * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int - * maxZ, int placeBlockId, int placeBlockMetadata, int replaceBlockId, int replaceBlockMetadata, boolean - * alwaysreplace) - */ - protected void fillWithMetadataBlocks(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8, int par9, int par10, int par11, int par12, boolean par13) - { - for (int var14 = par4; var14 <= par7; ++var14) - { - for (int var15 = par3; var15 <= par6; ++var15) - { - for (int var16 = par5; var16 <= par8; ++var16) - { - if (!par13 || this.getBlockIdAtCurrentPosition(par1World, var15, var14, var16, par2StructureBoundingBox) != 0) - { - if (var14 != par4 && var14 != par7 && var15 != par3 && var15 != par6 && var16 != par5 && var16 != par8) - { - this.placeBlockAtCurrentPosition(par1World, par11, par12, var15, var14, var16, par2StructureBoundingBox); - } - else - { - this.placeBlockAtCurrentPosition(par1World, par9, par10, var15, var14, var16, par2StructureBoundingBox); - } - } - } - } - } - } - - /** - * arguments: World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int - * maxZ, boolean alwaysreplace, Random rand, StructurePieceBlockSelector blockselector - */ - protected void fillWithRandomizedBlocks(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8, boolean par9, Random par10Random, StructurePieceBlockSelector par11StructurePieceBlockSelector) - { - for (int var12 = par4; var12 <= par7; ++var12) - { - for (int var13 = par3; var13 <= par6; ++var13) - { - for (int var14 = par5; var14 <= par8; ++var14) - { - if (!par9 || this.getBlockIdAtCurrentPosition(par1World, var13, var12, var14, par2StructureBoundingBox) != 0) - { - par11StructurePieceBlockSelector.selectBlocks(par10Random, var13, var12, var14, var12 == par4 || var12 == par7 || var13 == par3 || var13 == par6 || var14 == par5 || var14 == par8); - this.placeBlockAtCurrentPosition(par1World, par11StructurePieceBlockSelector.getSelectedBlockId(), par11StructurePieceBlockSelector.getSelectedBlockMetaData(), var13, var12, var14, par2StructureBoundingBox); - } - } - } - } - } - - /** - * arguments: World worldObj, StructureBoundingBox structBB, Random rand, float randLimit, int minX, int minY, int - * minZ, int maxX, int maxY, int maxZ, int olaceBlockId, int replaceBlockId, boolean alwaysreplace - */ - protected void randomlyFillWithBlocks(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, float par4, int par5, int par6, int par7, int par8, int par9, int par10, int par11, int par12, boolean par13) - { - for (int var14 = par6; var14 <= par9; ++var14) - { - for (int var15 = par5; var15 <= par8; ++var15) - { - for (int var16 = par7; var16 <= par10; ++var16) - { - if (par3Random.nextFloat() <= par4 && (!par13 || this.getBlockIdAtCurrentPosition(par1World, var15, var14, var16, par2StructureBoundingBox) != 0)) - { - if (var14 != par6 && var14 != par9 && var15 != par5 && var15 != par8 && var16 != par7 && var16 != par10) - { - this.placeBlockAtCurrentPosition(par1World, par12, 0, var15, var14, var16, par2StructureBoundingBox); - } - else - { - this.placeBlockAtCurrentPosition(par1World, par11, 0, var15, var14, var16, par2StructureBoundingBox); - } - } - } - } - } - } - - /** - * Randomly decides if placing or not. Used for Decoration such as Torches and Spiderwebs - */ - protected void randomlyPlaceBlock(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, float par4, int par5, int par6, int par7, int par8, int par9) - { - if (par3Random.nextFloat() < par4) - { - this.placeBlockAtCurrentPosition(par1World, par8, par9, par5, par6, par7, par2StructureBoundingBox); - } - } - - /** - * Randomly decides if placing or not. Used for Decoration such as Torches and Spiderwebs - */ - protected void randomlyPlaceBlockIfNeighbor(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, float par4, int par5, int par6, int par7, int par8, int par9) - { - boolean hasNeighbor = false; - FCUtilsBlockPos pos = new FCUtilsBlockPos(); - - for (int i = 0; i < 6; i++) { - pos.Set(par5, par6, par7); - pos.AddFacingAsOffset(i); - - if (this.getBlockIdAtCurrentPosition(par1World, par5, par6, par7, par2StructureBoundingBox) != 0) { - hasNeighbor = true; - } - } - - if (par3Random.nextFloat() < par4 && hasNeighbor) - { - this.placeBlockAtCurrentPosition(par1World, par8, par9, par5, par6, par7, par2StructureBoundingBox); - } - } - - /** - * arguments: World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int - * maxZ, int placeBlockId, boolean alwaysreplace - */ - protected void randomlyRareFillWithBlocks(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8, int par9, boolean par10) - { - float var11 = (float)(par6 - par3 + 1); - float var12 = (float)(par7 - par4 + 1); - float var13 = (float)(par8 - par5 + 1); - float var14 = (float)par3 + var11 / 2.0F; - float var15 = (float)par5 + var13 / 2.0F; - - for (int var16 = par4; var16 <= par7; ++var16) - { - float var17 = (float)(var16 - par4) / var12; - - for (int var18 = par3; var18 <= par6; ++var18) - { - float var19 = ((float)var18 - var14) / (var11 * 0.5F); - - for (int var20 = par5; var20 <= par8; ++var20) - { - float var21 = ((float)var20 - var15) / (var13 * 0.5F); - - if (!par10 || this.getBlockIdAtCurrentPosition(par1World, var18, var16, var20, par2StructureBoundingBox) != 0) - { - float var22 = var19 * var19 + var17 * var17 + var21 * var21; - - if (var22 <= 1.05F) - { - this.placeBlockAtCurrentPosition(par1World, par9, 0, var18, var16, var20, par2StructureBoundingBox); - } - } - } - } - } - } - - /** - * Deletes all continuous blocks from selected position upwards. Stops at hitting air. - */ - protected void clearCurrentPositionBlocksUpwards(World par1World, int par2, int par3, int par4, StructureBoundingBox par5StructureBoundingBox) - { - int var6 = this.getXWithOffset(par2, par4); - int var7 = this.getYWithOffset(par3); - int var8 = this.getZWithOffset(par2, par4); - - if (par5StructureBoundingBox.isVecInside(var6, var7, var8)) - { - while (!par1World.isAirBlock(var6, var7, var8) && var7 < 255) - { - par1World.setBlock(var6, var7, var8, 0, 0, 2); - ++var7; - } - } - } - - /** - * Overwrites air and liquids from selected position downwards, stops at hitting anything else. - */ - protected void fillCurrentPositionBlocksDownwards(World par1World, int par2, int par3, int par4, int par5, int par6, StructureBoundingBox par7StructureBoundingBox) - { - int var8 = this.getXWithOffset(par4, par6); - int var9 = this.getYWithOffset(par5); - int var10 = this.getZWithOffset(par4, par6); - - if (par7StructureBoundingBox.isVecInside(var8, var9, var10)) - { - while ((par1World.isAirBlock(var8, var9, var10) || par1World.getBlockMaterial(var8, var9, var10).isLiquid()) && var9 > 1) - { - par1World.setBlock(var8, var9, var10, par2, par3, 2); - --var9; - } - } - } - - /** - * Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests. - */ - protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8) - { - int var9 = this.getXWithOffset(par4, par6); - int var10 = this.getYWithOffset(par5); - int var11 = this.getZWithOffset(par4, par6); - - if (par2StructureBoundingBox.isVecInside(var9, var10, var11) && par1World.getBlockId(var9, var10, var11) != FCBetterThanWolves.fcBlockChest.blockID) - { - par1World.setBlock(var9, var10, var11, FCBetterThanWolves.fcBlockChest.blockID, 0, 2); - TileEntityChest var12 = (TileEntityChest)par1World.getBlockTileEntity(var9, var10, var11); - - if (var12 != null) - { - WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, var12, par8); - } - - return true; - } - else - { - return false; - } - } - - /** - * Used to generate dispenser contents for structures. ex: Jungle Temples. - */ - protected boolean generateStructureDispenserContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, int par7, WeightedRandomChestContent[] par8ArrayOfWeightedRandomChestContent, int par9) - { - int var10 = this.getXWithOffset(par4, par6); - int var11 = this.getYWithOffset(par5); - int var12 = this.getZWithOffset(par4, par6); - - if (par2StructureBoundingBox.isVecInside(var10, var11, var12) && par1World.getBlockId(var10, var11, var12) != Block.dispenser.blockID) - { - par1World.setBlock(var10, var11, var12, Block.dispenser.blockID, this.getMetadataWithOffset(Block.dispenser.blockID, par7), 2); - TileEntityDispenser var13 = (TileEntityDispenser)par1World.getBlockTileEntity(var10, var11, var12); - - if (var13 != null) - { - WeightedRandomChestContent.generateDispenserContents(par3Random, par8ArrayOfWeightedRandomChestContent, var13, par9); - } - - return true; - } - else - { - return false; - } - } - - protected void placeDoorAtCurrentPosition(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, int par7) - { - int var8 = this.getXWithOffset(par4, par6); - int var9 = this.getYWithOffset(par5); - int var10 = this.getZWithOffset(par4, par6); - - if (par2StructureBoundingBox.isVecInside(var8, var9, var10)) - { - ItemDoor.placeDoorBlock(par1World, var8, var9, var10, par7, FCBetterThanWolves.fcBlockDoorWood); - } - } -} diff --git a/minecraft/net/minecraft/src/StructureMineshaftPieces.java b/minecraft/net/minecraft/src/StructureMineshaftPieces.java deleted file mode 100644 index ede28c3..0000000 --- a/minecraft/net/minecraft/src/StructureMineshaftPieces.java +++ /dev/null @@ -1,80 +0,0 @@ -package net.minecraft.src; - -import java.util.List; -import java.util.Random; - -public class StructureMineshaftPieces -{ - /** List of contents that can generate in Mineshafts. */ - private static final WeightedRandomChestContent[] mineshaftChestContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.ingotIron.itemID, 0, 1, 5, 10), new WeightedRandomChestContent(Item.ingotGold.itemID, 0, 1, 3, 5), new WeightedRandomChestContent(Item.redstone.itemID, 0, 4, 9, 5), new WeightedRandomChestContent(Item.dyePowder.itemID, 4, 4, 9, 5), new WeightedRandomChestContent(Item.diamond.itemID, 0, 1, 2, 3), new WeightedRandomChestContent(Item.coal.itemID, 0, 3, 8, 10), new WeightedRandomChestContent(Item.bread.itemID, 0, 1, 3, 15), new WeightedRandomChestContent(Item.pickaxeIron.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Block.rail.blockID, 0, 4, 8, 1), new WeightedRandomChestContent(Item.melonSeeds.itemID, 0, 2, 4, 10), new WeightedRandomChestContent(Item.pumpkinSeeds.itemID, 0, 2, 4, 10)}; - - private static StructureComponent getRandomComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) - { - int var7 = par1Random.nextInt(100); - StructureBoundingBox var8; - - if (var7 >= 80) - { - var8 = ComponentMineshaftCross.findValidPlacement(par0List, par1Random, par2, par3, par4, par5); - - if (var8 != null) - { - return new ComponentMineshaftCross(par6, par1Random, var8, par5); - } - } - else if (var7 >= 70) - { - var8 = ComponentMineshaftStairs.findValidPlacement(par0List, par1Random, par2, par3, par4, par5); - - if (var8 != null) - { - return new ComponentMineshaftStairs(par6, par1Random, var8, par5); - } - } - else - { - var8 = ComponentMineshaftCorridor.findValidPlacement(par0List, par1Random, par2, par3, par4, par5); - - if (var8 != null) - { - return new ComponentMineshaftCorridor(par6, par1Random, var8, par5); - } - } - - return null; - } - - private static StructureComponent getNextMineShaftComponent(StructureComponent par0StructureComponent, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) - { - if (par7 > 8) - { - return null; - } - else if (Math.abs(par3 - par0StructureComponent.getBoundingBox().minX) <= 80 && Math.abs(par5 - par0StructureComponent.getBoundingBox().minZ) <= 80) - { - StructureComponent var8 = getRandomComponent(par1List, par2Random, par3, par4, par5, par6, par7 + 1); - - if (var8 != null) - { - par1List.add(var8); - var8.buildComponent(par0StructureComponent, par1List, par2Random); - } - - return var8; - } - else - { - return null; - } - } - - static StructureComponent getNextComponent(StructureComponent par0StructureComponent, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) - { - return getNextMineShaftComponent(par0StructureComponent, par1List, par2Random, par3, par4, par5, par6, par7); - } - - public static WeightedRandomChestContent[] func_78816_a() - { - return mineshaftChestContents; - } -} diff --git a/minecraft/net/minecraft/src/StructureNetherBridgeStart.java b/minecraft/net/minecraft/src/StructureNetherBridgeStart.java deleted file mode 100644 index be715d6..0000000 --- a/minecraft/net/minecraft/src/StructureNetherBridgeStart.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.minecraft.src; - -import java.util.ArrayList; -import java.util.Random; - -public class StructureNetherBridgeStart extends StructureStart -{ - public StructureNetherBridgeStart(World par1World, Random par2Random, int par3, int par4) - { - ComponentNetherBridgeStartPiece var5 = new ComponentNetherBridgeStartPiece(par2Random, (par3 << 4) + 2, (par4 << 4) + 2); - this.components.add(var5); - var5.buildComponent(var5, this.components, par2Random); - ArrayList var6 = var5.field_74967_d; - - while (!var6.isEmpty()) - { - int var7 = par2Random.nextInt(var6.size()); - StructureComponent var8 = (StructureComponent)var6.remove(var7); - var8.buildComponent(var5, this.components, par2Random); - } - - this.updateBoundingBox(); - this.setRandomHeight(par1World, par2Random, 48, 70); - } -} diff --git a/minecraft/net/minecraft/src/StructureScatteredFeatureStart.java b/minecraft/net/minecraft/src/StructureScatteredFeatureStart.java deleted file mode 100644 index a0313c0..0000000 --- a/minecraft/net/minecraft/src/StructureScatteredFeatureStart.java +++ /dev/null @@ -1,59 +0,0 @@ -package net.minecraft.src; - -import java.util.ArrayList; -import java.util.Random; - -import betterterrain.structure.component.BTAComponentScatteredFeatureRedDesertPyramid; - -public class StructureScatteredFeatureStart extends StructureStart -{ - public static ArrayList desertBiomeList = new ArrayList(); - public static ArrayList redDesertBiomeList = new ArrayList(); - public static ArrayList jungleBiomeList = new ArrayList(); - public static ArrayList swampBiomeList = new ArrayList(); - - public static void addDesertBiome(BiomeGenBase biome) { - desertBiomeList.add(biome); - } - - public static void addRedDesertBiome(BiomeGenBase biome) { - redDesertBiomeList.add(biome); - } - - public static void addJungleBiome(BiomeGenBase biome) { - jungleBiomeList.add(biome); - } - - public static void addSwampBiome(BiomeGenBase biome) { - swampBiomeList.add(biome); - } - - public StructureScatteredFeatureStart(World world, Random rand, int chunkX, int chunkZ) - { - BiomeGenBase biome = world.getBiomeGenForCoords(chunkX * 16 + 8, chunkZ * 16 + 8); - - if (swampBiomeList.contains(biome)) - { - ComponentScatteredFeatureSwampHut var7 = new ComponentScatteredFeatureSwampHut(rand, chunkX * 16, chunkZ * 16); - this.components.add(var7); - } - else if (desertBiomeList.contains(biome)) - { - ComponentScatteredFeatureDesertPyramid var8 = new ComponentScatteredFeatureDesertPyramid(rand, chunkX * 16, chunkZ * 16); - this.components.add(var8); - } - else if (redDesertBiomeList.contains(biome)) - { - BTAComponentScatteredFeatureRedDesertPyramid var8 = new BTAComponentScatteredFeatureRedDesertPyramid(rand, chunkX * 16, chunkZ * 16); - this.components.add(var8); - } - else if(jungleBiomeList.contains(biome)) - { - ComponentScatteredFeatureJunglePyramid var6 = new ComponentScatteredFeatureJunglePyramid(rand, chunkX * 16, chunkZ * 16); - this.components.add(var6); - } - - this.updateBoundingBox(); - } -} - diff --git a/minecraft/net/minecraft/src/StructureStrongholdStart.java b/minecraft/net/minecraft/src/StructureStrongholdStart.java deleted file mode 100644 index 6cbaa3e..0000000 --- a/minecraft/net/minecraft/src/StructureStrongholdStart.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.minecraft.src; - -import java.util.ArrayList; -import java.util.Random; - -public class StructureStrongholdStart extends StructureStart -{ - public StructureStrongholdStart(World par1World, Random par2Random, int par3, int par4) - { - StructureStrongholdPieces.prepareStructurePieces(); - ComponentStrongholdStairs2 var5 = new ComponentStrongholdStairs2(0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2); - this.components.add(var5); - var5.buildComponent(var5, this.components, par2Random); - ArrayList var6 = var5.field_75026_c; - - while (!var6.isEmpty()) - { - int var7 = par2Random.nextInt(var6.size()); - StructureComponent var8 = (StructureComponent)var6.remove(var7); - var8.buildComponent(var5, this.components, par2Random); - } - - this.updateBoundingBox(); - this.markAvailableHeight(par1World, par2Random, 10); - } -} diff --git a/minecraft/net/minecraft/src/StructureVillagePieces.java b/minecraft/net/minecraft/src/StructureVillagePieces.java deleted file mode 100644 index e619852..0000000 --- a/minecraft/net/minecraft/src/StructureVillagePieces.java +++ /dev/null @@ -1,247 +0,0 @@ -package net.minecraft.src; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -public class StructureVillagePieces -{ - public static ArrayList getStructureVillageWeightedPieceList(Random par0Random, int par1) - { - ArrayList var2 = new ArrayList(); - var2.add(new StructureVillagePieceWeight(ComponentVillageHouse4_Garden.class, 4, MathHelper.getRandomIntegerInRange(par0Random, 2 + par1, 4 + par1 * 2))); - var2.add(new StructureVillagePieceWeight(ComponentVillageChurch.class, 20, MathHelper.getRandomIntegerInRange(par0Random, 0 + par1, 1 + par1))); - var2.add(new StructureVillagePieceWeight(ComponentVillageHouse1.class, 20, MathHelper.getRandomIntegerInRange(par0Random, 0 + par1, 2 + par1))); - var2.add(new StructureVillagePieceWeight(ComponentVillageWoodHut.class, 3, MathHelper.getRandomIntegerInRange(par0Random, 2 + par1, 5 + par1 * 3))); - var2.add(new StructureVillagePieceWeight(ComponentVillageHall.class, 15, MathHelper.getRandomIntegerInRange(par0Random, 0 + par1, 2 + par1))); - var2.add(new StructureVillagePieceWeight(ComponentVillageField.class, 3, MathHelper.getRandomIntegerInRange(par0Random, 1 + par1, 4 + par1))); - var2.add(new StructureVillagePieceWeight(ComponentVillageField2.class, 3, MathHelper.getRandomIntegerInRange(par0Random, 2 + par1, 4 + par1 * 2))); - var2.add(new StructureVillagePieceWeight(ComponentVillageHouse2.class, 15, MathHelper.getRandomIntegerInRange(par0Random, 0, 1 + par1))); - var2.add(new StructureVillagePieceWeight(ComponentVillageHouse3.class, 8, MathHelper.getRandomIntegerInRange(par0Random, 0 + par1, 3 + par1 * 2))); - Iterator var3 = var2.iterator(); - - while (var3.hasNext()) - { - if (((StructureVillagePieceWeight)var3.next()).villagePiecesLimit == 0) - { - var3.remove(); - } - } - - return var2; - } - - private static int func_75079_a(List par0List) - { - boolean var1 = false; - int var2 = 0; - StructureVillagePieceWeight var4; - - for (Iterator var3 = par0List.iterator(); var3.hasNext(); var2 += var4.villagePieceWeight) - { - var4 = (StructureVillagePieceWeight)var3.next(); - - if (var4.villagePiecesLimit > 0 && var4.villagePiecesSpawned < var4.villagePiecesLimit) - { - var1 = true; - } - } - - return var1 ? var2 : -1; - } - - private static ComponentVillage func_75083_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, StructureVillagePieceWeight par1StructureVillagePieceWeight, List par2List, Random par3Random, int par4, int par5, int par6, int par7, int par8) - { - Class var9 = par1StructureVillagePieceWeight.villagePieceClass; - Object var10 = null; - - if (var9 == ComponentVillageHouse4_Garden.class) - { - var10 = ComponentVillageHouse4_Garden.func_74912_a(par0ComponentVillageStartPiece, par2List, par3Random, par4, par5, par6, par7, par8); - } - else if (var9 == ComponentVillageChurch.class) - { - var10 = ComponentVillageChurch.func_74919_a(par0ComponentVillageStartPiece, par2List, par3Random, par4, par5, par6, par7, par8); - } - else if (var9 == ComponentVillageHouse1.class) - { - var10 = ComponentVillageHouse1.func_74898_a(par0ComponentVillageStartPiece, par2List, par3Random, par4, par5, par6, par7, par8); - } - else if (var9 == ComponentVillageWoodHut.class) - { - var10 = ComponentVillageWoodHut.func_74908_a(par0ComponentVillageStartPiece, par2List, par3Random, par4, par5, par6, par7, par8); - } - else if (var9 == ComponentVillageHall.class) - { - var10 = ComponentVillageHall.func_74906_a(par0ComponentVillageStartPiece, par2List, par3Random, par4, par5, par6, par7, par8); - } - else if (var9 == ComponentVillageField.class) - { - var10 = ComponentVillageField.func_74900_a(par0ComponentVillageStartPiece, par2List, par3Random, par4, par5, par6, par7, par8); - } - else if (var9 == ComponentVillageField2.class) - { - var10 = ComponentVillageField2.func_74902_a(par0ComponentVillageStartPiece, par2List, par3Random, par4, par5, par6, par7, par8); - } - else if (var9 == ComponentVillageHouse2.class) - { - var10 = ComponentVillageHouse2.func_74915_a(par0ComponentVillageStartPiece, par2List, par3Random, par4, par5, par6, par7, par8); - } - else if (var9 == ComponentVillageHouse3.class) - { - var10 = ComponentVillageHouse3.func_74921_a(par0ComponentVillageStartPiece, par2List, par3Random, par4, par5, par6, par7, par8); - } - - return (ComponentVillage)var10; - } - - /** - * attempts to find a next Village Component to be spawned - */ - private static ComponentVillage getNextVillageComponent(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) - { - int var8 = func_75079_a(par0ComponentVillageStartPiece.structureVillageWeightedPieceList); - - if (var8 <= 0) - { - return null; - } - else - { - int var9 = 0; - - while (var9 < 5) - { - ++var9; - int var10 = par2Random.nextInt(var8); - Iterator var11 = par0ComponentVillageStartPiece.structureVillageWeightedPieceList.iterator(); - - while (var11.hasNext()) - { - StructureVillagePieceWeight var12 = (StructureVillagePieceWeight)var11.next(); - var10 -= var12.villagePieceWeight; - - if (var10 < 0) - { - if (!var12.canSpawnMoreVillagePiecesOfType(par7) || var12 == par0ComponentVillageStartPiece.structVillagePieceWeight && par0ComponentVillageStartPiece.structureVillageWeightedPieceList.size() > 1) - { - break; - } - - ComponentVillage var13 = func_75083_a(par0ComponentVillageStartPiece, var12, par1List, par2Random, par3, par4, par5, par6, par7); - - if (var13 != null) - { - ++var12.villagePiecesSpawned; - par0ComponentVillageStartPiece.structVillagePieceWeight = var12; - - if (!var12.canSpawnMoreVillagePieces()) - { - par0ComponentVillageStartPiece.structureVillageWeightedPieceList.remove(var12); - } - - return var13; - } - } - } - } - - StructureBoundingBox var14 = ComponentVillageTorch.func_74904_a(par0ComponentVillageStartPiece, par1List, par2Random, par3, par4, par5, par6); - - if (var14 != null) - { - return new ComponentVillageTorch(par0ComponentVillageStartPiece, par7, par2Random, var14, par6); - } - else - { - return null; - } - } - } - - /** - * attempts to find a next Structure Component to be spawned, private Village function - */ - private static StructureComponent getNextVillageStructureComponent(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) - { - if (par7 > 50) - { - return null; - } - else if (Math.abs(par3 - par0ComponentVillageStartPiece.getBoundingBox().minX) <= 112 && Math.abs(par5 - par0ComponentVillageStartPiece.getBoundingBox().minZ) <= 112) - { - ComponentVillage var8 = getNextVillageComponent(par0ComponentVillageStartPiece, par1List, par2Random, par3, par4, par5, par6, par7 + 1); - - if (var8 != null) - { - int var9 = (var8.boundingBox.minX + var8.boundingBox.maxX) / 2; - int var10 = (var8.boundingBox.minZ + var8.boundingBox.maxZ) / 2; - int var11 = var8.boundingBox.maxX - var8.boundingBox.minX; - int var12 = var8.boundingBox.maxZ - var8.boundingBox.minZ; - int var13 = var11 > var12 ? var11 : var12; - - if (par0ComponentVillageStartPiece.getWorldChunkManager().areBiomesViable(var9, var10, var13 / 2 + 4, MapGenVillage.villageSpawnBiomes)) - { - par1List.add(var8); - par0ComponentVillageStartPiece.field_74932_i.add(var8); - return var8; - } - } - - return null; - } - else - { - return null; - } - } - - private static StructureComponent getNextComponentVillagePath(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) - { - if (par7 > 3 + par0ComponentVillageStartPiece.terrainType) - { - return null; - } - else if (Math.abs(par3 - par0ComponentVillageStartPiece.getBoundingBox().minX) <= 112 && Math.abs(par5 - par0ComponentVillageStartPiece.getBoundingBox().minZ) <= 112) - { - StructureBoundingBox var8 = ComponentVillagePathGen.func_74933_a(par0ComponentVillageStartPiece, par1List, par2Random, par3, par4, par5, par6); - - if (var8 != null && var8.minY > 10) - { - ComponentVillagePathGen var9 = new ComponentVillagePathGen(par0ComponentVillageStartPiece, par7, par2Random, var8, par6); - int var10 = (var9.boundingBox.minX + var9.boundingBox.maxX) / 2; - int var11 = (var9.boundingBox.minZ + var9.boundingBox.maxZ) / 2; - int var12 = var9.boundingBox.maxX - var9.boundingBox.minX; - int var13 = var9.boundingBox.maxZ - var9.boundingBox.minZ; - int var14 = var12 > var13 ? var12 : var13; - - if (par0ComponentVillageStartPiece.getWorldChunkManager().areBiomesViable(var10, var11, var14 / 2 + 4, MapGenVillage.villageSpawnBiomes)) - { - par1List.add(var9); - par0ComponentVillageStartPiece.field_74930_j.add(var9); - return var9; - } - } - - return null; - } - else - { - return null; - } - } - - /** - * attempts to find a next Structure Component to be spawned - */ - static StructureComponent getNextStructureComponent(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) - { - return getNextVillageStructureComponent(par0ComponentVillageStartPiece, par1List, par2Random, par3, par4, par5, par6, par7); - } - - static StructureComponent getNextStructureComponentVillagePath(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) - { - return getNextComponentVillagePath(par0ComponentVillageStartPiece, par1List, par2Random, par3, par4, par5, par6, par7); - } -} diff --git a/minecraft/net/minecraft/src/StructureVillageStart.java b/minecraft/net/minecraft/src/StructureVillageStart.java deleted file mode 100644 index e9ebab8..0000000 --- a/minecraft/net/minecraft/src/StructureVillageStart.java +++ /dev/null @@ -1,64 +0,0 @@ -package net.minecraft.src; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Random; - -public class StructureVillageStart extends StructureStart -{ - /** well ... thats what it does */ - private boolean hasMoreThanTwoComponents = false; - - public StructureVillageStart(World par1World, Random par2Random, int par3, int par4, int par5) - { - ArrayList var6 = StructureVillagePieces.getStructureVillageWeightedPieceList(par2Random, par5); - ComponentVillageStartPiece var7 = new ComponentVillageStartPiece(par1World.getWorldChunkManager(), 0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2, var6, par5); - this.components.add(var7); - var7.buildComponent(var7, this.components, par2Random); - ArrayList var8 = var7.field_74930_j; - ArrayList var9 = var7.field_74932_i; - int var10; - - while (!var8.isEmpty() || !var9.isEmpty()) - { - StructureComponent var11; - - if (var8.isEmpty()) - { - var10 = par2Random.nextInt(var9.size()); - var11 = (StructureComponent)var9.remove(var10); - var11.buildComponent(var7, this.components, par2Random); - } - else - { - var10 = par2Random.nextInt(var8.size()); - var11 = (StructureComponent)var8.remove(var10); - var11.buildComponent(var7, this.components, par2Random); - } - } - - this.updateBoundingBox(); - var10 = 0; - Iterator var13 = this.components.iterator(); - - while (var13.hasNext()) - { - StructureComponent var12 = (StructureComponent)var13.next(); - - if (!(var12 instanceof ComponentVillageRoadPiece)) - { - ++var10; - } - } - - this.hasMoreThanTwoComponents = var10 > 2; - } - - /** - * currently only defined for Villages, returns true if Village has more than 2 non-road components - */ - public boolean isSizeableStructure() - { - return this.hasMoreThanTwoComponents; - } -} diff --git a/minecraft/net/minecraft/src/WorldProvider.java b/minecraft/net/minecraft/src/WorldProvider.java deleted file mode 100644 index 2650cdc..0000000 --- a/minecraft/net/minecraft/src/WorldProvider.java +++ /dev/null @@ -1,267 +0,0 @@ -package net.minecraft.src; - -public abstract class WorldProvider -{ - /** world object being used */ - public World worldObj; - public WorldType terrainType; - public String generatorOptions; - - /** World chunk manager being used to generate chunks */ - public WorldChunkManager worldChunkMgr; - - /** - * States whether the Hell world provider is used(true) or if the normal world provider is used(false) - */ - public boolean isHellWorld = false; - - /** - * A boolean that tells if a world does not have a sky. Used in calculating weather and skylight - */ - public boolean hasNoSky = false; - - /** Light to brightness conversion table */ - public float[] lightBrightnessTable = new float[16]; - - /** The id for the dimension (ex. -1: Nether, 0: Overworld, 1: The End) */ - public int dimensionId = 0; - - /** Array for sunrise/sunset colors (RGBA) */ - private float[] colorsSunriseSunset = new float[4]; - - /** - * associate an existing world with a World provider, and setup its lightbrightness table - */ - public final void registerWorld(World par1World) - { - this.worldObj = par1World; - this.terrainType = par1World.getWorldInfo().getTerrainType(); - this.generatorOptions = par1World.getWorldInfo().getGeneratorOptions(); - this.registerWorldChunkManager(); - this.generateLightBrightnessTable(); - } - - /** - * Creates the light to brightness table - */ - protected void generateLightBrightnessTable() - { - float var1 = 0.0F; - - for (int var2 = 0; var2 <= 15; ++var2) - { - float var3 = 1.0F - (float)var2 / 15.0F; - this.lightBrightnessTable[var2] = (1.0F - var3) / (var3 * 3.0F + 1.0F) * (1.0F - var1) + var1; - } - } - - /** - * creates a new world chunk manager for WorldProvider - */ - protected void registerWorldChunkManager() - { - if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT) - { - FlatGeneratorInfo var1 = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); - this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.biomeList[var1.getBiome()], 0.5F, 0.5F); - } - else - { - this.worldChunkMgr = this.terrainType.getChunkManager(this.worldObj, this.generatorOptions); - } - } - - /** - * Returns a new chunk provider which generates chunks for this world - */ - public IChunkProvider createChunkGenerator() - { - if (this.terrainType == WorldType.FLAT) { - return new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorOptions); - } - else { - return this.terrainType.getChunkProviderOverworld(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorOptions); - } - } - - /** - * Will check if the x, z position specified is alright to be set as the map spawn point - */ - public boolean canCoordinateBeSpawn(int par1, int par2) - { - int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2); - return var3 == Block.grass.blockID; - } - - /** - * Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime) - */ - public float calculateCelestialAngle(long par1, float par3) - { - int var4 = (int)(par1 % 24000L); - float var5 = ((float)var4 + par3) / 24000.0F - 0.25F; - - if (var5 < 0.0F) - { - ++var5; - } - - if (var5 > 1.0F) - { - --var5; - } - - float var6 = var5; - var5 = 1.0F - (float)((Math.cos((double)var5 * Math.PI) + 1.0D) / 2.0D); - var5 = var6 + (var5 - var6) / 3.0F; - return var5; - } - - public int getMoonPhase(long par1) - { - return (int)(par1 / 24000L) % 8; - } - - /** - * Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions. - */ - public boolean isSurfaceWorld() - { - return true; - } - - /** - * Returns array with sunrise/sunset colors - */ - public float[] calcSunriseSunsetColors(float par1, float par2) - { - float var3 = 0.4F; - float var4 = MathHelper.cos(par1 * (float)Math.PI * 2.0F) - 0.0F; - float var5 = -0.0F; - - if (var4 >= var5 - var3 && var4 <= var5 + var3) - { - float var6 = (var4 - var5) / var3 * 0.5F + 0.5F; - float var7 = 1.0F - (1.0F - MathHelper.sin(var6 * (float)Math.PI)) * 0.99F; - var7 *= var7; - this.colorsSunriseSunset[0] = var6 * 0.3F + 0.7F; - this.colorsSunriseSunset[1] = var6 * var6 * 0.7F + 0.2F; - this.colorsSunriseSunset[2] = var6 * var6 * 0.0F + 0.2F; - this.colorsSunriseSunset[3] = var7; - return this.colorsSunriseSunset; - } - else - { - return null; - } - } - - public Vec3 getFogColor(float par1, float par2) { - return getFogColor(par1, par2, 0, 0, 0); - } - - /** - * Return Vec3D with biome specific fog color - */ - public Vec3 getFogColor(float par1, float par2, int x, int y, int z) - { - float var3 = MathHelper.cos(par1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - - if (var3 < 0.0F) - { - var3 = 0.0F; - } - - if (var3 > 1.0F) - { - var3 = 1.0F; - } - - float var4 = 0.7529412F; - float var5 = 0.84705883F; - float var6 = 1.0F; - var4 *= var3 * 0.94F + 0.06F; - var5 *= var3 * 0.94F + 0.06F; - var6 *= var3 * 0.91F + 0.09F; - return this.worldObj.getWorldVec3Pool().getVecFromPool((double)var4, (double)var5, (double)var6); - } - - /** - * True if the player can respawn in this dimension (true = overworld, false = nether). - */ - public boolean canRespawnHere() - { - return true; - } - - public static WorldProvider getProviderForDimension(int par0) - { - return (WorldProvider)(par0 == -1 ? new WorldProviderHell() : (par0 == 0 ? new WorldProviderSurface() : (par0 == 1 ? new WorldProviderEnd() : null))); - } - - /** - * the y level at which clouds are rendered. - */ - public float getCloudHeight() - { - return this.terrainType.getCloudHeight(); - } - - public boolean isSkyColored() - { - return true; - } - - /** - * Gets the hard-coded portal location to use when entering this dimension. - */ - public ChunkCoordinates getEntrancePortalLocation() - { - return null; - } - - public int getAverageGroundLevel() - { - if (this.terrainType == WorldType.FLAT) - return 4; - else - return this.terrainType.getAverageGroundLevel(); - } - - /** - * returns true if this dimension is supposed to display void particles and pull in the far plane based on the - * user's Y offset. - */ - public boolean getWorldHasVoidParticles() - { - return this.terrainType != WorldType.FLAT && !this.hasNoSky; - } - - /** - * Returns a double value representing the Y value relative to the top of the map at which void fog is at its - * maximum. The default factor of 0.03125 relative to 256, for example, means the void fog will be at its maximum at - * (256*0.03125), or 8. - */ - public double getVoidFogYFactor() - { - return this.terrainType == WorldType.FLAT ? 1.0D : 0.03125D; - } - - /** - * Returns true if the given X,Z coordinate should show environmental fog. - */ - public boolean doesXZShowFog(int par1, int par2) - { - return false; - } - - /** - * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". - */ - public abstract String getDimensionName(); - - public int getWorldType() - { - return this.dimensionId; - } -} diff --git a/minecraft/net/minecraft/src/WorldProviderEnd.java b/minecraft/net/minecraft/src/WorldProviderEnd.java deleted file mode 100644 index ad10ce9..0000000 --- a/minecraft/net/minecraft/src/WorldProviderEnd.java +++ /dev/null @@ -1,132 +0,0 @@ -package net.minecraft.src; - -public class WorldProviderEnd extends WorldProvider -{ - /** - * creates a new world chunk manager for WorldProvider - */ - public void registerWorldChunkManager() - { - this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.sky, 0.5F, 0.0F); - this.dimensionId = 1; - this.hasNoSky = true; - } - - /** - * Returns a new chunk provider which generates chunks for this world - */ - public IChunkProvider createChunkGenerator() - { - return this.terrainType.getChunkProviderEnd(this.worldObj, this.worldObj.getSeed()); - } - - /** - * Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime) - */ - public float calculateCelestialAngle(long par1, float par3) - { - return 0.0F; - } - - /** - * Returns array with sunrise/sunset colors - */ - public float[] calcSunriseSunsetColors(float par1, float par2) - { - return null; - } - - /** - * Return Vec3D with biome specific fog color - */ - public Vec3 getFogColor(float par1, float par2) - { - int var3 = 10518688; - float var4 = MathHelper.cos(par1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - - if (var4 < 0.0F) - { - var4 = 0.0F; - } - - if (var4 > 1.0F) - { - var4 = 1.0F; - } - - float var5 = (float)(var3 >> 16 & 255) / 255.0F; - float var6 = (float)(var3 >> 8 & 255) / 255.0F; - float var7 = (float)(var3 & 255) / 255.0F; - var5 *= var4 * 0.0F + 0.15F; - var6 *= var4 * 0.0F + 0.15F; - var7 *= var4 * 0.0F + 0.15F; - return this.worldObj.getWorldVec3Pool().getVecFromPool((double)var5, (double)var6, (double)var7); - } - - public boolean isSkyColored() - { - return false; - } - - /** - * True if the player can respawn in this dimension (true = overworld, false = nether). - */ - public boolean canRespawnHere() - { - return false; - } - - /** - * Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions. - */ - public boolean isSurfaceWorld() - { - return false; - } - - /** - * the y level at which clouds are rendered. - */ - public float getCloudHeight() - { - return 8.0F; - } - - /** - * Will check if the x, z position specified is alright to be set as the map spawn point - */ - public boolean canCoordinateBeSpawn(int par1, int par2) - { - int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2); - return var3 == 0 ? false : Block.blocksList[var3].blockMaterial.blocksMovement(); - } - - /** - * Gets the hard-coded portal location to use when entering this dimension. - */ - public ChunkCoordinates getEntrancePortalLocation() - { - return new ChunkCoordinates(100, 50, 0); - } - - public int getAverageGroundLevel() - { - return 50; - } - - /** - * Returns true if the given X,Z coordinate should show environmental fog. - */ - public boolean doesXZShowFog(int par1, int par2) - { - return true; - } - - /** - * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". - */ - public String getDimensionName() - { - return "The End"; - } -} diff --git a/minecraft/net/minecraft/src/WorldProviderHell.java b/minecraft/net/minecraft/src/WorldProviderHell.java deleted file mode 100644 index f3444eb..0000000 --- a/minecraft/net/minecraft/src/WorldProviderHell.java +++ /dev/null @@ -1,128 +0,0 @@ -package net.minecraft.src; - -import betterterrain.biome.BTABiomeConfiguration; -import betterterrain.biome.BTANetherBiome; - -public class WorldProviderHell extends WorldProvider -{ - /** - * creates a new world chunk manager for WorldProvider - */ - public void registerWorldChunkManager() - { - WorldType worldType = this.worldObj.worldInfo.getTerrainType(); - - if (worldType.isDeco()) { - this.worldChunkMgr = new WorldChunkManagerHell(BTABiomeConfiguration.netherWastes, 1.0F, 0.0F); - } - else { - this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.hell, 1.0F, 0.0F); - } - this.isHellWorld = true; - this.hasNoSky = true; - this.dimensionId = -1; - } - - /** - * Return Vec3D with biome specific fog color - */ - public Vec3 getFogColor(float par1, float par2, int x, int y, int z) - { - BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(x, z); - - if (biome instanceof BTANetherBiome) { - Vec3[][] biomeColors = new Vec3[5][5]; - - for (int i = 0; i < 5; i++) { - for (int j = 0; j < 5; j++) { - biomeColors[i][j] = ((BTANetherBiome) this.worldObj.getBiomeGenForCoords(x - 2 + i, z - 2 + j)).getFogColor(this.worldObj); - } - } - - Vec3 color = this.worldObj.getWorldVec3Pool().getVecFromPool(0, 0, 0); - - for (int i = 0; i < 5; i++) { - for (int j = 0; j < 5; j++) { - color.xCoord += biomeColors[i][j].xCoord / 25; - color.yCoord += biomeColors[i][j].yCoord / 25; - color.zCoord += biomeColors[i][j].zCoord / 25; - } - } - - return color; - } - else { - return this.worldObj.getWorldVec3Pool().getVecFromPool(0.2, 0.03, 0.03); - } - } - - /** - * Creates the light to brightness table - */ - protected void generateLightBrightnessTable() - { - float var1 = 0.1F; - - for (int var2 = 0; var2 <= 15; ++var2) - { - float var3 = 1.0F - (float)var2 / 15.0F; - this.lightBrightnessTable[var2] = (1.0F - var3) / (var3 * 3.0F + 1.0F) * (1.0F - var1) + var1; - } - } - - /** - * Returns a new chunk provider which generates chunks for this world - */ - public IChunkProvider createChunkGenerator() - { - return this.terrainType.getChunkProviderNether(this.worldObj, this.worldObj.getSeed(), this.generatorOptions); - } - - /** - * Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions. - */ - public boolean isSurfaceWorld() - { - return false; - } - - /** - * Will check if the x, z position specified is alright to be set as the map spawn point - */ - public boolean canCoordinateBeSpawn(int par1, int par2) - { - return false; - } - - /** - * Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime) - */ - public float calculateCelestialAngle(long par1, float par3) - { - return 0.5F; - } - - /** - * True if the player can respawn in this dimension (true = overworld, false = nether). - */ - public boolean canRespawnHere() - { - return false; - } - - /** - * Returns true if the given X,Z coordinate should show environmental fog. - */ - public boolean doesXZShowFog(int par1, int par2) - { - return true; - } - - /** - * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". - */ - public String getDimensionName() - { - return "Nether"; - } -} diff --git a/minecraft/net/minecraft/src/WorldType.java b/minecraft/net/minecraft/src/WorldType.java deleted file mode 100644 index 68249c9..0000000 --- a/minecraft/net/minecraft/src/WorldType.java +++ /dev/null @@ -1,212 +0,0 @@ -package net.minecraft.src; - -import betterterrain.world.config.WorldConfigurationInfo; - -public class WorldType -{ - /** List of world types. */ - public static final WorldType[] worldTypes = new WorldType[16]; - - /** Default world type. */ - public static final WorldType DEFAULT = (new WorldType(0, "default", 1)).setVersioned(); - - /** Flat world type. */ - public static final WorldType FLAT = new WorldType(1, "flat"); - - /** Large Biome world Type. */ - public static final WorldType LARGE_BIOMES = new WorldType(2, "largeBiomes"); - - /** Default (1.1) world type. */ - public static final WorldType DEFAULT_1_1 = (new WorldType(8, "default_1_1", 0)).setCanBeCreated(false); - - /** ID for this world type. */ - private final int worldTypeId; - - /** 'default' or 'flat' */ - private final String worldType; - - /** The int version of the ChunkProvider that generated this world. */ - private final int generatorVersion; - - private boolean isDeco; - - private WorldType parent = this; - - /** - * Whether this world type can be generated. Normally true; set to false for out-of-date generator versions. - */ - private boolean canBeCreated; - - /** Whether this WorldType has a version or not. */ - private boolean isWorldTypeVersioned; - - protected WorldType(int par1, String par2Str) - { - this(par1, par2Str, 0); - } - - private WorldType(int par1, String par2Str, int par3) - { - this.worldType = par2Str; - this.generatorVersion = par3; - this.canBeCreated = true; - this.worldTypeId = par1; - worldTypes[par1] = this; - } - - public String getWorldTypeName() - { - return this.worldType; - } - - /** - * Gets the translation key for the name of this world type. - */ - public String getTranslateName() - { - return "generator." + this.worldType; - } - - /** - * Returns generatorVersion. - */ - public int getGeneratorVersion() - { - return this.generatorVersion; - } - - public WorldType getWorldTypeForGeneratorVersion(int par1) - { - return this == DEFAULT && par1 == 0 ? DEFAULT_1_1 : this; - } - - /** - * Sets canBeCreated to the provided value, and returns this. - */ - public WorldType setCanBeCreated(boolean par1) - { - this.canBeCreated = par1; - return this; - } - - /** - * Gets whether this WorldType can be used to generate a new world. - */ - public boolean getCanBeCreated() - { - return this.canBeCreated; - } - - /** - * Flags this world type as having an associated version. - */ - private WorldType setVersioned() - { - this.isWorldTypeVersioned = true; - return this; - } - - /** - * Returns true if this world Type has a version associated with it. - */ - public boolean isVersioned() - { - return this.isWorldTypeVersioned; - } - - public static WorldType parseWorldType(String par0Str) - { - for (int var1 = 0; var1 < worldTypes.length; ++var1) - { - if (worldTypes[var1] != null && worldTypes[var1].worldType.equalsIgnoreCase(par0Str)) - { - return worldTypes[var1]; - } - } - - return null; - } - - public int getWorldTypeID() - { - return this.worldTypeId; - } - - public WorldChunkManager getChunkManager(World world, String generatorOptions) { - return new WorldChunkManager(world); - } - - public IChunkProvider getChunkProviderOverworld(World world, long seed, boolean mapFeaturesEnabled, String generatorOptions) { - return new ChunkProviderGenerate(world, seed, mapFeaturesEnabled); - } - - public IChunkProvider getChunkProviderNether(World world, long seed, String generatorOptions) { - return new ChunkProviderHell(world, seed); - } - - public IChunkProvider getChunkProviderEnd(World world, long seed) { - return new ChunkProviderEnd(world, seed); - } - - public float getCloudHeight() { - return 128F; - } - - public int getAverageGroundLevel() { - return 64; - } - - public double getHorizon() { - return 63D; - } - - public int[] getStrataLevels() { - return new int[] {48, 24}; - } - - public WorldType setIsDeco() { - this.isDeco = true; - return this; - } - - public boolean isDeco() { - return isDeco; - } - - public boolean hasDeco() { - return false; - } - - public boolean isSky() { - return false; - } - - public boolean isBTA() { - return false; - } - - public boolean hasOceans() { - return true; - } - - public boolean canPerlinBeachesBeToggled() { - return true; - } - - public boolean getDefaultPerlinBeachState() { - return true; - } - - public WorldType getParent() { - return parent; - } - - public WorldType setParent(WorldType parent) { - this.parent = parent; - return this; - } - - public int getColdBiomeSnowLevelModifier(WorldConfigurationInfo generatorInfo) { - return 0; - } -} diff --git a/minecraft_server/betterbiomes/BetterBiomesMod.java b/minecraft_server/betterbiomes/BetterBiomesMod.java deleted file mode 100644 index 009396a..0000000 --- a/minecraft_server/betterbiomes/BetterBiomesMod.java +++ /dev/null @@ -1,51 +0,0 @@ -package betterbiomes; - -import java.util.Set; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterbiomes.entity.BTAEntityCrystalGolem; -import betterterrain.AddonVersion; -import betterterrain.BTAAddon; -import betterterrain.BTAMod; -import betterterrain.BTAVersion; -import betterterrain.DecoIntegration; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.block.BTABlockClay; -import betterterrain.item.BTAItemBloodMossSpores; -import betterterrain.item.BTAItemPileSoulSand; -import net.minecraft.src.Block; -import net.minecraft.src.FCAddOnHandler; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.Item; -import net.minecraft.src.ItemMultiTextureTile; -import net.minecraft.src.MapColor; -import net.minecraft.src.Material; - -public class BetterBiomesMod extends BTAAddon { - private static BetterBiomesMod instance; - - public static final AddonVersion V3_0_0 = new AddonVersion(3, 0, 0, getInstance()); - - private BetterBiomesMod() { - super("Better Biomes", "betterbiomes", "3.0.0", "BB"); - } - - @Override - public void Initialize() { - FCAddOnHandler.LogMessage(this.getName() + " Version " + this.getVersionString() + " Initializing..."); - FCAddOnHandler.LogMessage(this.getName() + " Initialized"); - } - - public static BetterBiomesMod getInstance() { - if (instance == null) { - instance = new BetterBiomesMod(); - } - - return instance; - } - - @Override - public BiomeConfiguration getBiomeConfiguration() { - return BetterBiomesConfiguration.getInstance(); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/AncientForestBiome.java b/minecraft_server/betterbiomes/biome/biomes/AncientForestBiome.java deleted file mode 100644 index 6d4cffb..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/AncientForestBiome.java +++ /dev/null @@ -1,41 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.OldOakGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenBigTree; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenerator; - -public class AncientForestBiome extends BTABiome { - public AncientForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 2; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(7) == 0) { - gen = new OldOakGen(false); - } - else if (rand.nextInt(2) == 0) { - gen = new WorldGenBigTree(false); - } - else { - gen = new WorldGenTrees(false, 6, 0, 0, false); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/AspenGroveBiome.java b/minecraft_server/betterbiomes/biome/biomes/AspenGroveBiome.java deleted file mode 100644 index 16e9e42..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/AspenGroveBiome.java +++ /dev/null @@ -1,31 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.Climate; -import betterterrain.feature.tree.PineTreeGen; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class AspenGroveBiome extends AlpineBiome { - public AspenGroveBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return (WorldGenerator)(par1Random.nextInt(5) == 0 ? new TaigaGen5(false) : new PineTreeGen(false, 2, 2)); - } - - public void decorate(World var1, Random var2, int var3, int var4, WorldConfigurationInfo generatorOptions) - { - super.decorate(var1, var2, var3, var4, generatorOptions); - this.addEmeralds(var1, var2, var3, var4); - this.addSilverfishBlocks(var1, var2, var3, var4); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/AutmnForestBiome.java b/minecraft_server/betterbiomes/biome/biomes/AutmnForestBiome.java deleted file mode 100644 index 17482cb..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/AutmnForestBiome.java +++ /dev/null @@ -1,38 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.AutmnTreeGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenerator; - -public class AutmnForestBiome extends BTABiome { - public AutmnForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 15; - this.btaBiomeDecorator.grassPerChunk = 2; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - int r = rand.nextInt(7); - - if (r == 6) { - gen = this.worldGeneratorForest; - } - else { - gen = new AutmnTreeGen(r % 3); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/BadlandsBiome.java b/minecraft_server/betterbiomes/biome/biomes/BadlandsBiome.java deleted file mode 100644 index 9b4df24..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/BadlandsBiome.java +++ /dev/null @@ -1,82 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Random; - -import betterterrain.BTAVersion; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.World; - -public class BadlandsBiome extends BTABiome { - private ArrayList allowedTerracottaMetadata = new ArrayList(); - - public BadlandsBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - if (DecoIntegration.isDecoInstalled()) { - this.topBlockExt = DecoIntegration.redSand.blockID; - this.fillerBlockExt = DecoIntegration.redSand.blockID; - } - this.btaBiomeDecorator.sandPerChunk = 0; - this.btaBiomeDecorator.sandPerChunk2 = 0; - this.spawnableCreatureList.clear(); - this.btaBiomeDecorator.generateLakes = false; - - this.initMetaList(); - } - - public void decorate(World world, Random rand, int startX, int startZ, WorldConfigurationInfo generatorOptions) - { - super.decorate(world, rand, startX, startZ, generatorOptions); - - if (generatorOptions.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_2_1)) { - for (int i = startX; i < startX + 16; i++) { - for (int j = 50; j < 127; j++) { - int metaForY = Math.abs(Arrays.hashCode(new int[] {(int) world.getSeed() >> 32, j}) % 16); - - for (int k = startZ; k < startZ + 16; k++) { - if (world.getBlockId(i, j, k) == DecoIntegration.terracotta.blockID) { - if (allowedTerracottaMetadata.contains(metaForY)) { - world.setBlockAndMetadata(i, j, k, DecoIntegration.stainedTerracotta.blockID, metaForY); - } - } - } - } - } - } - } - - @Override - public boolean CanLightningStrikeInBiome() - { - return true; - } - - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - public int getBiomeGrassColor() - { - return 9341503; - } - - /** - * Provides the basic foliage color based on the biome temperature and rainfall - */ - public int getBiomeFoliageColor() - { - return 9341503; - } - - private void initMetaList() { - allowedTerracottaMetadata.add(1); - allowedTerracottaMetadata.add(3); - allowedTerracottaMetadata.add(7); - allowedTerracottaMetadata.add(11); - allowedTerracottaMetadata.add(14); - allowedTerracottaMetadata.add(15); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/BadlandsPlateauBiome.java b/minecraft_server/betterbiomes/biome/biomes/BadlandsPlateauBiome.java deleted file mode 100644 index 3c8c6ff..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/BadlandsPlateauBiome.java +++ /dev/null @@ -1,84 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Random; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.BTAVersion; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class BadlandsPlateauBiome extends BTABiome { - private ArrayList allowedTerracottaMetadata = new ArrayList(); - - public BadlandsPlateauBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - if (DecoIntegration.isDecoInstalled()) { - this.topBlockExt = DecoIntegration.terracotta.blockID; - this.fillerBlockExt = DecoIntegration.terracotta.blockID; - } - this.btaBiomeDecorator.sandPerChunk = 0; - this.btaBiomeDecorator.sandPerChunk2 = 0; - this.spawnableCreatureList.clear(); - - this.btaBiomeDecorator.treesPerChunk = 7; - this.btaBiomeDecorator.flowersPerChunk = -999; - this.btaBiomeDecorator.generateLakes = false; - - this.initMetaList(); - } - - public void decorate(World world, Random rand, int startX, int startZ, WorldConfigurationInfo generatorOptions) - { - super.decorate(world, rand, startX, startZ, generatorOptions); - - if (generatorOptions.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_2_1)) { - for (int i = startX; i < startX + 16; i++) { - for (int j = 50; j < 127; j++) { - int metaForY = Math.abs(Arrays.hashCode(new int[] {(int) world.getSeed() >> 32, j}) % 16); - - for (int k = startZ; k < startZ + 16; k++) { - if (world.getBlockId(i, j, k) == DecoIntegration.terracotta.blockID) { - if (allowedTerracottaMetadata.contains(metaForY)) { - world.setBlockAndMetadata(i, j, k, DecoIntegration.stainedTerracotta.blockID, metaForY); - } - } - } - } - } - } - } - - @Override - public boolean shouldConnectWithEdge(WorldConfigurationInfo generatorOptions) { - return true; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - return this.worldGeneratorTrees; - } - - @Override - public boolean CanLightningStrikeInBiome() - { - return true; - } - - private void initMetaList() { - allowedTerracottaMetadata.add(1); - allowedTerracottaMetadata.add(3); - allowedTerracottaMetadata.add(7); - allowedTerracottaMetadata.add(11); - allowedTerracottaMetadata.add(14); - allowedTerracottaMetadata.add(15); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/BadlandsRiverBiome.java b/minecraft_server/betterbiomes/biome/biomes/BadlandsRiverBiome.java deleted file mode 100644 index 0d7c430..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/BadlandsRiverBiome.java +++ /dev/null @@ -1,20 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.DecoIntegration; -import betterterrain.biome.biomes.RiverBiome; - -public class BadlandsRiverBiome extends RiverBiome { - public BadlandsRiverBiome(int id, String internalName) { - super(id, internalName, BetterBiomesConfiguration.badlands.climate); - if (DecoIntegration.isDecoInstalled()) { - this.topBlockExt = DecoIntegration.redSand.blockID; - this.fillerBlockExt = DecoIntegration.redSand.blockID; - } - this.btaBiomeDecorator.sandPerChunk = 0; - this.btaBiomeDecorator.sandPerChunk2 = 0; - this.spawnableCreatureList.clear(); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/BirchForestBiome.java b/minecraft_server/betterbiomes/biome/biomes/BirchForestBiome.java deleted file mode 100644 index f8c4b50..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/BirchForestBiome.java +++ /dev/null @@ -1,26 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenerator; - -public class BirchForestBiome extends BTABiome { - public BirchForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 2; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - return this.worldGeneratorForest; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/BorealForestBiome.java b/minecraft_server/betterbiomes/biome/biomes/BorealForestBiome.java deleted file mode 100644 index 5cce991..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/BorealForestBiome.java +++ /dev/null @@ -1,64 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.SmallShrubGen; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.feature.tree.TaigaGen6; -import betterterrain.feature.tree.TaigaGen7; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenerator; - -public class BorealForestBiome extends BTABiome { - public BorealForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 20; - this.btaBiomeDecorator.grassPerChunk = 2; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(6) == 0) { - gen = new WorldGenTaiga2(false); - } - else if (rand.nextInt(5) == 0) { - gen = new TaigaGen5(false); - } - else if (rand.nextInt(4) == 0) { - gen = new TaigaGen6(false); - } - else if (rand.nextInt(3) == 0) { - gen = new TaigaGen7(false); - } - else if (rand.nextInt(2) == 0){ - gen = new WorldGenShrub(1, 1); - } - else { - gen = new SmallShrubGen(1, 1); - } - - return gen; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/BrushlandBiome.java b/minecraft_server/betterbiomes/biome/biomes/BrushlandBiome.java deleted file mode 100644 index 70d74ea..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/BrushlandBiome.java +++ /dev/null @@ -1,54 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.SmallShrubGen; -import betterterrain.feature.tree.TinyShrubGen; -import net.minecraft.src.Block; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenerator; - -public class BrushlandBiome extends BTABiome { - public BrushlandBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - btaBiomeDecorator.treesPerChunk = 2; - btaBiomeDecorator.grassPerChunk = 5; - btaBiomeDecorator.generateStoneInGrass = true; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(6) == 0) { - gen = new WorldGenTrees(false); - } - else if (rand.nextInt(3) == 0) { - gen = new SmallShrubGen(); - } - else if (rand.nextInt(2) == 0) { - gen = new WorldGenShrub(0, 0); - } - else { - gen = new TinyShrubGen(); - } - - return gen; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(7) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 0) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/ChapparalBiome.java b/minecraft_server/betterbiomes/biome/biomes/ChapparalBiome.java deleted file mode 100644 index 9461d84..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/ChapparalBiome.java +++ /dev/null @@ -1,39 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.SmallShrubGen; -import betterterrain.feature.tree.TinyShrubGen; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenerator; - -public class ChapparalBiome extends BTABiome { - public ChapparalBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - btaBiomeDecorator.treesPerChunk = 8; - btaBiomeDecorator.grassPerChunk = 20; - btaBiomeDecorator.generateStoneInGrass = true; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(3) == 0) { - gen = new SmallShrubGen(); - } - else if (rand.nextInt(2) == 0) { - gen = new WorldGenShrub(0, 0); - } - else { - gen = new TinyShrubGen(); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/CherryForestBiome.java b/minecraft_server/betterbiomes/biome/biomes/CherryForestBiome.java deleted file mode 100644 index b5a2e79..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/CherryForestBiome.java +++ /dev/null @@ -1,51 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.CherryTreeGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenerator; - -public class CherryForestBiome extends BTABiome { - public CherryForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 5; - this.btaBiomeDecorator.flowersPerChunk = 25; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(5) == 0) { - gen = this.worldGeneratorTrees; - } - else if (rand.nextInt(4) == 0) { - gen = this.worldGeneratorForest; - } - else { - gen = new CherryTreeGen(); - } - - return gen; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/ConiferousForestBiome.java b/minecraft_server/betterbiomes/biome/biomes/ConiferousForestBiome.java deleted file mode 100644 index 2b967f6..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/ConiferousForestBiome.java +++ /dev/null @@ -1,48 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.TaigaGen3; -import betterbiomes.feature.tree.TaigaGen4; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.TaigaGen7; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenerator; - -public class ConiferousForestBiome extends BTABiome { - public ConiferousForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 8, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 8; - this.btaBiomeDecorator.grassPerChunk = 10; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(5) == 0) { - gen = new TaigaGen3(false); - } - else if (rand.nextInt(3) == 0) { - gen = new TaigaGen4(false); - } - else { - gen = new TaigaGen7(false); - } - - return gen; - } - - @Override - public WorldGenerator getRandomWorldGenForGrass(Random rand) { - return rand.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/CrystalCavernsBiome.java b/minecraft_server/betterbiomes/biome/biomes/CrystalCavernsBiome.java deleted file mode 100644 index d563395..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/CrystalCavernsBiome.java +++ /dev/null @@ -1,58 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.terrain.AmethystShardsGen; -import betterbiomes.feature.terrain.CrystalGen; -import betterterrain.biome.BTANetherBiome; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.Vec3; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class CrystalCavernsBiome extends BTANetherBiome { - public CrystalCavernsBiome(int id, String internalName) { - super(id, internalName); - - this.topBlockExt = Block.blockNetherQuartz.blockID; - this.fillerBlockExt = Block.blockNetherQuartz.blockID; - - this.spawnableMonsterList.clear(); - //this.spawnableMonsterList.add(new SpawnListEntry(BTAEntityCrystalGolem.class, 1, 1, 4)); - } - - @Override - public Vec3 getFogColor(World world) { - return world.getWorldVec3Pool().getVecFromPool(0.3, 0.2, 0.4); - } - - @Override - public void decorate(World world, Random rand, int chunkX, int chunkZ, WorldConfigurationInfo generatorOptions) { - super.decorate(world, rand, chunkX, chunkZ, generatorOptions); - - WorldGenerator gen; - - //Small amethyst shards - gen= new AmethystShardsGen(); - - for (int i = 0; i < 64; i++) { - int x = chunkX + rand.nextInt(16) + 8; - int y = rand.nextInt(120) + 4; - int z = chunkZ + rand.nextInt(16) + 8; - - gen.generate(world, rand, x, y, z); - } - - //Large amethyst crystals - for (int i = 0; i < 6; i++) { - gen = new CrystalGen(rand.nextInt(4) == 0); - - int x = chunkX + rand.nextInt(16) + 8; - int y = rand.nextInt(100) + 4; - int z = chunkZ + rand.nextInt(16) + 8; - - gen.generate(world, rand, x, y, z); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/DunesBiome.java b/minecraft_server/betterbiomes/biome/biomes/DunesBiome.java deleted file mode 100644 index 0effd43..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/DunesBiome.java +++ /dev/null @@ -1,45 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenDesertWells; - -public class DunesBiome extends BTABiome -{ - public DunesBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.clear(); - this.topBlockExt = (byte)Block.sand.blockID; - this.fillerBlockExt = (byte)Block.sand.blockID; - this.btaBiomeDecorator.treesPerChunk = -999; - this.btaBiomeDecorator.deadBushPerChunk = 2; - this.btaBiomeDecorator.cactiPerChunk = 10; - this.btaBiomeDecorator.generateLakes = false; - } - - public void decorate(World par1World, Random par2Random, int par3, int par4, WorldConfigurationInfo generatorOptions) - { - super.decorate(par1World, par2Random, par3, par4, generatorOptions); - - if (par2Random.nextInt(1000) == 0) - { - int var5 = par3 + par2Random.nextInt(16) + 8; - int var6 = par4 + par2Random.nextInt(16) + 8; - WorldGenDesertWells var7 = new WorldGenDesertWells(); - var7.generate(par1World, par2Random, var5, par1World.getHeightValue(var5, var6) + 1, var6); - } - - this.addEmeralds(par1World, par2Random, par3, par4); - this.addSilverfishBlocks(par1World, par2Random, par3, par4); - } - - public boolean CanLightningStrikeInBiome() - { - return true; - } -} diff --git a/minecraft_server/betterbiomes/biome/biomes/FloralForestBiome.java b/minecraft_server/betterbiomes/biome/biomes/FloralForestBiome.java deleted file mode 100644 index ca8bb0b..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/FloralForestBiome.java +++ /dev/null @@ -1,48 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.MeadowTreeGen1; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.TemperateBirchGen; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenerator; - -public class FloralForestBiome extends BTABiome { - WorldGenerator meadowGen = new MeadowTreeGen1(); - WorldGenerator birchGen = new TemperateBirchGen(); - - public FloralForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 15; - this.btaBiomeDecorator.grassPerChunk = 15; - this.btaBiomeDecorator.flowersPerChunk = 25; - } - - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) { - WorldGenerator gen; - - if (rand.nextInt(10) == 0) { - gen = this.meadowGen; - } - else if (rand.nextInt(4) == 0) { - gen = this.birchGen; - } - else { - gen = this.worldGeneratorTrees; - } - - return gen; - } - - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) { - return par1Random.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/FloralPlateauBiome.java b/minecraft_server/betterbiomes/biome/biomes/FloralPlateauBiome.java deleted file mode 100644 index 4a97620..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/FloralPlateauBiome.java +++ /dev/null @@ -1,43 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.MeadowTreeGen1; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.TemperateBirchGen; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenerator; - -public class FloralPlateauBiome extends BTABiome { - public FloralPlateauBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.grassPerChunk = 15; - this.btaBiomeDecorator.flowersPerChunk = 25; - } - - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) { - WorldGenerator gen; - - if (rand.nextInt(10) == 0) { - gen = new MeadowTreeGen1(); - } - else if (rand.nextInt(4) == 0) { - gen = new TemperateBirchGen(); - } - else { - gen = this.worldGeneratorTrees; - } - - return gen; - } - - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) { - return par1Random.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} diff --git a/minecraft_server/betterbiomes/biome/biomes/FrozenSpringsPondBiome.java b/minecraft_server/betterbiomes/biome/biomes/FrozenSpringsPondBiome.java deleted file mode 100644 index a46bfb2..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/FrozenSpringsPondBiome.java +++ /dev/null @@ -1,37 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.CherryTreeGen; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.WorldGenerator; -import net.minecraft.src.WorldType; - -public class FrozenSpringsPondBiome extends BTABiome { - public FrozenSpringsPondBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 5; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand, WorldConfigurationInfo generatorOptions, WorldType worldType) - { - WorldGenerator gen; - - if (rand.nextInt(5) == 0 && DecoIntegration.isDecoInstalled() && worldType.isDeco()) { - gen = new CherryTreeGen(); - } - else { - gen = this.worldGeneratorForest; - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/FungalForestBiome.java b/minecraft_server/betterbiomes/biome/biomes/FungalForestBiome.java deleted file mode 100644 index 4eb95d6..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/FungalForestBiome.java +++ /dev/null @@ -1,46 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.MassiveOakGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.TallSwampTreeGen; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntityWitch; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenerator; - -public class FungalForestBiome extends BTABiome { - public FungalForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 15; - this.btaBiomeDecorator.grassPerChunk = 2; - this.btaBiomeDecorator.bigRedMushroomsPerChunk = 5; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 1, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityWitch.class, 1, 1, 1)); - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 2, 2)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 2, 2)); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(3) == 0) { - gen = new MassiveOakGen(true); - } - else { - gen = new TallSwampTreeGen(); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/GrasslandsBiome.java b/minecraft_server/betterbiomes/biome/biomes/GrasslandsBiome.java deleted file mode 100644 index 3ab48c1..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/GrasslandsBiome.java +++ /dev/null @@ -1,34 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.OldOakGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.WorldGenBigTree; -import net.minecraft.src.WorldGenerator; - -public class GrasslandsBiome extends BTABiome { - public GrasslandsBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.grassPerChunk = 30; - this.btaBiomeDecorator.flowersPerChunk = 20; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(2) == 0) { - gen = new OldOakGen(false); - } - else { - gen = new WorldGenBigTree(false); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/GrasslandsLakeBiome.java b/minecraft_server/betterbiomes/biome/biomes/GrasslandsLakeBiome.java deleted file mode 100644 index efec846..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/GrasslandsLakeBiome.java +++ /dev/null @@ -1,35 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.OldOakGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.WorldGenBigTree; -import net.minecraft.src.WorldGenerator; - -public class GrasslandsLakeBiome extends BTABiome { - public GrasslandsLakeBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 30; - this.btaBiomeDecorator.flowersPerChunk = 20; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(2) == 0) { - gen = new OldOakGen(false); - } - else { - gen = new WorldGenBigTree(false); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/HeathlandBiome.java b/minecraft_server/betterbiomes/biome/biomes/HeathlandBiome.java deleted file mode 100644 index ee76d47..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/HeathlandBiome.java +++ /dev/null @@ -1,26 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenerator; - -public class HeathlandBiome extends BTABiome { - public HeathlandBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 7; - this.btaBiomeDecorator.grassPerChunk = 30; - this.btaBiomeDecorator.flowersPerChunk = 15; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - return rand.nextInt(3) == 0 ? this.worldGeneratorTrees : new WorldGenShrub(0,0); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/HighlandsBiome.java b/minecraft_server/betterbiomes/biome/biomes/HighlandsBiome.java deleted file mode 100644 index a5bd184..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/HighlandsBiome.java +++ /dev/null @@ -1,35 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenerator; - -public class HighlandsBiome extends BTABiome { - - public HighlandsBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.fractionalTreeChance = 2; - this.btaBiomeDecorator.grassPerChunk = 3; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(4) == 0 ? worldGeneratorTrees : new WorldGenShrub(0, 0); - } - - public void decorate(World var1, Random var2, int var3, int var4, WorldConfigurationInfo generatorOptions) - { - super.decorate(var1, var2, var3, var4, generatorOptions); - this.addEmeralds(var1, var2, var3, var4); - this.addSilverfishBlocks(var1, var2, var3, var4); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/LushDesertBiome.java b/minecraft_server/betterbiomes/biome/biomes/LushDesertBiome.java deleted file mode 100644 index 149e611..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/LushDesertBiome.java +++ /dev/null @@ -1,57 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.PalmTreeSmallGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenDesertWells; -import net.minecraft.src.WorldGenerator; - -public class LushDesertBiome extends BTABiome -{ - public LushDesertBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.clear(); - this.topBlockExt = (byte)Block.sand.blockID; - this.fillerBlockExt = (byte)Block.sand.blockID; - this.btaBiomeDecorator.treesPerChunk = -999; - this.btaBiomeDecorator.deadBushPerChunk = 2; - this.btaBiomeDecorator.reedsPerChunk = 50; - this.btaBiomeDecorator.cactiPerChunk = 10; - this.btaBiomeDecorator.oasesPerChunk = 100; - this.btaBiomeDecorator.waterLakesPerChunk = 100; - this.btaBiomeDecorator.treesPerChunk = 20; - this.btaBiomeDecorator.grassPerChunk = 2; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return new PalmTreeSmallGen(false, false); - } - - public void decorate(World par1World, Random par2Random, int par3, int par4, WorldConfigurationInfo generatorOptions) - { - super.decorate(par1World, par2Random, par3, par4, generatorOptions); - - if (par2Random.nextInt(1000) == 0) - { - int var5 = par3 + par2Random.nextInt(16) + 8; - int var6 = par4 + par2Random.nextInt(16) + 8; - WorldGenDesertWells var7 = new WorldGenDesertWells(); - var7.generate(par1World, par2Random, var5, par1World.getHeightValue(var5, var6) + 1, var6); - } - } - - public boolean CanLightningStrikeInBiome() - { - return true; - } -} diff --git a/minecraft_server/betterbiomes/biome/biomes/MangroveForestBiome.java b/minecraft_server/betterbiomes/biome/biomes/MangroveForestBiome.java deleted file mode 100644 index a8bf168..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/MangroveForestBiome.java +++ /dev/null @@ -1,54 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.MangroveGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenerator; - -public class MangroveForestBiome extends BTABiome { - - public MangroveForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 3; - this.btaBiomeDecorator.flowersPerChunk = -999; - this.btaBiomeDecorator.mushroomsPerChunk = 8; - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.clayPerChunk = 1; - this.btaBiomeDecorator.waterlilyPerChunk = 10; - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) { - return new MangroveGen(); - //return this.worldGeneratorSwamp; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/MeadowBiome.java b/minecraft_server/betterbiomes/biome/biomes/MeadowBiome.java deleted file mode 100644 index c216545..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/MeadowBiome.java +++ /dev/null @@ -1,27 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.MeadowTreeGen1; -import betterbiomes.feature.tree.MeadowTreeGen2; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.WorldGenerator; - -public class MeadowBiome extends BTABiome { - public MeadowBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 1; - this.btaBiomeDecorator.grassPerChunk = 15; - this.btaBiomeDecorator.flowersPerChunk = 30; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(3) == 0 ? new MeadowTreeGen2() : new MeadowTreeGen1(); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/MysticRiverBiome.java b/minecraft_server/betterbiomes/biome/biomes/MysticRiverBiome.java deleted file mode 100644 index 8379988..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/MysticRiverBiome.java +++ /dev/null @@ -1,19 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.biome.biomes.RiverBiome; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntityWitch; -import net.minecraft.src.SpawnListEntry; - -public class MysticRiverBiome extends RiverBiome { - public MysticRiverBiome(int id, String internalName) { - super(id, internalName, BetterBiomesConfiguration.mysticValley.climate); - this.waterColorMultiplier = BetterBiomesConfiguration.mysticValley.waterColorMultiplier; - this.spawnableCreatureList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 1, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityWitch.class, 1, 1, 1)); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/MysticValleyBiome.java b/minecraft_server/betterbiomes/biome/biomes/MysticValleyBiome.java deleted file mode 100644 index a33cad3..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/MysticValleyBiome.java +++ /dev/null @@ -1,90 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.terrain.MysticShardsGen; -import betterbiomes.feature.tree.CherryTreeGen; -import betterbiomes.feature.tree.MassiveOakGen; -import betterbiomes.feature.tree.MysticTreeGen; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.TaigaGen6; -import betterterrain.feature.tree.TallSwampTreeGen; -import betterterrain.feature.tree.TemperateBirchGen; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntityWitch; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class MysticValleyBiome extends BTABiome { - public MysticValleyBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - waterColorMultiplier = 0xa78cff; - this.btaBiomeDecorator.treesPerChunk = 15; - this.btaBiomeDecorator.grassPerChunk = 20; - this.btaBiomeDecorator.flowersPerChunk = 30; - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 1, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityWitch.class, 1, 1, 1)); - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 2, 2)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 2, 2)); - } - - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand, WorldConfigurationInfo generatorOptions) { - WorldGenerator gen; - - if (rand.nextInt(10) == 0) { - gen = new MassiveOakGen(false); - } - else if (DecoIntegration.isDecoInstalled() && rand.nextInt(8) == 0) { - gen = new CherryTreeGen(); - } - else if (rand.nextInt(8) == 0) { - gen = new TallSwampTreeGen(); - } - else if (rand.nextInt(6) == 0) { - gen = new TemperateBirchGen(); - } - else if (rand.nextInt(6) == 0) { - gen = new TaigaGen6(false); - } - else { - gen = new MysticTreeGen(false); - } - - return gen; - } - - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) { - return par1Random.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } - - @Override - public void decorate(World world, Random rand, int chunkX, int chunkZ, WorldConfigurationInfo generatorOptions) { - super.decorate(world, rand, chunkX, chunkZ, generatorOptions); - - if (DecoIntegration.isDecoInstalled()) { - WorldGenerator gen; - - //Small amethyst shards - gen = new MysticShardsGen(); - - if (rand.nextInt(3) == 0) { - int x = chunkX + rand.nextInt(16) + 8; - int z = chunkZ + rand.nextInt(16) + 8; - int y = world.getTopSolidOrLiquidBlock(x, z); - - gen.generate(world, rand, x, y, z); - } - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/OasisBiome.java b/minecraft_server/betterbiomes/biome/biomes/OasisBiome.java deleted file mode 100644 index fdec34c..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/OasisBiome.java +++ /dev/null @@ -1,33 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.PalmTreeSmallGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.WorldGenerator; - -public class OasisBiome extends BTABiome { - public OasisBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 2; - this.btaBiomeDecorator.sandPerChunk = 0; - this.btaBiomeDecorator.sandPerChunk2 = 0; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return new PalmTreeSmallGen(false, false); - } - - @Override - public boolean CanLightningStrikeInBiome() - { - return true; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/OrchardBiome.java b/minecraft_server/betterbiomes/biome/biomes/OrchardBiome.java deleted file mode 100644 index 89ff5ab..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/OrchardBiome.java +++ /dev/null @@ -1,47 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.OldOakGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.WorldGenBigTree; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenerator; - -public class OrchardBiome extends BTABiome { - public OrchardBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 3; - this.btaBiomeDecorator.grassPerChunk = 30; - this.btaBiomeDecorator.flowersPerChunk = 20; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(20) == 0) { - gen = new OldOakGen(false); - } - else if (rand.nextInt(2) == 0) { - gen = new WorldGenBigTree(false); - } - else { - gen = new WorldGenTrees(false, 6, 0, 0, false); - } - - return gen; - } - - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - public int getBiomeGrassColor() - { - return 13236061; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/OrchardRiverBiome.java b/minecraft_server/betterbiomes/biome/biomes/OrchardRiverBiome.java deleted file mode 100644 index fa13b62..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/OrchardRiverBiome.java +++ /dev/null @@ -1,10 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.biome.biomes.RiverBiome; - -public class OrchardRiverBiome extends RiverBiome { - public OrchardRiverBiome(int id, String internalName) { - super(id, internalName, BetterBiomesConfiguration.orchard.climate); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/OutbackRiverBiome.java b/minecraft_server/betterbiomes/biome/biomes/OutbackRiverBiome.java deleted file mode 100644 index 21ebf75..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/OutbackRiverBiome.java +++ /dev/null @@ -1,23 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.DecoIntegration; -import betterterrain.biome.biomes.RiverBiome; - -public class OutbackRiverBiome extends RiverBiome { - public OutbackRiverBiome(int id, String internalName) { - super(id, internalName, BetterBiomesConfiguration.outback.climate); - this.spawnableCreatureList.clear(); - if (DecoIntegration.isDecoInstalled()) { - this.topBlockExt = DecoIntegration.redSand.blockID; - this.fillerBlockExt = DecoIntegration.redSand.blockID; - } - this.btaBiomeDecorator.sandPerChunk = 0; - this.btaBiomeDecorator.sandPerChunk2 = 0; - } - - public boolean CanLightningStrikeInBiome() - { - return true; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/PatagoniaMountainBiome.java b/minecraft_server/betterbiomes/biome/biomes/PatagoniaMountainBiome.java deleted file mode 100644 index 926f047..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/PatagoniaMountainBiome.java +++ /dev/null @@ -1,31 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.Block; -import net.minecraft.src.World; - -public class PatagoniaMountainBiome extends BTABiome { - public PatagoniaMountainBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.topBlockExt = Block.stone.blockID; - this.fillerBlockExt = Block.stone.blockID; - } - - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - public int getBiomeGrassColor() - { - return 15064968; - } - - public void decorate(World var1, Random var2, int var3, int var4) - { - super.decorate(var1, var2, var3, var4); - this.addEmeralds(var1, var2, var3, var4); - this.addSilverfishBlocks(var1, var2, var3, var4); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/PatagoniaRiverBiome.java b/minecraft_server/betterbiomes/biome/biomes/PatagoniaRiverBiome.java deleted file mode 100644 index d4035fb..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/PatagoniaRiverBiome.java +++ /dev/null @@ -1,10 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.biome.biomes.RiverBiome; - -public class PatagoniaRiverBiome extends RiverBiome { - public PatagoniaRiverBiome(int id, String internalName) { - super(id, internalName, BetterBiomesConfiguration.patagonia.climate); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/PetrifiedForestBiome.java b/minecraft_server/betterbiomes/biome/biomes/PetrifiedForestBiome.java deleted file mode 100644 index b7220fc..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/PetrifiedForestBiome.java +++ /dev/null @@ -1,18 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.PetrifiedTreeGen; -import betterterrain.biome.BTANetherBiome; -import net.minecraft.src.WorldGenerator; - -public class PetrifiedForestBiome extends BTANetherBiome { - public PetrifiedForestBiome(int id, String internalName) { - super(id, internalName); - this.btaBiomeDecorator.fractionalTreeChance = 10; - } - - public WorldGenerator getRandomWorldGenForTrees(Random rand) { - return new PetrifiedTreeGen(false); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/RainforestBiome.java b/minecraft_server/betterbiomes/biome/biomes/RainforestBiome.java deleted file mode 100644 index a012581..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/RainforestBiome.java +++ /dev/null @@ -1,88 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.RainforestGen1; -import betterbiomes.feature.tree.RainforestGen2; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenVines; -import net.minecraft.src.WorldGenerator; - -public class RainforestBiome extends BTABiome { - - public RainforestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 25; - this.btaBiomeDecorator.grassPerChunk = 7; - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.waterColorMultiplier = 6160128; - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(10) == 0) { - gen = new RainforestGen2(); - } - else if (rand.nextInt(5) == 0) { - gen = new WorldGenTrees(false, 4 + rand.nextInt(7), 3, 3, true); - } - else if (rand.nextInt(2) == 0) { - gen = new RainforestGen1(true); - } - else { - gen = new WorldGenShrub(3, 3); - } - - return gen; - } - - public void decorate(World par1World, Random par2Random, int par3, int par4, WorldConfigurationInfo generatorOptions) - { - super.decorate(par1World, par2Random, par3, par4, generatorOptions); - WorldGenVines var5 = new WorldGenVines(); - - for (int var6 = 0; var6 < 50; ++var6) - { - int var7 = par3 + par2Random.nextInt(16) + 8; - byte var8 = 64; - int var9 = par4 + par2Random.nextInt(16) + 8; - var5.generate(par1World, par2Random, var7, var8, var9); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/RainforestEdgeBiome.java b/minecraft_server/betterbiomes/biome/biomes/RainforestEdgeBiome.java deleted file mode 100644 index 1e0583f..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/RainforestEdgeBiome.java +++ /dev/null @@ -1,88 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.RainforestGen1; -import betterbiomes.feature.tree.RainforestGen2; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenVines; -import net.minecraft.src.WorldGenerator; - -public class RainforestEdgeBiome extends BTABiome { - - public RainforestEdgeBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 5; - this.btaBiomeDecorator.grassPerChunk = 7; - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.waterColorMultiplier = 6160128; - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(10) == 0) { - gen = new RainforestGen2(); - } - else if (rand.nextInt(5) == 0) { - gen = new WorldGenTrees(false, 4 + rand.nextInt(7), 3, 3, true); - } - else if (rand.nextInt(2) == 0) { - gen = new RainforestGen1(true); - } - else { - gen = new WorldGenShrub(3, 3); - } - - return gen; - } - - public void decorate(World par1World, Random par2Random, int par3, int par4, WorldConfigurationInfo generatorOptions) - { - super.decorate(par1World, par2Random, par3, par4, generatorOptions); - WorldGenVines var5 = new WorldGenVines(); - - for (int var6 = 0; var6 < 50; ++var6) - { - int var7 = par3 + par2Random.nextInt(16) + 8; - byte var8 = 64; - int var9 = par4 + par2Random.nextInt(16) + 8; - var5.generate(par1World, par2Random, var7, var8, var9); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/RainforestRiverBiome.java b/minecraft_server/betterbiomes/biome/biomes/RainforestRiverBiome.java deleted file mode 100644 index 23db760..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/RainforestRiverBiome.java +++ /dev/null @@ -1,31 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.biome.biomes.RiverBiome; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; - -public class RainforestRiverBiome extends RiverBiome { - public RainforestRiverBiome(int id, String internalName) { - super(id, internalName, BetterBiomesConfiguration.rainforest.climate); - this.waterColorMultiplier = BetterBiomesConfiguration.rainforest.waterColorMultiplier; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.spawnableCreatureList.clear(); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/RedSandBeachBiome.java b/minecraft_server/betterbiomes/biome/biomes/RedSandBeachBiome.java deleted file mode 100644 index 950c4bd..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/RedSandBeachBiome.java +++ /dev/null @@ -1,29 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.Block; - -public class RedSandBeachBiome extends BTABiome -{ - public RedSandBeachBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.clear(); - this.topBlock = (byte)Block.sand.blockID; - this.fillerBlock = (byte)Block.sand.blockID; - this.btaBiomeDecorator.treesPerChunk = -999; - this.btaBiomeDecorator.deadBushPerChunk = 0; - this.btaBiomeDecorator.reedsPerChunk = 0; - this.btaBiomeDecorator.cactiPerChunk = 0; - if (DecoIntegration.isDecoInstalled()) { - this.topBlockExt = DecoIntegration.redSand.blockID; - this.fillerBlockExt = DecoIntegration.redSand.blockID; - } - } - - public boolean CanLightningStrikeInBiome() - { - return true; - } -} diff --git a/minecraft_server/betterbiomes/biome/biomes/ShieldBiome.java b/minecraft_server/betterbiomes/biome/biomes/ShieldBiome.java deleted file mode 100644 index 7316414..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/ShieldBiome.java +++ /dev/null @@ -1,53 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterbiomes.feature.tree.TaigaGen4; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.TaigaGen6; -import betterterrain.feature.tree.TaigaGen7; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenerator; - -public class ShieldBiome extends BTABiome { - public ShieldBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 7; - this.btaBiomeDecorator.grassPerChunk = 2; - this.btaBiomeDecorator.generateStoneInGrass = true; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(4) == 0) { - gen = new TaigaGen4(false); - } - else if (rand.nextInt(3) == 0) { - gen = new TaigaGen7(false); - } - else { - gen = new TaigaGen6(false); - } - - return gen; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/SoulSandValleyBiome.java b/minecraft_server/betterbiomes/biome/biomes/SoulSandValleyBiome.java deleted file mode 100644 index f0bdc8c..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/SoulSandValleyBiome.java +++ /dev/null @@ -1,31 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterterrain.biome.BTANetherBiome; -import betterterrain.biome.Climate; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityGhast; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.Vec3; -import net.minecraft.src.World; - -public class SoulSandValleyBiome extends BTANetherBiome { - public SoulSandValleyBiome(int id, String internalName) { - super(id, internalName); - - this.topBlockExt = Block.slowSand.blockID; - this.fillerBlockExt = Block.slowSand.blockID; - - this.spawnableMonsterList.clear(); - this.spawnableCreatureList.clear(); - this.spawnableWaterCreatureList.clear(); - this.spawnableCaveCreatureList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityGhast.class, 50, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 50, 4, 4)); - } - - @Override - public Vec3 getFogColor(World world) { - return world.getWorldVec3Pool().getVecFromPool(0.1, 0.4, 0.5); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/SteppeBiome.java b/minecraft_server/betterbiomes/biome/biomes/SteppeBiome.java deleted file mode 100644 index ba51643..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/SteppeBiome.java +++ /dev/null @@ -1,14 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; - -public class SteppeBiome extends BTABiome { - public SteppeBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - btaBiomeDecorator.treesPerChunk = -999; - btaBiomeDecorator.grassPerChunk = 25; - btaBiomeDecorator.steppePerChunk = 20; - btaBiomeDecorator.cactiPerChunk = 50; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/TemperateForestBiome.java b/minecraft_server/betterbiomes/biome/biomes/TemperateForestBiome.java deleted file mode 100644 index 9eb55d3..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/TemperateForestBiome.java +++ /dev/null @@ -1,46 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.TaigaGen6; -import betterterrain.feature.tree.TemperateBirchGen; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenerator; - -public class TemperateForestBiome extends BTABiome { - public TemperateForestBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.treesPerChunk = 30; - this.btaBiomeDecorator.grassPerChunk = 5; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(4) == 0) { - gen = new WorldGenTrees(false, 6, 0, 0, false); - } - else if (rand.nextInt(4) == 0) { - gen = new WorldGenShrub(0, 0); - } - else if (rand.nextInt(3) == 0) { - gen = new TemperateBirchGen(); - } - else { - gen = new TaigaGen6(false); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/TropicsRiverBiome.java b/minecraft_server/betterbiomes/biome/biomes/TropicsRiverBiome.java deleted file mode 100644 index 5fe8a50..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/TropicsRiverBiome.java +++ /dev/null @@ -1,30 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.biome.biomes.RiverBiome; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; - -public class TropicsRiverBiome extends RiverBiome { - public TropicsRiverBiome(int id, String internalName) { - super(id, internalName, BetterBiomesConfiguration.tropics.climate); - this.waterColorMultiplier = BetterBiomesConfiguration.tropics.waterColorMultiplier; - this.spawnableCreatureList.clear(); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/ValleyBiome.java b/minecraft_server/betterbiomes/biome/biomes/ValleyBiome.java deleted file mode 100644 index 78a61d4..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/ValleyBiome.java +++ /dev/null @@ -1,20 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.Climate; -import betterterrain.biome.biomes.WoodsBiome; -import net.minecraft.src.World; - -public class ValleyBiome extends WoodsBiome { - public ValleyBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - } - - public void decorate(World var1, Random var2, int var3, int var4) - { - super.decorate(var1, var2, var3, var4); - this.addEmeralds(var1, var2, var3, var4); - this.addSilverfishBlocks(var1, var2, var3, var4); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/VolcanicJungle.java b/minecraft_server/betterbiomes/biome/biomes/VolcanicJungle.java deleted file mode 100644 index 5de6982..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/VolcanicJungle.java +++ /dev/null @@ -1,92 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenHugeTrees; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenVines; -import net.minecraft.src.WorldGenerator; - -public class VolcanicJungle extends BTABiome -{ - public VolcanicJungle(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 15; - this.btaBiomeDecorator.grassPerChunk = 50; - this.btaBiomeDecorator.flowersPerChunk = 10; - this.btaBiomeDecorator.sandPerChunk = 0; - this.btaBiomeDecorator.sandPerChunk2 = 0; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - this.waterColorMultiplier = 65396; - } - - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) { - WorldGenerator gen; - - if (rand.nextInt(7) == 0) { - gen = this.worldGeneratorBigTree; - } - else if (rand.nextInt(5) == 0) { - gen = new WorldGenHugeTrees(false, 10 + rand.nextInt(20), 3, 3); - } - else if (rand.nextInt(6) == 0) { - gen = new WorldGenShrub(3, 3); - } - else { - gen = new WorldGenTrees(false, 4 + rand.nextInt(7), 3, 3, true); - } - - return gen; - } - - @Override - public WorldGenerator getRandomWorldGenForGrass(Random rand) { - return rand.nextInt(4) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } - - public void decorate(World par1World, Random par2Random, int par3, int par4, WorldConfigurationInfo generatorOptions) - { - super.decorate(par1World, par2Random, par3, par4, generatorOptions); - WorldGenVines var5 = new WorldGenVines(); - - for (int var6 = 0; var6 < 50; ++var6) - { - int var7 = par3 + par2Random.nextInt(16) + 8; - byte var8 = 64; - int var9 = par4 + par2Random.nextInt(16) + 8; - var5.generate(par1World, par2Random, var7, var8, var9); - } - } -} diff --git a/minecraft_server/betterbiomes/biome/biomes/WetlandsRiverBiome.java b/minecraft_server/betterbiomes/biome/biomes/WetlandsRiverBiome.java deleted file mode 100644 index b81bf58..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/WetlandsRiverBiome.java +++ /dev/null @@ -1,18 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.biome.biomes.RiverBiome; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntityWitch; -import net.minecraft.src.SpawnListEntry; - -public class WetlandsRiverBiome extends RiverBiome { - public WetlandsRiverBiome(int id, String internalName) { - super(id, internalName, BetterBiomesConfiguration.wetlands.climate); - this.waterColorMultiplier = BetterBiomesConfiguration.wetlands.waterColorMultiplier; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.spawnableCreatureList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 1, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityWitch.class, 1, 1, 1)); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/WillowGroveBiome.java b/minecraft_server/betterbiomes/biome/biomes/WillowGroveBiome.java deleted file mode 100644 index f645732..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/WillowGroveBiome.java +++ /dev/null @@ -1,41 +0,0 @@ -package betterbiomes.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.WillowGen; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntityWitch; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenerator; - -public class WillowGroveBiome extends BTABiome { - - public WillowGroveBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 7; - this.btaBiomeDecorator.flowersPerChunk = -999; - this.btaBiomeDecorator.deadBushPerChunk = 1; - this.btaBiomeDecorator.mushroomsPerChunk = 8; - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.clayPerChunk = 1; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 1, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityWitch.class, 1, 1, 1)); - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 2, 2)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 2, 2)); - this.waterColorMultiplier = 3653595; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - return new WillowGen(); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/WillowRiverBiome.java b/minecraft_server/betterbiomes/biome/biomes/WillowRiverBiome.java deleted file mode 100644 index bfdd813..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/WillowRiverBiome.java +++ /dev/null @@ -1,18 +0,0 @@ -package betterbiomes.biome.biomes; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.biome.biomes.RiverBiome; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntityWitch; -import net.minecraft.src.SpawnListEntry; - -public class WillowRiverBiome extends RiverBiome { - public WillowRiverBiome(int id, String internalName) { - super(id, internalName, BetterBiomesConfiguration.willowGrove.climate); - this.waterColorMultiplier = BetterBiomesConfiguration.willowGrove.waterColorMultiplier; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.spawnableCreatureList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 1, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityWitch.class, 1, 1, 1)); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/deprecated/HeathlandWoodsBiome.java b/minecraft_server/betterbiomes/biome/biomes/deprecated/HeathlandWoodsBiome.java deleted file mode 100644 index 8efc0b3..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/deprecated/HeathlandWoodsBiome.java +++ /dev/null @@ -1,26 +0,0 @@ -package betterbiomes.biome.biomes.deprecated; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenerator; - -public class HeathlandWoodsBiome extends BTABiome { - public HeathlandWoodsBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 12; - this.btaBiomeDecorator.grassPerChunk = 15; - this.btaBiomeDecorator.flowersPerChunk = 30; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - return new WorldGenTaiga2(false); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/deprecated/OldValleyBiome.java b/minecraft_server/betterbiomes/biome/biomes/deprecated/OldValleyBiome.java deleted file mode 100644 index 6600f5d..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/deprecated/OldValleyBiome.java +++ /dev/null @@ -1,23 +0,0 @@ -package betterbiomes.biome.biomes.deprecated; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.WorldGenerator; - -public class OldValleyBiome extends BTABiome { - public OldValleyBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 4; - this.btaBiomeDecorator.grassPerChunk = 4; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - return this.worldGeneratorTrees; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/deprecated/OrchardClearingBiome.java b/minecraft_server/betterbiomes/biome/biomes/deprecated/OrchardClearingBiome.java deleted file mode 100644 index af77e5e..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/deprecated/OrchardClearingBiome.java +++ /dev/null @@ -1,33 +0,0 @@ -package betterbiomes.biome.biomes.deprecated; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenerator; - -public class OrchardClearingBiome extends BTABiome { - public OrchardClearingBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 3; - this.btaBiomeDecorator.grassPerChunk = 30; - this.btaBiomeDecorator.flowersPerChunk = 30; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - return new WorldGenTrees(false, 6, 0, 0, false); - } - - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - public int getBiomeGrassColor() - { - return 13236061; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/deprecated/SavannaBushesBiome.java b/minecraft_server/betterbiomes/biome/biomes/deprecated/SavannaBushesBiome.java deleted file mode 100644 index 0b3cca6..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/deprecated/SavannaBushesBiome.java +++ /dev/null @@ -1,27 +0,0 @@ -package betterbiomes.biome.biomes.deprecated; - -import java.util.Random; - -import betterbiomes.feature.tree.AcaciaGen; -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenerator; - -public class SavannaBushesBiome extends BTABiome { - - public SavannaBushesBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 25; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - return rand.nextInt(8) == 0 ? new AcaciaGen(false) : new WorldGenShrub(0,0); - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/biome/biomes/deprecated/WoodedSteppeBiome.java b/minecraft_server/betterbiomes/biome/biomes/deprecated/WoodedSteppeBiome.java deleted file mode 100644 index b3c3097..0000000 --- a/minecraft_server/betterbiomes/biome/biomes/deprecated/WoodedSteppeBiome.java +++ /dev/null @@ -1,37 +0,0 @@ -package betterbiomes.biome.biomes.deprecated; - -import java.util.Random; - -import betterbiomes.biome.biomes.SteppeBiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.SmallShrubGen; -import betterterrain.feature.tree.TinyShrubGen; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenerator; - -public class WoodedSteppeBiome extends SteppeBiome { - public WoodedSteppeBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - btaBiomeDecorator.treesPerChunk = 15; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(3) == 0) { - gen = new SmallShrubGen(); - } - else if (rand.nextInt(10) == 0) { - gen = new WorldGenShrub(0, 0); - } - else { - gen = new TinyShrubGen(); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/entity/BTAEntityCrystalGolem.java b/minecraft_server/betterbiomes/entity/BTAEntityCrystalGolem.java deleted file mode 100644 index ad1a70c..0000000 --- a/minecraft_server/betterbiomes/entity/BTAEntityCrystalGolem.java +++ /dev/null @@ -1,23 +0,0 @@ -package betterbiomes.entity; - -import net.minecraft.src.EntityAIAttackOnCollide; -import net.minecraft.src.EntityAINearestAttackableTarget; -import net.minecraft.src.EntityMob; -import net.minecraft.src.EntityPlayer; -import net.minecraft.src.FCEntityAIWanderSimple; -import net.minecraft.src.World; - -public class BTAEntityCrystalGolem extends EntityMob { - public BTAEntityCrystalGolem(World world) { - super(world); - this.texture = "/bta/crystalGolem.png"; - this.tasks.addTask(1, new FCEntityAIWanderSimple(this, this.moveSpeed)); - this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false)); - this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, true)); - } - - @Override - public int getMaxHealth() { - return 30; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/entity/BTAEntityWraith.java b/minecraft_server/betterbiomes/entity/BTAEntityWraith.java deleted file mode 100644 index fcbb8ad..0000000 --- a/minecraft_server/betterbiomes/entity/BTAEntityWraith.java +++ /dev/null @@ -1,19 +0,0 @@ -package betterbiomes.entity; - -import net.minecraft.src.EntityFlying; -import net.minecraft.src.World; - -public class BTAEntityWraith extends EntityFlying { - - public BTAEntityWraith(World par1World) { - super(par1World); - // TODO Auto-generated constructor stub - } - - @Override - public int getMaxHealth() { - // TODO Auto-generated method stub - return 0; - } - -} diff --git a/minecraft_server/betterbiomes/feature/terrain/AmethystShardsGen.java b/minecraft_server/betterbiomes/feature/terrain/AmethystShardsGen.java deleted file mode 100644 index 64cdcce..0000000 --- a/minecraft_server/betterbiomes/feature/terrain/AmethystShardsGen.java +++ /dev/null @@ -1,42 +0,0 @@ -package betterbiomes.feature.terrain; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.DecoUtilsBlock; -import net.minecraft.src.FCUtilsBlockPos; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class AmethystShardsGen extends WorldGenerator { - @Override - public boolean generate(World world, Random rand, int x, int y, int z) { - for (int count = 0; count < 64; count++) { - int i = x + rand.nextInt(8) - rand.nextInt(8); - int j = y + rand.nextInt(8) - rand.nextInt(8); - int k = z + rand.nextInt(8) - rand.nextInt(8); - - if (world.isAirBlock(i, j, k)) { - ArrayList validOrientations = new ArrayList(0); - - for (int dir = 0; dir < 6; dir++) { - FCUtilsBlockPos pos = new FCUtilsBlockPos(i, j, k, DecoUtilsBlock.getOppositeFacing(dir)); - - if (world.getBlockId(pos.i, pos.j, pos.k) == DecoIntegration.amethyst.blockID) { - validOrientations.add(dir); - } - } - - if (validOrientations.size() > 0) { - int meta = validOrientations.get(rand.nextInt(validOrientations.size())); - world.setBlock(i, j, k, DecoIntegration.amethystShardBlock.blockID, meta, 2); - } - } - } - - return true; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/feature/terrain/CrystalGen.java b/minecraft_server/betterbiomes/feature/terrain/CrystalGen.java deleted file mode 100644 index a2b45a2..0000000 --- a/minecraft_server/betterbiomes/feature/terrain/CrystalGen.java +++ /dev/null @@ -1,101 +0,0 @@ -package betterbiomes.feature.terrain; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class CrystalGen extends WorldGenerator { - private boolean useGlowstone; - - public CrystalGen(boolean useGlowstone) { - this.useGlowstone = useGlowstone; - } - - @Override - public boolean generate(World world, Random rand, int x, int y, int z) { - if (world.getBlockId(x, y, z) != 0) { - return false; - } - else { - int dir = rand.nextBoolean() ? 1 : -1; - - while(world.getBlockId(x, y, z) == 0 || doesCrystalIgnoreBlock(world.getBlockId(x, y, z))) { - y -= dir; - } - y += dir; - - double radius = rand.nextInt(4) + 2; - - for (int i = (int) -radius; i <= radius; i++) { - for (int k = (int) -radius; k <= radius; k++) { - if (i * i + k * k <= radius * radius && doesCrystalIgnoreBlock(world.getBlockId(x + i, y - dir, z + k))) { - return false; - } - } - } - - int heightScale = rand.nextInt(4) + 6; - double xAngle = 0; - double zAngle = 0; - - double dx = x; - double dy = y; - double dz = z; - - while (xAngle == 0 && zAngle == 0) { - xAngle = rand.nextInt(5) - 2; - zAngle = rand.nextInt(5) - 2; - - xAngle /= 2; - zAngle /= 2; - } - - for (; radius >= 0; radius--) { - if (radius < 1) - heightScale = 1; - - boolean halfRadius = false; - - for (int height = 0; height < heightScale; height++) { - //if (height > heightScale / 2D && !halfRadius && (radius <= 2 || xAngle == 0 || zAngle == 0)) { - // radius -= 0.5; - // halfRadius = true; - //} - radius -= 1D/heightScale; - - double radiusSq = radius < 2 ? (radius - 0.25) * (radius - 0.25) : radius * radius; - - for (int i = (int) -radius; i <= radius; i++) { - for (int k = (int) -radius; k <= radius; k++) { - if (i * i + k * k <= radiusSq) { - if (rand.nextInt(2) == 0 && useGlowstone) { - world.setBlock((int) dx + i, (int) dy, (int) dz + k, Block.glowStone.blockID, 0, 2); - } - else { - world.setBlock((int) dx + i, (int) dy, (int) dz + k, DecoIntegration.amethyst.blockID, 0, 2); - } - } - } - } - - dy += dir; - dx += xAngle; - dz += zAngle; - - if (dy > 125 || dy < 5) { - return true; - } - } - } - - return true; - } - } - - public boolean doesCrystalIgnoreBlock(int blockID) { - return blockID == 0 || blockID == Block.lavaStill.blockID || blockID == DecoIntegration.amethystShardBlock.blockID; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/feature/tree/AcaciaGen.java b/minecraft_server/betterbiomes/feature/tree/AcaciaGen.java deleted file mode 100644 index 2c61475..0000000 --- a/minecraft_server/betterbiomes/feature/tree/AcaciaGen.java +++ /dev/null @@ -1,230 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class AcaciaGen extends WorldGenerator -{ - /** The minimum height of a generated tree. */ - private final int minTreeHeight; - - /** True if this tree should grow Vines. */ - private final boolean vinesGrow; - - /** The metadata value of the wood to use in tree generation. */ - private final int metaWood; - - /** The metadata value of the leaves to use in tree generation. */ - private final int metaLeaves; - - public AcaciaGen(boolean par1) - { - this(par1, 4, 0, 0, false); - } - - public AcaciaGen(boolean par1, int par2, int par3, int par4, boolean par5) - { - super(par1); - minTreeHeight = par2; - metaWood = par3; - metaLeaves = par4; - vinesGrow = par5; - } - - @Override - public boolean generate(World par1World, Random par2Random, int x, int y, int z) { - if (!par1World.provider.terrainType.isDeco()) { - return this.generateOak(par1World, par2Random, x, y, z); - } - else { - return this.generateAcacia(par1World, par2Random, x, y, z); - } - } - - public boolean generateOak(World par1World, Random par2Random, int x, int y, int z) - { - int var5 = par1World.getBlockId(x, y - 1, z); - if (var5 != Block.grass.blockID) - return false; - int rand = 4 + par2Random.nextInt(3); - for(int i = 0; i < rand; i++) { par1World.setBlock(x, y + i, z, Block.wood.blockID); } - - par1World.setBlockMetadataWithClient(x, y, z, metaWood | 12); // place stump - - if(par2Random.nextInt(4) == 0) { //branch1 - par1World.setBlock(x + 0, y + rand + 1, z + 1, Block.wood.blockID); - par1World.setBlock(x + 1, y + rand + 2, z + 2, Block.wood.blockID); - createOakLeaves(par1World, par2Random, x + 1, y + rand + 2, z + 2, 3); - createOakLeaves(par1World, par2Random, x + 1, y + rand + 3, z + 2, 2); - } - - if(par2Random.nextInt(4) == 0) { //branch2 - par1World.setBlock(x + 1, y + rand + 0, z + 0, Block.wood.blockID); - par1World.setBlock(x + 2, y + rand + 1, z + 0, Block.wood.blockID); - par1World.setBlock(x + 3, y + rand + 2, z - 1, Block.wood.blockID); - createOakLeaves(par1World, par2Random, x + 3, y + rand + 3, z - 1, 3); - createOakLeaves(par1World, par2Random, x + 3, y + rand + 4, z - 1, 2); - } - - if(par2Random.nextInt(4) == 0) { //branch3 - par1World.setBlock(x - 1, y + rand + 0, z + 0, Block.wood.blockID); - par1World.setBlock(x - 2, y + rand + 1, z + 0, Block.wood.blockID); - par1World.setBlock(x - 3, y + rand + 2, z - 1, Block.wood.blockID); - par1World.setBlock(x - 4, y + rand + 3, z - 2, Block.wood.blockID); - createOakLeaves(par1World, par2Random, x - 4, y + rand + 4, z - 2, 3); - createOakLeaves(par1World, par2Random, x - 4, y + rand + 5, z - 2, 2); - } - - if(par2Random.nextInt(4) == 0) { //branch4 - par1World.setBlock(x + 0, y + rand + 0, z - 1, Block.wood.blockID); - par1World.setBlock(x + 1, y + rand + 1, z - 2, Block.wood.blockID); - par1World.setBlock(x + 2, y + rand + 2, z - 2, Block.wood.blockID); - par1World.setBlock(x + 3, y + rand + 3, z - 2, Block.wood.blockID); - createOakLeaves(par1World, par2Random, x + 3, y + rand + 3, z - 2, 3); - createOakLeaves(par1World, par2Random, x + 3, y + rand + 4, z - 2, 2); - } - - if(par2Random.nextInt(4) == 0) { //branch5 - par1World.setBlock(x + 0, y + rand + 0, z - 1, Block.wood.blockID); - par1World.setBlock(x + 0, y + rand + 0, z - 2, Block.wood.blockID); - par1World.setBlock(x + 1, y + rand + 1, z - 3, Block.wood.blockID); - createOakLeaves(par1World, par2Random, x + 1, y + rand + 1, z - 3, 3); - createOakLeaves(par1World, par2Random, x + 1, y + rand + 2, z - 3, 2); - } - - //branch6 - par1World.setBlock(x - 0, y + rand + 0, z + 0, Block.wood.blockID); - par1World.setBlock(x - 0, y + rand + 1, z + 0, Block.wood.blockID); - par1World.setBlock(x - 0, y + rand + 2, z - 0, Block.wood.blockID); - createOakLeaves(par1World, par2Random, x + 0, y + rand + 3, z - 0, 3); - createOakLeaves(par1World, par2Random, x + 0, y + rand + 4, z - 0, 2); - - return true; - } - - private void createOakLeaves(World par1World, Random par2Random, int x, int y, int z, int size) - { - for(int x1 = -size + x; x1 < size + 1 + x; x1++) - { - for(int z1 = -size + z; z1 < size + 1 + z; z1++) - { - int var5 = par1World.getBlockId(x1, y, z1); - if (var5 == 0) - { - if(x1 == -size + x && z1 == -size + z ){} else if(x1 == -size + x && z1 == size + z ){} else if(x1 == size + x && z1 == -size + z ){} else if(x1 == size + x && z1 == size + z ){} - else { par1World.setBlock(x1, y, z1, Block.leaves.blockID); } - } - } - } - if(size==3){par1World.setBlock(x, y, z, Block.wood.blockID);} - } - - public boolean generateAcacia(World world, Random rand, int x, int y, int z) - { - int baseHeight = 4 + rand.nextInt(3); - - int var5 = world.getBlockId(x, y - 1, z); - if (var5 != Block.grass.blockID) - return false; - - //Base tree - for(int i = 0; i < baseHeight + 4; i++) { - int blockID = world.getBlockId(x, y + i, z); - - //Checks trunk space - if (!(world.isAirBlock(x, y + i, z) || blockID == DecoIntegration.acaciaLeaves.blockID)) { - return false; - } - } - - for(int i = 0; i < baseHeight + 3; i++) { - world.setBlock(x, y + i, z, DecoIntegration.acaciaLog.blockID); - } - - createAcaciaLeaves(world, rand, x + 0, y + baseHeight + 3, z - 0, 3); - createAcaciaLeaves(world, rand, x + 0, y + baseHeight + 4, z - 0, 2); - - world.setBlock(x, y, z, DecoIntegration.acaciaStump.blockID); - - //Branches - if(rand.nextInt(4) == 0 && - (world.isAirBlock(x + 0, y + baseHeight + 1, z + 1) || world.getBlockId(x + 0, y + baseHeight + 1, z + 1) == DecoIntegration.acaciaLeaves.blockID) && - (world.isAirBlock(x + 1, y + baseHeight + 2, z + 2) || world.getBlockId(x + 1, y + baseHeight + 2, z + 2) == DecoIntegration.acaciaLeaves.blockID)) { - world.setBlock(x + 0, y + baseHeight + 1, z + 1, DecoIntegration.acaciaLog.blockID); - world.setBlock(x + 1, y + baseHeight + 2, z + 2, DecoIntegration.acaciaLog.blockID); - createAcaciaLeaves(world, rand, x + 1, y + baseHeight + 2, z + 2, 3); - createAcaciaLeaves(world, rand, x + 1, y + baseHeight + 3, z + 2, 2); - } - - if(rand.nextInt(4) == 0 && - (world.isAirBlock(x + 1, y + baseHeight + 0, z + 0) || world.getBlockId(x + 1, y + baseHeight + 0, z + 0) == DecoIntegration.acaciaLeaves.blockID) && - (world.isAirBlock(x + 2, y + baseHeight + 1, z + 0) || world.getBlockId(x + 2, y + baseHeight + 1, z + 0) == DecoIntegration.acaciaLeaves.blockID) && - (world.isAirBlock(x + 3, y + baseHeight + 2, z + 1) || world.getBlockId(x + 3, y + baseHeight + 2, z + 1) == DecoIntegration.acaciaLeaves.blockID)) { - world.setBlock(x + 1, y + baseHeight + 0, z + 0, DecoIntegration.acaciaLog.blockID); - world.setBlock(x + 2, y + baseHeight + 1, z + 0, DecoIntegration.acaciaLog.blockID); - world.setBlock(x + 3, y + baseHeight + 2, z - 1, DecoIntegration.acaciaLog.blockID); - createAcaciaLeaves(world, rand, x + 3, y + baseHeight + 3, z - 1, 3); - createAcaciaLeaves(world, rand, x + 3, y + baseHeight + 4, z - 1, 2); - } - - if(rand.nextInt(4) == 0 && - (world.isAirBlock(x - 1, y + baseHeight + 0, z + 0) || world.getBlockId(x - 1, y + baseHeight + 0, z + 0) == DecoIntegration.acaciaLeaves.blockID) && - (world.isAirBlock(x - 2, y + baseHeight + 1, z + 0) || world.getBlockId(x - 2, y + baseHeight + 1, z + 0) == DecoIntegration.acaciaLeaves.blockID) && - (world.isAirBlock(x - 3, y + baseHeight + 2, z - 1) || world.getBlockId(x - 3, y + baseHeight + 2, z - 1) == DecoIntegration.acaciaLeaves.blockID) && - (world.isAirBlock(x - 4, y + baseHeight + 3, z - 2) || world.getBlockId(x - 4, y + baseHeight + 3, z - 2) == DecoIntegration.acaciaLeaves.blockID)) { - world.setBlock(x - 1, y + baseHeight + 0, z + 0, DecoIntegration.acaciaLog.blockID); - world.setBlock(x - 2, y + baseHeight + 1, z + 0, DecoIntegration.acaciaLog.blockID); - world.setBlock(x - 3, y + baseHeight + 2, z - 1, DecoIntegration.acaciaLog.blockID); - world.setBlock(x - 4, y + baseHeight + 3, z - 2, DecoIntegration.acaciaLog.blockID); - createAcaciaLeaves(world, rand, x - 4, y + baseHeight + 4, z - 2, 3); - createAcaciaLeaves(world, rand, x - 4, y + baseHeight + 5, z - 2, 2); - } - - if(rand.nextInt(4) == 0 && - (world.isAirBlock(x + 0, y + baseHeight + 0, z - 1) || world.getBlockId(x + 0, y + baseHeight + 0, z - 1) == DecoIntegration.acaciaLeaves.blockID) && - (world.isAirBlock(x + 1, y + baseHeight + 1, z - 1) || world.getBlockId(x + 1, y + baseHeight + 1, z - 1) == DecoIntegration.acaciaLeaves.blockID) && - (world.isAirBlock(x + 2, y + baseHeight + 2, z - 2) || world.getBlockId(x + 2, y + baseHeight + 2, z - 2) == DecoIntegration.acaciaLeaves.blockID) && - (world.isAirBlock(x + 3, y + baseHeight + 3, z - 2) || world.getBlockId(x + 3, y + baseHeight + 3, z - 2) == DecoIntegration.acaciaLeaves.blockID)) { - world.setBlock(x + 0, y + baseHeight + 0, z - 1, DecoIntegration.acaciaLog.blockID); - world.setBlock(x + 1, y + baseHeight + 1, z - 2, DecoIntegration.acaciaLog.blockID); - world.setBlock(x + 2, y + baseHeight + 2, z - 2, DecoIntegration.acaciaLog.blockID); - world.setBlock(x + 3, y + baseHeight + 3, z - 2, DecoIntegration.acaciaLog.blockID); - createAcaciaLeaves(world, rand, x + 3, y + baseHeight + 3, z - 2, 3); - createAcaciaLeaves(world, rand, x + 3, y + baseHeight + 4, z - 2, 2); - } - - if(rand.nextInt(4) == 0 && - (world.isAirBlock(x + 0, y + baseHeight + 0, z - 1) || world.getBlockId(x + 0, y + baseHeight + 0, z - 1) == DecoIntegration.acaciaLeaves.blockID) && - (world.isAirBlock(x + 0, y + baseHeight + 0, z - 2) || world.getBlockId(x + 0, y + baseHeight + 0, z - 2) == DecoIntegration.acaciaLeaves.blockID) && - (world.isAirBlock(x + 1, y + baseHeight + 1, z - 3) || world.getBlockId(x + 1, y + baseHeight + 0, z - 3) == DecoIntegration.acaciaLeaves.blockID)) { - world.setBlock(x + 0, y + baseHeight + 0, z - 1, DecoIntegration.acaciaLog.blockID); - world.setBlock(x + 0, y + baseHeight + 0, z - 2, DecoIntegration.acaciaLog.blockID); - world.setBlock(x + 1, y + baseHeight + 1, z - 3, DecoIntegration.acaciaLog.blockID); - createAcaciaLeaves(world, rand, x + 1, y + baseHeight + 1, z - 3, 3); - createAcaciaLeaves(world, rand, x + 1, y + baseHeight + 2, z - 3, 2); - } - - return true; - } - - private void createAcaciaLeaves(World par1World, Random par2Random, int x, int y, int z, int size) - { - for(int i = -size + x; i < size + 1 + x; i++) { - for(int k = -size + z; k < size + 1 + z; k++) { - int currentID = par1World.getBlockId(i, y, k); - - if (currentID == 0) - { - if(i == -size + x && k == -size + z ){} else if(i == -size + x && k == size + z ){} else if(i == size + x && k == -size + z ){} else if(i == size + x && k == size + z ){} - else { par1World.setBlock(i, y, k, DecoIntegration.acaciaLeaves.blockID); } - } - } - } - - if(size==3){par1World.setBlock(x, y, z, DecoIntegration.acaciaLog.blockID);} - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/AutmnTreeGen.java b/minecraft_server/betterbiomes/feature/tree/AutmnTreeGen.java deleted file mode 100644 index 16bcb6c..0000000 --- a/minecraft_server/betterbiomes/feature/tree/AutmnTreeGen.java +++ /dev/null @@ -1,149 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.FCUtilsTrees; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class AutmnTreeGen extends WorldGenerator { - private static int leafMeta = 0; - - public AutmnTreeGen(int leafMeta) { - this.leafMeta = leafMeta; - } - - public boolean generate(World var0, Random var1, int var2, int var3, int var4) { - int var5 = 5; - int var6 = 0; - int var7 = leafMeta; - boolean var8 = false; - - int var9 = var1.nextInt(3) + var5; - boolean var10 = true; - - if (var3 >= 1 && var3 + var9 + 1 <= 256) - { - int var11; - byte var12; - int var14; - int var15; - - for (var11 = var3; var11 <= var3 + 1 + var9; ++var11) - { - var12 = 1; - - if (var11 == var3) - { - var12 = 0; - } - - if (var11 >= var3 + 1 + var9 - 2) - { - var12 = 2; - } - - for (int var13 = var2 - var12; var13 <= var2 + var12 && var10; ++var13) - { - for (var14 = var4 - var12; var14 <= var4 + var12 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = var0.getBlockId(var13, var11, var14); - - if (!var0.isAirBlock(var13, var11, var14) && var15 != Block.leaves.blockID && var15 != Block.grass.blockID && var15 != Block.dirt.blockID && var15 != Block.wood.blockID && var15 != DecoIntegration.cherryLog.blockID && var15 != DecoIntegration.cherryLeaves.blockID || var15 == DecoIntegration.autumnLeaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - { - return false; - } - else - { - var11 = var0.getBlockId(var2, var3 - 1, var4); - - if (FCUtilsTrees.CanSaplingGrowOnBlock(var0, var2, var3 - 1, var4) && var3 < 256 - var9 - 1) - { - if (var11 == Block.grass.blockID) - { - var0.setBlockWithNotify(var2, var3 - 1, var4, Block.dirt.blockID); - } - - var12 = 3; - byte var21 = 0; - int var16; - int var17; - int var18; - - for (var14 = var3 - var12 + var9; var14 <= var3 + var9; ++var14) - { - var15 = var14 - (var3 + var9); - var16 = var21 + 1 - var15 / 2; - - for (var17 = var2 - var16; var17 <= var2 + var16; ++var17) - { - var18 = var17 - var2; - - for (int var19 = var4 - var16; var19 <= var4 + var16; ++var19) - { - int var20 = var19 - var4; - - if ((Math.abs(var18) != var16 || Math.abs(var20) != var16 || var1.nextInt(2) != 0 && var15 != 0) && !Block.opaqueCubeLookup[var0.getBlockId(var17, var14, var19)]) - { - var0.setBlockAndMetadataWithNotify(var17, var14, var19, DecoIntegration.autumnLeaves.blockID, leafMeta); - } - } - } - } - - for (var14 = 0; var14 < var9; ++var14) - { - var15 = var0.getBlockId(var2, var3 + var14, var4); - - if (var0.isAirBlock(var2, var3 + var14, var4) || var15 == Block.leaves.blockID || var15 == DecoIntegration.autumnLeaves.blockID || var15 == DecoIntegration.cherryLeaves.blockID) - { - var0.setBlockAndMetadataWithNotify(var2, var3 + var14, var4, Block.wood.blockID, var6); - } - } - - if (var9 > 2) - { - var14 = var0.getBlockId(var2, var3, var4); - - if (var14 == Block.wood.blockID) - { - var15 = var0.getBlockMetadata(var2, var3, var4); - - if (var15 == var6) - { - var0.setBlockMetadata(var2, var3, var4, var15 | 12); - } - } - } - - return true; - } - else - { - return false; - } - } - } - else - { - return false; - } - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/BigCherryTreeGen.java b/minecraft_server/betterbiomes/feature/tree/BigCherryTreeGen.java deleted file mode 100644 index 39f7bc3..0000000 --- a/minecraft_server/betterbiomes/feature/tree/BigCherryTreeGen.java +++ /dev/null @@ -1,522 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.MathHelper; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class BigCherryTreeGen extends WorldGenerator -{ - /** - * Contains three sets of two values that provide complimentary indices for a given 'major' index - 1 and 2 for 0, 0 - * and 2 for 1, and 0 and 1 for 2. - */ - static final byte[] otherCoordPairs = new byte[] {(byte)2, (byte)0, (byte)0, (byte)1, (byte)2, (byte)1}; - - /** random seed for GenBigTree */ - Random rand = new Random(); - - /** Reference to the World object. */ - World worldObj; - int[] basePos = new int[] {0, 0, 0}; - int heightLimit = 0; - int height; - double heightAttenuation = 0.618D; - double branchDensity = 1.0D; - double branchSlope = 0.381D; - double scaleWidth = 1.0D; - double leafDensity = 1.0D; - - /** - * Currently always 1, can be set to 2 in the class constructor to generate a double-sized tree trunk for big trees. - */ - int trunkSize = 1; - - /** - * Sets the limit of the random value used to initialize the height limit. - */ - int heightLimitLimit = 12; - - /** - * Sets the distance limit for how far away the generator will populate leaves from the base leaf node. - */ - int leafDistanceLimit = 4; - - /** Contains a list of a points at which to generate groups of leaves. */ - int[][] leafNodes; - - public BigCherryTreeGen(boolean par1) - { - super(par1); - } - - /** - * Generates a list of leaf nodes for the tree, to be populated by generateLeaves. - */ - void generateLeafNodeList() - { - this.height = (int)((double)this.heightLimit * this.heightAttenuation); - - if (this.height >= this.heightLimit) - { - this.height = this.heightLimit - 1; - } - - int var1 = (int)(1.382D + Math.pow(this.leafDensity * (double)this.heightLimit / 13.0D, 2.0D)); - - if (var1 < 1) - { - var1 = 1; - } - - int[][] var2 = new int[var1 * this.heightLimit][4]; - int var3 = this.basePos[1] + this.heightLimit - this.leafDistanceLimit; - int var4 = 1; - int var5 = this.basePos[1] + this.height; - int var6 = var3 - this.basePos[1]; - var2[0][0] = this.basePos[0]; - var2[0][1] = var3; - var2[0][2] = this.basePos[2]; - var2[0][3] = var5; - --var3; - - while (var6 >= 0) - { - int var7 = 0; - float var8 = this.layerSize(var6); - - if (var8 < 0.0F) - { - --var3; - --var6; - } - else - { - for (double var9 = 0.5D; var7 < var1; ++var7) - { - double var11 = this.scaleWidth * (double)var8 * ((double)this.rand.nextFloat() + 0.328D); - double var13 = (double)this.rand.nextFloat() * 2.0D * Math.PI; - int var15 = MathHelper.floor_double(var11 * Math.sin(var13) + (double)this.basePos[0] + var9); - int var16 = MathHelper.floor_double(var11 * Math.cos(var13) + (double)this.basePos[2] + var9); - int[] var17 = new int[] {var15, var3, var16}; - int[] var18 = new int[] {var15, var3 + this.leafDistanceLimit, var16}; - - if (this.checkBlockLine(var17, var18) == -1) - { - int[] var19 = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; - double var20 = Math.sqrt(Math.pow((double)Math.abs(this.basePos[0] - var17[0]), 2.0D) + Math.pow((double)Math.abs(this.basePos[2] - var17[2]), 2.0D)); - double var22 = var20 * this.branchSlope; - - if ((double)var17[1] - var22 > (double)var5) - { - var19[1] = var5; - } - else - { - var19[1] = (int)((double)var17[1] - var22); - } - - if (this.checkBlockLine(var19, var17) == -1) - { - var2[var4][0] = var15; - var2[var4][1] = var3; - var2[var4][2] = var16; - var2[var4][3] = var19[1]; - ++var4; - } - } - } - - --var3; - --var6; - } - } - - this.leafNodes = new int[var4][4]; - System.arraycopy(var2, 0, this.leafNodes, 0, var4); - } - - void genTreeLayer(int par1, int par2, int par3, float par4, byte par5, int par6) - { - int var7 = (int)((double)par4 + 0.618D); - byte var8 = otherCoordPairs[par5]; - byte var9 = otherCoordPairs[par5 + 3]; - int[] var10 = new int[] {par1, par2, par3}; - int[] var11 = new int[] {0, 0, 0}; - int var12 = -var7; - int var13 = -var7; - - for (var11[par5] = var10[par5]; var12 <= var7; ++var12) - { - var11[var8] = var10[var8] + var12; - var13 = -var7; - - while (var13 <= var7) - { - double var14 = Math.pow((double)Math.abs(var12) + 0.5D, 2.0D) + Math.pow((double)Math.abs(var13) + 0.5D, 2.0D); - - if (var14 > (double)(par4 * par4)) - { - ++var13; - } - else - { - var11[var9] = var10[var9] + var13; - int var16 = this.worldObj.getBlockId(var11[0], var11[1], var11[2]); - - if (var16 != 0 && var16 != DecoIntegration.cherryLeaves.blockID) - { - ++var13; - } - else - { - this.setBlockAndMetadata(this.worldObj, var11[0], var11[1], var11[2], par6, 0); - ++var13; - } - } - } - } - } - - /** - * Gets the rough size of a layer of the tree. - */ - float layerSize(int par1) - { - if ((double)par1 < (double)((float)this.heightLimit) * 0.3D) - { - return -1.618F; - } - else - { - float var2 = (float)this.heightLimit / 2.0F; - float var3 = (float)this.heightLimit / 2.0F - (float)par1; - float var4; - - if (var3 == 0.0F) - { - var4 = var2; - } - else if (Math.abs(var3) >= var2) - { - var4 = 0.0F; - } - else - { - var4 = (float)Math.sqrt(Math.pow((double)Math.abs(var2), 2.0D) - Math.pow((double)Math.abs(var3), 2.0D)); - } - - var4 *= 0.5F; - return var4; - } - } - - float leafSize(int par1) - { - return par1 >= 0 && par1 < this.leafDistanceLimit ? (par1 != 0 && par1 != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) : -1.0F; - } - - /** - * Generates the leaves surrounding an individual entry in the leafNodes list. - */ - void generateLeafNode(int par1, int par2, int par3) - { - int var4 = par2; - - for (int var5 = par2 + this.leafDistanceLimit; var4 < var5; ++var4) - { - float var6 = this.leafSize(var4 - par2); - this.genTreeLayer(par1, var4, par3, var6, (byte)1, DecoIntegration.cherryLeaves.blockID); - } - } - - /** - * Places a line of the specified block ID into the world from the first coordinate triplet to the second. - */ - void placeBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger, int par3) - { - int[] var4 = new int[] {0, 0, 0}; - byte var5 = 0; - byte var6; - - for (var6 = 0; var5 < 3; ++var5) - { - var4[var5] = par2ArrayOfInteger[var5] - par1ArrayOfInteger[var5]; - - if (Math.abs(var4[var5]) > Math.abs(var4[var6])) - { - var6 = var5; - } - } - - if (var4[var6] != 0) - { - byte var7 = otherCoordPairs[var6]; - byte var8 = otherCoordPairs[var6 + 3]; - byte var9; - - if (var4[var6] > 0) - { - var9 = 1; - } - else - { - var9 = -1; - } - - double var10 = (double)var4[var7] / (double)var4[var6]; - double var12 = (double)var4[var8] / (double)var4[var6]; - int[] var14 = new int[] {0, 0, 0}; - int var15 = 0; - - for (int var16 = var4[var6] + var9; var15 != var16; var15 += var9) - { - var14[var6] = MathHelper.floor_double((double)(par1ArrayOfInteger[var6] + var15) + 0.5D); - var14[var7] = MathHelper.floor_double((double)par1ArrayOfInteger[var7] + (double)var15 * var10 + 0.5D); - var14[var8] = MathHelper.floor_double((double)par1ArrayOfInteger[var8] + (double)var15 * var12 + 0.5D); - byte var17 = 0; - int var18 = Math.abs(var14[0] - par1ArrayOfInteger[0]); - int var19 = Math.abs(var14[2] - par1ArrayOfInteger[2]); - int var20 = Math.max(var18, var19); - - if (var20 > 0) - { - if (var18 == var20) - { - var17 = 4; - } - else if (var19 == var20) - { - var17 = 8; - } - } - - this.setBlockAndMetadata(this.worldObj, var14[0], var14[1], var14[2], par3, var17); - } - } - } - - /** - * Generates the leaf portion of the tree as specified by the leafNodes list. - */ - void generateLeaves() - { - int var1 = 0; - - for (int var2 = this.leafNodes.length; var1 < var2; ++var1) - { - int var3 = this.leafNodes[var1][0]; - int var4 = this.leafNodes[var1][1]; - int var5 = this.leafNodes[var1][2]; - this.generateLeafNode(var3, var4, var5); - } - } - - /** - * Indicates whether or not a leaf node requires additional wood to be added to preserve integrity. - */ - boolean leafNodeNeedsBase(int par1) - { - return (double)par1 >= (double)this.heightLimit * 0.2D; - } - - /** - * Places the trunk for the big tree that is being generated. Able to generate double-sized trunks by changing a - * field that is always 1 to 2. - */ - void generateTrunk() - { - int var1 = this.basePos[0]; - int var2 = this.basePos[1]; - int var3 = this.basePos[1] + this.height; - int var4 = this.basePos[2]; - int[] var5 = new int[] {var1, var2, var4}; - int[] var6 = new int[] {var1, var3, var4}; - this.placeBlockLine(var5, var6, DecoIntegration.cherryLog.blockID); - - if (this.trunkSize == 2) - { - ++var5[0]; - ++var6[0]; - this.placeBlockLine(var5, var6, DecoIntegration.cherryLog.blockID); - ++var5[2]; - ++var6[2]; - this.placeBlockLine(var5, var6, DecoIntegration.cherryLog.blockID); - var5[0] += -1; - var6[0] += -1; - this.placeBlockLine(var5, var6, DecoIntegration.cherryLog.blockID); - } - } - - /** - * Generates additional wood blocks to fill out the bases of different leaf nodes that would otherwise degrade. - */ - void generateLeafNodeBases() - { - int var1 = 0; - int var2 = this.leafNodes.length; - - for (int[] var3 = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; var1 < var2; ++var1) - { - int[] var4 = this.leafNodes[var1]; - int[] var5 = new int[] {var4[0], var4[1], var4[2]}; - var3[1] = var4[3]; - int var6 = var3[1] - this.basePos[1]; - - if (this.leafNodeNeedsBase(var6)) - { - this.placeBlockLine(var3, var5, (byte)DecoIntegration.cherryLog.blockID); - } - } - } - - /** - * Checks a line of blocks in the world from the first coordinate to triplet to the second, returning the distance - * (in blocks) before a non-air, non-leaf block is encountered and/or the end is encountered. - */ - int checkBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger) - { - int[] var3 = new int[] {0, 0, 0}; - byte var4 = 0; - byte var5; - - for (var5 = 0; var4 < 3; ++var4) - { - var3[var4] = par2ArrayOfInteger[var4] - par1ArrayOfInteger[var4]; - - if (Math.abs(var3[var4]) > Math.abs(var3[var5])) - { - var5 = var4; - } - } - - if (var3[var5] == 0) - { - return -1; - } - else - { - byte var6 = otherCoordPairs[var5]; - byte var7 = otherCoordPairs[var5 + 3]; - byte var8; - - if (var3[var5] > 0) - { - var8 = 1; - } - else - { - var8 = -1; - } - - double var9 = (double)var3[var6] / (double)var3[var5]; - double var11 = (double)var3[var7] / (double)var3[var5]; - int[] var13 = new int[] {0, 0, 0}; - int var14 = 0; - int var15; - - for (var15 = var3[var5] + var8; var14 != var15; var14 += var8) - { - var13[var5] = par1ArrayOfInteger[var5] + var14; - var13[var6] = MathHelper.floor_double((double)par1ArrayOfInteger[var6] + (double)var14 * var9); - var13[var7] = MathHelper.floor_double((double)par1ArrayOfInteger[var7] + (double)var14 * var11); - int var16 = this.worldObj.getBlockId(var13[0], var13[1], var13[2]); - - if (var16 != 0 && var16 != DecoIntegration.cherryLeaves.blockID) - { - break; - } - } - - return var14 == var15 ? -1 : Math.abs(var14); - } - } - - /** - * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height - * limit, is valid. - */ - boolean validTreeLocation() - { - int[] var1 = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; - int[] var2 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]}; - int var3 = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); - - if (var3 != 2 && var3 != 3) - { - return false; - } - else - { - int var4 = this.checkBlockLine(var1, var2); - - if (var4 == -1) - { - return true; - } - else if (var4 < 6) - { - return false; - } - else - { - this.heightLimit = var4; - return true; - } - } - } - - /** - * Rescales the generator settings, only used in WorldGenBigTree - */ - public void setScale(double par1, double par3, double par5) - { - this.heightLimitLimit = (int)(par1 * 12.0D); - - if (par1 > 0.5D) - { - this.leafDistanceLimit = 5; - } - - this.scaleWidth = par3; - this.leafDensity = par5; - } - - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - this.worldObj = par1World; - long var6 = par2Random.nextLong(); - this.rand.setSeed(var6); - this.basePos[0] = par3; - this.basePos[1] = par4; - this.basePos[2] = par5; - - if (this.heightLimit == 0) - { - this.heightLimit = 5 + this.rand.nextInt(this.heightLimitLimit); - } - - if (!this.validTreeLocation()) - { - return false; - } - else - { - this.generateLeafNodeList(); - this.generateLeaves(); - this.generateTrunk(); - this.generateLeafNodeBases(); - int var8 = par1World.getBlockId(par3, par4, par5); - - if (var8 == DecoIntegration.cherryLog.blockID) - { - int var9 = par1World.getBlockMetadata(par3, par4, par5); - par1World.setBlockMetadataWithClient(par3, par4, par5, var9 | 12); - } - - return true; - } - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/CherryTreeGen.java b/minecraft_server/betterbiomes/feature/tree/CherryTreeGen.java deleted file mode 100644 index d6f946c..0000000 --- a/minecraft_server/betterbiomes/feature/tree/CherryTreeGen.java +++ /dev/null @@ -1,143 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.FCUtilsTrees; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class CherryTreeGen extends WorldGenerator { - public boolean generate(World var0, Random var1, int var2, int var3, int var4) { - int var5 = 5; - int var6 = 0; - int var7 = 0; - boolean var8 = false; - - int var9 = var1.nextInt(3) + var5; - boolean var10 = true; - - if (var3 >= 1 && var3 + var9 + 1 <= 256) - { - int var11; - byte var12; - int var14; - int var15; - - for (var11 = var3; var11 <= var3 + 1 + var9; ++var11) - { - var12 = 1; - - if (var11 == var3) - { - var12 = 0; - } - - if (var11 >= var3 + 1 + var9 - 2) - { - var12 = 2; - } - - for (int var13 = var2 - var12; var13 <= var2 + var12 && var10; ++var13) - { - for (var14 = var4 - var12; var14 <= var4 + var12 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = var0.getBlockId(var13, var11, var14); - - if (!var0.isAirBlock(var13, var11, var14) && var15 != Block.leaves.blockID && var15 != Block.grass.blockID && var15 != Block.dirt.blockID && var15 != Block.wood.blockID && var15 != DecoIntegration.cherryLog.blockID && var15 != DecoIntegration.cherryLeaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - { - return false; - } - else - { - var11 = var0.getBlockId(var2, var3 - 1, var4); - - if (FCUtilsTrees.CanSaplingGrowOnBlock(var0, var2, var3 - 1, var4) && var3 < 256 - var9 - 1) - { - if (var11 == Block.grass.blockID) - { - var0.setBlock(var2, var3 - 1, var4, Block.dirt.blockID); - } - - var12 = 3; - byte var21 = 0; - int var16; - int var17; - int var18; - - for (var14 = var3 - var12 + var9; var14 <= var3 + var9; ++var14) - { - var15 = var14 - (var3 + var9); - var16 = var21 + 1 - var15 / 2; - - for (var17 = var2 - var16; var17 <= var2 + var16; ++var17) - { - var18 = var17 - var2; - - for (int var19 = var4 - var16; var19 <= var4 + var16; ++var19) - { - int var20 = var19 - var4; - - if ((Math.abs(var18) != var16 || Math.abs(var20) != var16 || var1.nextInt(2) != 0 && var15 != 0) && !Block.opaqueCubeLookup[var0.getBlockId(var17, var14, var19)]) - { - var0.setBlockAndMetadata(var17, var14, var19, DecoIntegration.cherryLeaves.blockID, var7); - } - } - } - } - - for (var14 = 0; var14 < var9; ++var14) - { - var15 = var0.getBlockId(var2, var3 + var14, var4); - - if (var0.isAirBlock(var2, var3 + var14, var4) || var15 == Block.leaves.blockID || var15 == DecoIntegration.cherryLeaves.blockID) - { - var0.setBlockAndMetadata(var2, var3 + var14, var4, DecoIntegration.cherryLog.blockID, var6); - } - } - - if (var9 > 2) - { - var14 = var0.getBlockId(var2, var3, var4); - - if (var14 == DecoIntegration.cherryLog.blockID) - { - var15 = var0.getBlockMetadata(var2, var3, var4); - - if (var15 == var6) - { - var0.setBlock(var2, var3, var4, DecoIntegration.cherryStump.blockID); - } - } - } - - return true; - } - else - { - return false; - } - } - } - else - { - return false; - } - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/MangroveGen.java b/minecraft_server/betterbiomes/feature/tree/MangroveGen.java deleted file mode 100644 index 8376f60..0000000 --- a/minecraft_server/betterbiomes/feature/tree/MangroveGen.java +++ /dev/null @@ -1,205 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class MangroveGen extends WorldGenerator { - public boolean generate(World world, Random rand, int x, int y, int z) { - int blockIDBelow = world.getBlockId(x, y - 1, z); - - if (blockIDBelow != Block.grass.blockID && blockIDBelow != Block.waterMoving.blockID && blockIDBelow != Block.waterStill.blockID) { - return false; - } - - int var7 = 11 + rand.nextInt(3); - - for (int j = 6; j < var7; ++j) { - world.setBlock(x, y + j, z, Block.wood.blockID); - } - - this.createSwampRoots(world, rand, x, y, z); - this.createRainForestBranch(world, rand, x, y + var7 - 5, z); - this.createRainForestLeaves(world, rand, x, y + var7, z, 2); - this.createRainForestLeaves(world, rand, x, y + var7 + 1, z, 3); - this.createRainForestLeaves(world, rand, x, y + var7 + 2, z, 2); - world.setBlock(x, y + var7, z, Block.wood.blockID); - world.setBlock(x, y + var7 + 1, z, Block.wood.blockID); - - return true; - } - - private void createSwampRoots(World world, Random rand, int x, int y, int z) { - int offset1 = rand.nextInt(5); - - for (int var7 = offset1; var7 < 8; ++var7) { - world.setBlock(x, y + var7, z, Block.wood.blockID); - } - - world.setBlock(x - 1, y + offset1, z, Block.wood.blockID); - world.setBlock(x - 1, y + offset1 - 1, z, Block.wood.blockID); - world.setBlock(x - 2, y + offset1 - 1, z, Block.wood.blockID); - world.setBlock(x - 2, y + offset1 - 2, z, Block.wood.blockID); - world.setBlock(x - 2, y + offset1 - 3, z, Block.wood.blockID); - world.setBlock(x - 3, y + offset1 - 3, z, Block.wood.blockID); - - for (int j = y + offset1 - 3; j > 50; --j) { - int blockID = world.getBlockId(x - 3, j, z); - - if (blockID != 0 && blockID != Block.grass.blockID && blockID != Block.waterMoving.blockID && blockID != Block.waterStill.blockID && blockID != Block.leaves.blockID && blockID != Block.wood.blockID && blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID) { - break; - } - - world.setBlock(x - 3, j, z, Block.wood.blockID); - } - - int offset2 = 2 + rand.nextInt(5); - - for (int j = offset2; j < 8; ++j) { - world.setBlock(x, y + j, z, Block.wood.blockID); - } - - world.setBlock(x + 1, y + offset2, z, Block.wood.blockID); - world.setBlock(x + 1, y + offset2 - 1, z, Block.wood.blockID); - world.setBlock(x + 2, y + offset2 - 1, z, Block.wood.blockID); - world.setBlock(x + 2, y + offset2 - 2, z, Block.wood.blockID); - world.setBlock(x + 2, y + offset2 - 3, z, Block.wood.blockID); - world.setBlock(x + 3, y + offset2 - 3, z, Block.wood.blockID); - - for (int j = y + offset2 - 3; j > 50; --j) { - int blockID = world.getBlockId(x + 3, j, z); - - if (blockID != 0 && blockID != Block.grass.blockID && blockID != Block.waterMoving.blockID && blockID != Block.waterStill.blockID && blockID != Block.leaves.blockID && blockID != Block.wood.blockID && blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID) { - break; - } - - world.setBlock(x + 3, j, z, Block.wood.blockID); - } - - int offset3 = 2 + rand.nextInt(5); - - for (int j = offset3; j < 8; ++j) { - world.setBlock(x, y + j, z, Block.wood.blockID); - } - - world.setBlock(x, y + offset3, z - 1, Block.wood.blockID); - world.setBlock(x, y + offset3 - 1, z - 1, Block.wood.blockID); - world.setBlock(x, y + offset3 - 1, z - 2, Block.wood.blockID); - world.setBlock(x, y + offset3 - 2, z - 2, Block.wood.blockID); - world.setBlock(x, y + offset3 - 3, z - 2, Block.wood.blockID); - world.setBlock(x, y + offset3 - 3, z - 3, Block.wood.blockID); - - for (int j = y + offset3 - 3; j > 50; --j) { - int blockID = world.getBlockId(x, j, z - 3); - - if (blockID != 0 && blockID != Block.grass.blockID && blockID != Block.waterMoving.blockID && blockID != Block.waterStill.blockID && blockID != Block.leaves.blockID && blockID != Block.wood.blockID && blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID) { - break; - } - - world.setBlock(x, j, z - 3, Block.wood.blockID); - } - - int offset4 = 2 + rand.nextInt(5); - - for (int j = offset4; j < 8; ++j) { - world.setBlock(x, y + j, z, Block.wood.blockID); - } - - world.setBlock(x, y + offset4, z + 1, Block.wood.blockID); - world.setBlock(x, y + offset4 - 1, z + 1, Block.wood.blockID); - world.setBlock(x, y + offset4 - 1, z + 2, Block.wood.blockID); - world.setBlock(x, y + offset4 - 2, z + 2, Block.wood.blockID); - world.setBlock(x, y + offset4 - 3, z + 2, Block.wood.blockID); - world.setBlock(x, y + offset4 - 3, z + 3, Block.wood.blockID); - - for (int j = y + offset4 - 3; j > 50; --j) { - int blockID = world.getBlockId(x, j, z + 3); - - if (blockID != 0 && blockID != Block.grass.blockID && blockID != Block.waterMoving.blockID && blockID != Block.waterStill.blockID && blockID != Block.leaves.blockID && blockID != Block.wood.blockID && blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID) { - break; - } - - world.setBlock(x, j, z + 3, Block.wood.blockID); - } - } - - private void createRainForestBranch(World world, Random rand, int x, int y, int z) { - int var6; - int var7; - - if (rand.nextInt(4) == 0) { - world.setBlock(x + 1, y, z, Block.wood.blockID); - world.setBlock(x + 2, y + 1, z, Block.wood.blockID); - world.setBlock(x + 3, y + 2, z, Block.wood.blockID); - world.setBlock(x + 4, y + 3, z, Block.wood.blockID); - var6 = 1 + rand.nextInt(5); - this.createRainForestLeaves(world, rand, x + 4, y + 4 + var6, z, 2); - this.createRainForestLeaves(world, rand, x + 4, y + 5 + var6, z, 3); - this.createRainForestLeaves(world, rand, x + 4, y + 6 + var6, z, 2); - - for (var7 = 0; var7 <= var6; ++var7) { - world.setBlock(x + 4, y + 4 + var7, z, Block.wood.blockID); - } - } - - if (rand.nextInt(4) == 0) { - world.setBlock(x - 1, y, z, Block.wood.blockID); - world.setBlock(x - 2, y + 1, z, Block.wood.blockID); - world.setBlock(x - 3, y + 2, z, Block.wood.blockID); - world.setBlock(x - 4, y + 3, z, Block.wood.blockID); - var6 = 1 + rand.nextInt(5); - this.createRainForestLeaves(world, rand, x - 4, y + 4 + var6, z, 2); - this.createRainForestLeaves(world, rand, x - 4, y + 5 + var6, z, 3); - this.createRainForestLeaves(world, rand, x - 4, y + 6 + var6, z, 2); - - for (var7 = 0; var7 <= var6; ++var7) - { - world.setBlock(x - 4, y + 4 + var7, z, Block.wood.blockID); - } - } - - if (rand.nextInt(4) == 0) { - world.setBlock(x, y, z + 1, Block.wood.blockID); - world.setBlock(x, y + 1, z + 2, Block.wood.blockID); - world.setBlock(x, y + 2, z + 3, Block.wood.blockID); - world.setBlock(x, y + 3, z + 4, Block.wood.blockID); - var6 = 1 + rand.nextInt(5); - this.createRainForestLeaves(world, rand, x, y + 4 + var6, z + 4, 2); - this.createRainForestLeaves(world, rand, x, y + 5 + var6, z + 4, 3); - this.createRainForestLeaves(world, rand, x, y + 6 + var6, z + 4, 2); - - for (var7 = 0; var7 <= var6; ++var7) { - world.setBlock(x, y + 4 + var7, z + 4, Block.wood.blockID); - } - } - - if (rand.nextInt(4) == 0) { - world.setBlock(x, y, z - 1, Block.wood.blockID); - world.setBlock(x, y + 1, z - 2, Block.wood.blockID); - world.setBlock(x, y + 2, z - 3, Block.wood.blockID); - world.setBlock(x, y + 3, z - 4, Block.wood.blockID); - var6 = 1 + rand.nextInt(5); - this.createRainForestLeaves(world, rand, x, y + 4 + var6, z - 4, 2); - this.createRainForestLeaves(world, rand, x, y + 5 + var6, z - 4, 3); - this.createRainForestLeaves(world, rand, x, y + 6 + var6, z - 4, 2); - - for (var7 = 0; var7 <= var6; ++var7) { - world.setBlock(x, y + 4 + var7, z - 4, Block.wood.blockID); - } - } - } - - private void createRainForestLeaves(World var1, Random var2, int var3, int var4, int var5, int var6) { - for (int var7 = -var6 + var3; var7 < var6 + 1 + var3; ++var7) { - for (int var8 = -var6 + var5; var8 < var6 + 1 + var5; ++var8) { - int var9 = var1.getBlockId(var7, var4, var8); - - if (var9 == 0 && (var7 != -var6 + var3 || var8 != -var6 + var5) && (var7 != -var6 + var3 || var8 != var6 + var5) && (var7 != var6 + var3 || var8 != -var6 + var5) && (var7 != var6 + var3 || var8 != var6 + var5)) { - var1.setBlock(var7, var4, var8, Block.leaves.blockID); - } - } - } - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/MassiveOakGen.java b/minecraft_server/betterbiomes/feature/tree/MassiveOakGen.java deleted file mode 100644 index 80892a8..0000000 --- a/minecraft_server/betterbiomes/feature/tree/MassiveOakGen.java +++ /dev/null @@ -1,167 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class MassiveOakGen extends WorldGenerator -{ - public MassiveOakGen(boolean var1) - { - super(var1); - } - - @Override - public boolean generate(World var1, Random var2, int var3, int var4, int var5) - { - int var6 = var2.nextInt(15) + 20; - int var7 = var2.nextInt(5) + 5; - int var8 = var6 - var7; - int var9 = 2 + var2.nextInt(2); - boolean var10 = true; - - if (var4 >= 1 && var4 + var6 + 1 <= 256) - { - int var11; - int var13; - int var14; - int var15; - int var24; - - for (var11 = var4; var11 <= var4 + 1 + var6 && var10; ++var11) - { - boolean var12 = true; - - if (var11 - var4 < var7) - { - var24 = 0; - } - else - { - var24 = var9; - } - - for (var13 = var3 - var24; var13 <= var3 + var24 && var10; ++var13) - { - for (var14 = var5 - var24; var14 <= var5 + var24 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = var1.getBlockId(var13, var11, var14); - - if (var15 != 0 && var15 != Block.leaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - return false; - else - { - var11 = var1.getBlockId(var3, var4 - 1, var5); - var24 = var1.getBlockId(var3 - 1, var4 - 1, var5); - var13 = var1.getBlockId(var3, var4 - 1, var5 - 1); - var14 = var1.getBlockId(var3 - 1, var4 - 1, var5 - 1); - - if ((var11 == Block.grass.blockID || var11 == Block.dirt.blockID) && var4 < 256 - var6 - 1) - { - if ((var24 == Block.grass.blockID || var24 == Block.dirt.blockID) && var4 < 256 - var6 - 1) - { - if ((var13 == Block.grass.blockID || var24 == Block.dirt.blockID) && var4 < 256 - var6 - 1) - { - if ((var14 == Block.grass.blockID || var24 == Block.dirt.blockID) && var4 < 256 - var6 - 1) - { - var1.setBlock(var3, var4 - 1, var5, Block.dirt.blockID); - var1.setBlock(var3 - 1, var4 - 1, var5, Block.dirt.blockID); - var1.setBlock(var3, var4 - 1, var5 - 1, Block.dirt.blockID); - var1.setBlock(var3 - 1, var4 - 1, var5 - 1, Block.dirt.blockID); - var15 = var2.nextInt(2); - int var16 = 1; - boolean var17 = false; - int var19; - int var18; - int var20; - - for (var18 = 0; var18 <= var8; ++var18) - { - var19 = var4 + var6 - var18; - - for (var20 = var3 - var15; var20 <= var3 + var15; ++var20) - { - int var21 = var20 - var3; - - for (int var22 = var5 - var15; var22 <= var5 + var15; ++var22) - { - int var23 = var22 - var5; - - if ((Math.abs(var21) != var15 || Math.abs(var23) != var15 || var15 <= 0) && !Block.opaqueCubeLookup[var1.getBlockId(var20, var19, var22)]) - { - this.setBlockAndMetadata(var1, var20, var19, var22, Block.leaves.blockID, 0); - this.setBlockAndMetadata(var1, var20 - 1, var19, var22, Block.leaves.blockID, 0); - this.setBlockAndMetadata(var1, var20, var19, var22 - 1, Block.leaves.blockID, 0); - this.setBlockAndMetadata(var1, var20 - 1, var19, var22 - 1, Block.leaves.blockID, 0); - } - } - } - - if (var15 >= var16) - { - var15 = var17 ? 1 : 0; - var17 = true; - ++var16; - - if (var16 > var9) - { - var16 = var9; - } - } - else - { - ++var15; - } - } - - var18 = var2.nextInt(3); - - for (var19 = 0; var19 < var6 - var18; ++var19) - { - var20 = var1.getBlockId(var3, var4 + var19, var5); - - if (var20 == 0 || var20 == Block.leaves.blockID) - { - this.setBlockAndMetadata(var1, var3, var4 + var19, var5, Block.wood.blockID, 0); - this.setBlockAndMetadata(var1, var3 - 1, var4 + var19, var5, Block.wood.blockID, 0); - this.setBlockAndMetadata(var1, var3, var4 + var19, var5 - 1, Block.wood.blockID, 0); - this.setBlockAndMetadata(var1, var3 - 1, var4 + var19, var5 - 1, Block.wood.blockID, 0); - } - } - - var1.setBlockMetadataWithClient(var3, var4, var5, 0 | 12); // place stump - var1.setBlockMetadataWithClient(var3 - 1, var4, var5, 0 | 12); // place stump - var1.setBlockMetadataWithClient(var3, var4, var5 - 1, 0 | 12); // place stump - var1.setBlockMetadataWithClient(var3 - 1, var4, var5 - 1, 0 | 12); // place stump - - return true; - } else - return false; - } else - return false; - } else - return false; - } else - return false; - } - } else - return false; - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/MeadowTreeGen1.java b/minecraft_server/betterbiomes/feature/tree/MeadowTreeGen1.java deleted file mode 100644 index 8d6c912..0000000 --- a/minecraft_server/betterbiomes/feature/tree/MeadowTreeGen1.java +++ /dev/null @@ -1,126 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class MeadowTreeGen1 extends WorldGenerator -{ - @Override - public boolean generate(World var1, Random var2, int var3, int var4, int var5) - { - while (var1.isAirBlock(var3, var4, var5) && var4 > 2) - { - --var4; - } - - int var6 = var1.getBlockId(var3, var4, var5); - - if (var6 != Block.grass.blockID) - return false; - else - { - for (int var7 = -2; var7 <= 2; ++var7) - { - for (int var8 = -2; var8 <= 2; ++var8) - { - if (var1.isAirBlock(var3 + var7, var4 - 1, var5 + var8) && var1.isAirBlock(var3 + var7, var4 - 2, var5 + var8) && !var1.isAirBlock(var3 + var7, var4, var5 + var8)) - return false; - } - } - - var1.setBlock(var3, var4, var5, Block.dirt.blockID); - var1.setBlock(var3, var4 + 1, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 2, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 3, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 4, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 5, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 6, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 7, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 8, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 9, var5, Block.wood.blockID, 1, 2); - - var1.setBlockMetadataWithClient(var3, var4 + 1, var5, 1 | 12); // place stump - - var1.setBlock(var3 + 1, var4 + 3, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 3, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 3, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 3, var5 - 1, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 4, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 4, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 4, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 4, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 4, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 4, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 4, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 4, var5 - 1, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 5, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 5, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 5, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 5, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 5, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 5, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 5, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 5, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 2, var4 + 5, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 2, var4 + 5, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 5, var5 + 2, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 5, var5 - 2, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 6, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 6, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 6, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 6, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 6, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 6, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 6, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 6, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 2, var4 + 6, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 2, var4 + 6, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 6, var5 + 2, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 6, var5 - 2, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 7, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 7, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 7, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 7, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 7, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 7, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 7, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 7, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 2, var4 + 7, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 2, var4 + 7, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 7, var5 + 2, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 7, var5 - 2, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 8, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 8, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 8, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 8, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 8, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 8, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 8, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 8, var5 - 1, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 9, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 9, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 9, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 9, var5 - 1, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 10, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 10, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 10, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 10, var5 - 1, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3, var4 + 11, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 12, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 13, var5, Block.leaves.blockID, 1, 2); - - return true; - } - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/MeadowTreeGen2.java b/minecraft_server/betterbiomes/feature/tree/MeadowTreeGen2.java deleted file mode 100644 index 7a62fc7..0000000 --- a/minecraft_server/betterbiomes/feature/tree/MeadowTreeGen2.java +++ /dev/null @@ -1,131 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class MeadowTreeGen2 extends WorldGenerator -{ - @Override - public boolean generate(World var1, Random var2, int var3, int var4, int var5) - { - while (var1.isAirBlock(var3, var4, var5) && var4 > 2) - { - --var4; - } - - int var6 = var1.getBlockId(var3, var4, var5); - - if (var6 != Block.grass.blockID) - return false; - else - { - for (int var7 = -2; var7 <= 2; ++var7) - { - for (int var8 = -2; var8 <= 2; ++var8) - { - if (var1.isAirBlock(var3 + var7, var4 - 1, var5 + var8) && var1.isAirBlock(var3 + var7, var4 - 2, var5 + var8) && !var1.isAirBlock(var3 + var7, var4, var5 + var8)) - return false; - } - } - - var1.setBlock(var3, var4, var5, Block.dirt.blockID); - var1.setBlock(var3, var4 + 1, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 2, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 3, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 4, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 5, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 6, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 7, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 8, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 9, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 10, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 11, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 12, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 13, var5, Block.wood.blockID, 1, 2); - var1.setBlock(var3, var4 + 14, var5, Block.wood.blockID, 1, 2); - - var1.setBlockMetadataWithClient(var3, var4 + 1, var5, 1 | 12); // place stump - - var1.setBlock(var3 + 1, var4 + 7, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 7, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 7, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 7, var5 - 1, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 8, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 8, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 8, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 8, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 8, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 8, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 8, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 8, var5 - 1, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 9, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 9, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 9, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 9, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 9, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 9, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 9, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 9, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 2, var4 + 9, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 2, var4 + 9, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 9, var5 + 2, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 9, var5 - 2, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 10, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 10, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 10, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 10, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 10, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 10, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 10, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 10, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 2, var4 + 10, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 2, var4 + 10, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 10, var5 + 2, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 10, var5 - 2, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 11, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 11, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 11, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 11, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 11, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 11, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 11, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 11, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 2, var4 + 11, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 2, var4 + 11, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 11, var5 + 2, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 11, var5 - 2, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 12, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 12, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 12, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 12, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 12, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 + 1, var4 + 12, var5 - 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 12, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 12, var5 - 1, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 13, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 13, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 13, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 13, var5 - 1, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3 + 1, var4 + 14, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3 - 1, var4 + 14, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 14, var5 + 1, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 14, var5 - 1, Block.leaves.blockID, 1, 2); - - var1.setBlock(var3, var4 + 15, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 16, var5, Block.leaves.blockID, 1, 2); - var1.setBlock(var3, var4 + 17, var5, Block.leaves.blockID, 1, 2); - - return true; - } - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/MysticTreeGen.java b/minecraft_server/betterbiomes/feature/tree/MysticTreeGen.java deleted file mode 100644 index 3e0089d..0000000 --- a/minecraft_server/betterbiomes/feature/tree/MysticTreeGen.java +++ /dev/null @@ -1,137 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class MysticTreeGen extends WorldGenerator -{ - public MysticTreeGen(boolean par1) - { - super(par1); - } - - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - int var6 = par2Random.nextInt(6) + 10; - int var7 = 4 + par2Random.nextInt(3); - int var8 = var6 - var7; - int var9 = 2 + par2Random.nextInt(2); - boolean var10 = true; - - if (par4 >= 1 && par4 + var6 + 1 <= 256) - { - int var11; - int var13; - int var15; - int var21; - - for (var11 = par4; var11 <= par4 + 1 + var6 && var10; ++var11) - { - boolean var12 = true; - - if (var11 - par4 < var7) - { - var21 = 0; - } - else - { - var21 = var9; - } - - for (var13 = par3 - var21; var13 <= par3 + var21 && var10; ++var13) - { - for (int var14 = par5 - var21; var14 <= par5 + var21 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = par1World.getBlockId(var13, var11, var14); - - if (var15 != 0 && var15 != Block.leaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - return false; - else - { - var11 = par1World.getBlockId(par3, par4 - 1, par5); - - if ((var11 == Block.grass.blockID || var11 == Block.dirt.blockID) && par4 < 256 - var6 - 1) - { - this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); - var21 = par2Random.nextInt(2); - var13 = 1; - byte var22 = 0; - int var17; - int var16; - - for (var15 = 0; var15 <= var8; ++var15) - { - var16 = par4 + var6 - var15; - - for (var17 = par3 - var21; var17 <= par3 + var21; ++var17) - { - int var18 = var17 - par3; - - for (int var19 = par5 - var21; var19 <= par5 + var21; ++var19) - { - int var20 = var19 - par5; - - if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var17, var16, var19)]) - { - this.setBlockAndMetadata(par1World, var17, var16, var19, Block.leaves.blockID, 0); - } - } - } - - if (var21 >= var13) - { - var21 = var22; - var22 = 1; - ++var13; - - if (var13 > var9) - { - var13 = var9; - } - } - else - { - ++var21; - } - } - - var15 = par2Random.nextInt(3); - - for (var16 = 0; var16 < var6 - var15; ++var16) - { - var17 = par1World.getBlockId(par3, par4 + var16, par5); - - if (var17 == 0 || var17 == Block.leaves.blockID) - { - this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 0); - } - } - par1World.setBlockMetadataWithClient(par3, par4, par5, 0 | 12); // place stump - - return true; - } else - return false; - } - } else - return false; - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/OldOakGen.java b/minecraft_server/betterbiomes/feature/tree/OldOakGen.java deleted file mode 100644 index c0c874b..0000000 --- a/minecraft_server/betterbiomes/feature/tree/OldOakGen.java +++ /dev/null @@ -1,513 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.MathHelper; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class OldOakGen extends WorldGenerator -{ - /** - * Contains three sets of two values that provide complimentary indices for a given 'major' index - 1 and 2 for 0, 0 - * and 2 for 1, and 0 and 1 for 2. - */ - static final byte[] otherCoordPairs = new byte[] {(byte)2, (byte)0, (byte)0, (byte)1, (byte)2, (byte)1}; - - /** random seed for GenBigTree */ - Random rand = new Random(); - - /** Reference to the World object. */ - World worldObj; - int[] basePos = new int[] {0, 0, 0}; - int heightLimit = 0; - int height; - double heightAttenuation = 0.45D; - double branchDensity = 1.0D; - double branchSlope = 0.0D; - double scaleWidth = 2.0D; - double leafDensity = 1.0D; - - /** - * Currently always 1, can be set to 2 in the class constructor to generate a double-sized tree trunk for big trees. - */ - int trunkSize = 2; - - /** - * Sets the limit of the random value used to initialize the height limit. - */ - int heightLimitLimit = 12; - - /** - * Sets the distance limit for how far away the generator will populate leaves from the base leaf node. - */ - int leafDistanceLimit = 4; - - /** Contains a list of a points at which to generate groups of leaves. */ - int[][] leafNodes; - - public OldOakGen(boolean par1) - { - super(par1); - } - - /** - * Generates a list of leaf nodes for the tree, to be populated by generateLeaves. - */ - void generateLeafNodeList() - { - height = (int)(heightLimit * heightAttenuation); - - if (height >= heightLimit) - { - height = heightLimit - 1; - } - - int var1 = (int)(1.382D + Math.pow(leafDensity * heightLimit / 13.0D, 2.0D)); - - if (var1 < 1) - { - var1 = 1; - } - - int[][] var2 = new int[var1 * heightLimit][4]; - int var3 = basePos[1] + heightLimit - leafDistanceLimit; - int var4 = 1; - int var5 = basePos[1] + height; - int var6 = var3 - basePos[1]; - var2[0][0] = basePos[0]; - var2[0][1] = var3; - var2[0][2] = basePos[2]; - var2[0][3] = var5; - --var3; - - while (var6 >= 0) - { - int var7 = 0; - float var8 = this.layerSize(var6); - - if (var8 < 0.0F) - { - --var3; - --var6; - } - else - { - for (double var9 = 0.5D; var7 < var1; ++var7) - { - double var11 = scaleWidth * var8 * (rand.nextFloat() + 0.328D); - double var13 = rand.nextFloat() * 2.0D * Math.PI; - int var15 = MathHelper.floor_double(var11 * Math.sin(var13) + basePos[0] + var9); - int var16 = MathHelper.floor_double(var11 * Math.cos(var13) + basePos[2] + var9); - int[] var17 = new int[] {var15, var3, var16}; - int[] var18 = new int[] {var15, var3 + leafDistanceLimit, var16}; - - if (this.checkBlockLine(var17, var18) == -1) - { - int[] var19 = new int[] {basePos[0], basePos[1], basePos[2]}; - double var20 = Math.sqrt(Math.pow(Math.abs(basePos[0] - var17[0]), 2.0D) + Math.pow(Math.abs(basePos[2] - var17[2]), 2.0D)); - double var22 = var20 * branchSlope; - - if (var17[1] - var22 > var5) - { - var19[1] = var5; - } - else - { - var19[1] = (int)(var17[1] - var22); - } - - if (this.checkBlockLine(var19, var17) == -1) - { - var2[var4][0] = var15; - var2[var4][1] = var3; - var2[var4][2] = var16; - var2[var4][3] = var19[1]; - ++var4; - } - } - } - - --var3; - --var6; - } - } - - leafNodes = new int[var4][4]; - System.arraycopy(var2, 0, leafNodes, 0, var4); - } - - void genTreeLayer(int par1, int par2, int par3, float par4, byte par5, int par6) - { - int var7 = (int)(par4 + heightAttenuation); - byte var8 = otherCoordPairs[par5]; - byte var9 = otherCoordPairs[par5 + 3]; - int[] var10 = new int[] {par1, par2, par3}; - int[] var11 = new int[] {0, 0, 0}; - int var12 = -var7; - int var13 = -var7; - - for (var11[par5] = var10[par5]; var12 <= var7; ++var12) - { - var11[var8] = var10[var8] + var12; - var13 = -var7; - - while (var13 <= var7) - { - double var15 = Math.pow(Math.abs(var12) + 0.5D, 2.0D) + Math.pow(Math.abs(var13) + 0.5D, 2.0D); - - if (var15 > par4 * par4) - { - ++var13; - } - else - { - var11[var9] = var10[var9] + var13; - int var14 = worldObj.getBlockId(var11[0], var11[1], var11[2]); - - if (var14 != 0 && var14 != Block.leaves.blockID) - { - ++var13; - } - else - { - this.setBlockAndMetadata(worldObj, var11[0], var11[1], var11[2], par6, 0); - ++var13; - } - } - } - } - } - - /** - * Gets the rough size of a layer of the tree. - */ - float layerSize(int par1) - { - if (par1 < (heightLimit) * 0.3D) - return -1.618F; - else - { - float var2 = heightLimit / 2.0F; - float var3 = heightLimit / 2.0F - par1; - float var4; - - if (var3 == 0.0F) - { - var4 = var2; - } - else if (Math.abs(var3) >= var2) - { - var4 = 0.0F; - } - else - { - var4 = (float)Math.sqrt(Math.pow(Math.abs(var2), 2.0D) - Math.pow(Math.abs(var3), 2.0D)); - } - - var4 *= 0.5F; - return var4; - } - } - - float leafSize(int par1) - { - return par1 >= 0 && par1 < leafDistanceLimit ? (par1 != 0 && par1 != leafDistanceLimit - 1 ? 3.0F : 2.0F) : -1.0F; - } - - /** - * Generates the leaves surrounding an individual entry in the leafNodes list. - */ - void generateLeafNode(int par1, int par2, int par3) - { - int var4 = par2; - - for (int var5 = par2 + leafDistanceLimit; var4 < var5; ++var4) - { - float var6 = this.leafSize(var4 - par2); - this.genTreeLayer(par1, var4, par3, var6, (byte)1, Block.leaves.blockID); - } - } - - /** - * Places a line of the specified block ID into the world from the first coordinate triplet to the second. - */ - void placeBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger, int par3) - { - int[] var4 = new int[] {0, 0, 0}; - byte var5 = 0; - byte var6; - - for (var6 = 0; var5 < 3; ++var5) - { - var4[var5] = par2ArrayOfInteger[var5] - par1ArrayOfInteger[var5]; - - if (Math.abs(var4[var5]) > Math.abs(var4[var6])) - { - var6 = var5; - } - } - - if (var4[var6] != 0) - { - byte var7 = otherCoordPairs[var6]; - byte var8 = otherCoordPairs[var6 + 3]; - byte var9; - - if (var4[var6] > 0) - { - var9 = 1; - } - else - { - var9 = -1; - } - - double var10 = (double)var4[var7] / (double)var4[var6]; - double var12 = (double)var4[var8] / (double)var4[var6]; - int[] var14 = new int[] {0, 0, 0}; - int var15 = 0; - - for (int var16 = var4[var6] + var9; var15 != var16; var15 += var9) - { - var14[var6] = MathHelper.floor_double(par1ArrayOfInteger[var6] + var15 + 0.5D); - var14[var7] = MathHelper.floor_double(par1ArrayOfInteger[var7] + var15 * var10 + 0.5D); - var14[var8] = MathHelper.floor_double(par1ArrayOfInteger[var8] + var15 * var12 + 0.5D); - byte var17 = 0; - int var18 = Math.abs(var14[0] - par1ArrayOfInteger[0]); - int var19 = Math.abs(var14[2] - par1ArrayOfInteger[2]); - int var20 = Math.max(var18, var19); - - if (var20 > 0) - { - if (var18 == var20) - { - var17 = 4; - } - else if (var19 == var20) - { - var17 = 8; - } - } - - this.setBlockAndMetadata(worldObj, var14[0], var14[1], var14[2], par3, var17); - } - } - } - - /** - * Generates the leaf portion of the tree as specified by the leafNodes list. - */ - void generateLeaves() - { - int var1 = 0; - - for (int var2 = leafNodes.length; var1 < var2; ++var1) - { - int var3 = leafNodes[var1][0]; - int var4 = leafNodes[var1][1]; - int var5 = leafNodes[var1][2]; - this.generateLeafNode(var3, var4, var5); - } - } - - /** - * Indicates whether or not a leaf node requires additional wood to be added to preserve integrity. - */ - boolean leafNodeNeedsBase(int par1) - { - return par1 >= heightLimit * 0.2D; - } - - /** - * Places the trunk for the big tree that is being generated. Able to generate double-sized trunks by changing a - * field that is always 1 to 2. - */ - void generateTrunk() - { - int var1 = basePos[0]; - int var2 = basePos[1]; - int var3 = basePos[1] + height; - int var4 = basePos[2]; - int[] var5 = new int[] {var1, var2, var4}; - int[] var6 = new int[] {var1, var3, var4}; - this.placeBlockLine(var5, var6, Block.wood.blockID); - worldObj.setBlockMetadataWithClient(var1, var2, var4, 0 | 12); // place stump - //worldObj.setBlock(var1, var2 - 1, var4, Block.dirt.blockID); - - - if (trunkSize == 2) - { - ++var5[0]; - ++var6[0]; - this.placeBlockLine(var5, var6, Block.wood.blockID); - - ++var5[2]; - ++var6[2]; - this.placeBlockLine(var5, var6, Block.wood.blockID); - - var5[0] += -1; - var6[0] += -1; - this.placeBlockLine(var5, var6, Block.wood.blockID); - - worldObj.setBlockMetadataWithClient(var1 + 1, var2, var4 + 1, 0 | 12); // place stump - worldObj.setBlockMetadataWithClient(var1, var2, var4 + 1, 0 | 12); // place stump - worldObj.setBlockMetadataWithClient(var1 + 1, var2, var4, 0 | 12); // place stump - } - } - - /** - * Generates additional wood blocks to fill out the bases of different leaf nodes that would otherwise degrade. - */ - void generateLeafNodeBases() - { - int var1 = 0; - int var2 = leafNodes.length; - - for (int[] var3 = new int[] {basePos[0], basePos[1], basePos[2]}; var1 < var2; ++var1) - { - int[] var4 = leafNodes[var1]; - int[] var5 = new int[] {var4[0], var4[1], var4[2]}; - var3[1] = var4[3]; - int var6 = var3[1] - basePos[1]; - - if (this.leafNodeNeedsBase(var6)) - { - this.placeBlockLine(var3, var5, Block.wood.blockID); - } - } - } - - /** - * Checks a line of blocks in the world from the first coordinate to triplet to the second, returning the distance - * (in blocks) before a non-air, non-leaf block is encountered and/or the end is encountered. - */ - int checkBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger) - { - int[] var3 = new int[] {0, 0, 0}; - byte var4 = 0; - byte var5; - - for (var5 = 0; var4 < 3; ++var4) - { - var3[var4] = par2ArrayOfInteger[var4] - par1ArrayOfInteger[var4]; - - if (Math.abs(var3[var4]) > Math.abs(var3[var5])) - { - var5 = var4; - } - } - - if (var3[var5] == 0) - return -1; - else - { - byte var6 = otherCoordPairs[var5]; - byte var7 = otherCoordPairs[var5 + 3]; - byte var8; - - if (var3[var5] > 0) - { - var8 = 1; - } - else - { - var8 = -1; - } - - double var9 = (double)var3[var6] / (double)var3[var5]; - double var11 = (double)var3[var7] / (double)var3[var5]; - int[] var13 = new int[] {0, 0, 0}; - int var14 = 0; - int var15; - - for (var15 = var3[var5] + var8; var14 != var15; var14 += var8) - { - var13[var5] = par1ArrayOfInteger[var5] + var14; - var13[var6] = MathHelper.floor_double(par1ArrayOfInteger[var6] + var14 * var9); - var13[var7] = MathHelper.floor_double(par1ArrayOfInteger[var7] + var14 * var11); - int var16 = worldObj.getBlockId(var13[0], var13[1], var13[2]); - - if (var16 != 0 && var16 != Block.leaves.blockID) - { - break; - } - } - - return var14 == var15 ? -1 : Math.abs(var14); - } - } - - /** - * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height - * limit, is valid. - */ - boolean validTreeLocation() - { - int[] var1 = new int[] {basePos[0], basePos[1], basePos[2]}; - int[] var2 = new int[] {basePos[0], basePos[1] + heightLimit - 1, basePos[2]}; - int var3 = worldObj.getBlockId(basePos[0], basePos[1] - 1, basePos[2]); - - if (var3 != 2 && var3 != 3) - return false; - else - { - int var4 = this.checkBlockLine(var1, var2); - - if (var4 == -1) - return true; - else if (var4 < 6) - return false; - else - { - heightLimit = var4; - return true; - } - } - } - - /** - * Rescales the generator settings, only used in WorldGenBigTree - */ - @Override - public void setScale(double par1, double par3, double par5) - { - heightLimitLimit = (int)(par1 * 12.0D); - - if (par1 > 0.5D) - { - leafDistanceLimit = 5; - } - - scaleWidth = par3; - leafDensity = par5; - } - - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - worldObj = par1World; - long var6 = par2Random.nextLong(); - rand.setSeed(var6); - basePos[0] = par3; - basePos[1] = par4; - basePos[2] = par5; - - if (heightLimit == 0) - { - heightLimit = 12 + par2Random.nextInt(10); - } - - if (!this.validTreeLocation()) - return false; - else - { - this.generateLeafNodeList(); - this.generateLeaves(); - this.generateTrunk(); - this.generateLeafNodeBases(); - return true; - } - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/PetrifiedTreeGen.java b/minecraft_server/betterbiomes/feature/tree/PetrifiedTreeGen.java deleted file mode 100644 index 6842502..0000000 --- a/minecraft_server/betterbiomes/feature/tree/PetrifiedTreeGen.java +++ /dev/null @@ -1,508 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.MathHelper; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class PetrifiedTreeGen extends WorldGenerator -{ - /** - * Contains three sets of two values that provide complimentary indices for a given 'major' index - 1 and 2 for 0, 0 - * and 2 for 1, and 0 and 1 for 2. - */ - static final byte[] otherCoordPairs = new byte[] {(byte)2, (byte)0, (byte)0, (byte)1, (byte)2, (byte)1}; - - /** random seed for GenBigTree */ - Random rand = new Random(); - - /** Reference to the World object. */ - World worldObj; - int[] basePos = new int[] {0, 0, 0}; - int heightLimit = 0; - int height; - double heightAttenuation = 0.45D; - double branchDensity = 1.0D; - double branchSlope = 0.0D; - double scaleWidth = 2.0D; - double leafDensity = 1.0D; - - /** - * Currently always 1, can be set to 2 in the class constructor to generate a double-sized tree trunk for big trees. - */ - int trunkSize = 2; - - /** - * Sets the limit of the random value used to initialize the height limit. - */ - int heightLimitLimit = 12; - - /** - * Sets the distance limit for how far away the generator will populate leaves from the base leaf node. - */ - int leafDistanceLimit = 4; - - /** Contains a list of a points at which to generate groups of leaves. */ - int[][] leafNodes; - - public PetrifiedTreeGen(boolean par1) - { - super(par1); - } - - /** - * Generates a list of leaf nodes for the tree, to be populated by generateLeaves. - */ - void generateLeafNodeList() - { - height = (int)(heightLimit * heightAttenuation); - - if (height >= heightLimit) - { - height = heightLimit - 1; - } - - int var1 = (int)(1.382D + Math.pow(leafDensity * heightLimit / 13.0D, 2.0D)); - - if (var1 < 1) - { - var1 = 1; - } - - int[][] var2 = new int[var1 * heightLimit][4]; - int var3 = basePos[1] + heightLimit - leafDistanceLimit; - int var4 = 1; - int var5 = basePos[1] + height; - int var6 = var3 - basePos[1]; - var2[0][0] = basePos[0]; - var2[0][1] = var3; - var2[0][2] = basePos[2]; - var2[0][3] = var5; - --var3; - - while (var6 >= 0) - { - int var7 = 0; - float var8 = this.layerSize(var6); - - if (var8 < 0.0F) - { - --var3; - --var6; - } - else - { - for (double var9 = 0.5D; var7 < var1; ++var7) - { - double var11 = scaleWidth * var8 * (rand.nextFloat() + 0.328D); - double var13 = rand.nextFloat() * 2.0D * Math.PI; - int var15 = MathHelper.floor_double(var11 * Math.sin(var13) + basePos[0] + var9); - int var16 = MathHelper.floor_double(var11 * Math.cos(var13) + basePos[2] + var9); - int[] var17 = new int[] {var15, var3, var16}; - int[] var18 = new int[] {var15, var3 + leafDistanceLimit, var16}; - - if (this.checkBlockLine(var17, var18) == -1) - { - int[] var19 = new int[] {basePos[0], basePos[1], basePos[2]}; - double var20 = Math.sqrt(Math.pow(Math.abs(basePos[0] - var17[0]), 2.0D) + Math.pow(Math.abs(basePos[2] - var17[2]), 2.0D)); - double var22 = var20 * branchSlope; - - if (var17[1] - var22 > var5) - { - var19[1] = var5; - } - else - { - var19[1] = (int)(var17[1] - var22); - } - - if (this.checkBlockLine(var19, var17) == -1) - { - var2[var4][0] = var15; - var2[var4][1] = var3; - var2[var4][2] = var16; - var2[var4][3] = var19[1]; - ++var4; - } - } - } - - --var3; - --var6; - } - } - - leafNodes = new int[var4][4]; - System.arraycopy(var2, 0, leafNodes, 0, var4); - } - - void genTreeLayer(int par1, int par2, int par3, float par4, byte par5, int par6) - { - int var7 = (int)(par4 + heightAttenuation); - byte var8 = otherCoordPairs[par5]; - byte var9 = otherCoordPairs[par5 + 3]; - int[] var10 = new int[] {par1, par2, par3}; - int[] var11 = new int[] {0, 0, 0}; - int var12 = -var7; - int var13 = -var7; - - for (var11[par5] = var10[par5]; var12 <= var7; ++var12) - { - var11[var8] = var10[var8] + var12; - var13 = -var7; - - while (var13 <= var7) - { - double var15 = Math.pow(Math.abs(var12) + 0.5D, 2.0D) + Math.pow(Math.abs(var13) + 0.5D, 2.0D); - - if (var15 > par4 * par4) - { - ++var13; - } - else - { - var11[var9] = var10[var9] + var13; - int var14 = worldObj.getBlockId(var11[0], var11[1], var11[2]); - - if (var14 != 0 && var14 != Block.leaves.blockID) - { - ++var13; - } - else - { - this.setBlockAndMetadata(worldObj, var11[0], var11[1], var11[2], par6, 0); - ++var13; - } - } - } - } - } - - /** - * Gets the rough size of a layer of the tree. - */ - float layerSize(int par1) - { - if (par1 < (heightLimit) * 0.3D) - return -1.618F; - else - { - float var2 = heightLimit / 2.0F; - float var3 = heightLimit / 2.0F - par1; - float var4; - - if (var3 == 0.0F) - { - var4 = var2; - } - else if (Math.abs(var3) >= var2) - { - var4 = 0.0F; - } - else - { - var4 = (float)Math.sqrt(Math.pow(Math.abs(var2), 2.0D) - Math.pow(Math.abs(var3), 2.0D)); - } - - var4 *= 0.5F; - return var4; - } - } - - float leafSize(int par1) - { - return par1 >= 0 && par1 < leafDistanceLimit ? (par1 != 0 && par1 != leafDistanceLimit - 1 ? 3.0F : 2.0F) : -1.0F; - } - - /** - * Generates the leaves surrounding an individual entry in the leafNodes list. - */ - void generateLeafNode(int par1, int par2, int par3) - { - int var4 = par2; - - for (int var5 = par2 + leafDistanceLimit; var4 < var5; ++var4) - { - float var6 = this.leafSize(var4 - par2); - this.genTreeLayer(par1, var4, par3, var6, (byte)1, Block.leaves.blockID); - } - } - - /** - * Places a line of the specified block ID into the world from the first coordinate triplet to the second. - */ - void placeBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger, int par3) - { - int[] var4 = new int[] {0, 0, 0}; - byte var5 = 0; - byte var6; - - for (var6 = 0; var5 < 3; ++var5) - { - var4[var5] = par2ArrayOfInteger[var5] - par1ArrayOfInteger[var5]; - - if (Math.abs(var4[var5]) > Math.abs(var4[var6])) - { - var6 = var5; - } - } - - if (var4[var6] != 0) - { - byte var7 = otherCoordPairs[var6]; - byte var8 = otherCoordPairs[var6 + 3]; - byte var9; - - if (var4[var6] > 0) - { - var9 = 1; - } - else - { - var9 = -1; - } - - double var10 = (double)var4[var7] / (double)var4[var6]; - double var12 = (double)var4[var8] / (double)var4[var6]; - int[] var14 = new int[] {0, 0, 0}; - int var15 = 0; - - for (int var16 = var4[var6] + var9; var15 != var16; var15 += var9) - { - var14[var6] = MathHelper.floor_double(par1ArrayOfInteger[var6] + var15 + 0.5D); - var14[var7] = MathHelper.floor_double(par1ArrayOfInteger[var7] + var15 * var10 + 0.5D); - var14[var8] = MathHelper.floor_double(par1ArrayOfInteger[var8] + var15 * var12 + 0.5D); - byte var17 = 3; - int var18 = Math.abs(var14[0] - par1ArrayOfInteger[0]); - int var19 = Math.abs(var14[2] - par1ArrayOfInteger[2]); - int var20 = Math.max(var18, var19); - - if (var20 > 0) - { - if (var18 == var20) - { - var17 = 8; - } - else if (var19 == var20) - { - var17 = 9; - } - } - - this.setBlockAndMetadata(worldObj, var14[0], var14[1], var14[2], par3, var17); - } - } - } - - /** - * Generates the leaf portion of the tree as specified by the leafNodes list. - */ - void generateLeaves() - { - int var1 = 0; - - for (int var2 = leafNodes.length; var1 < var2; ++var1) - { - int var3 = leafNodes[var1][0]; - int var4 = leafNodes[var1][1]; - int var5 = leafNodes[var1][2]; - //this.generateLeafNode(var3, var4, var5); - } - } - - /** - * Indicates whether or not a leaf node requires additional wood to be added to preserve integrity. - */ - boolean leafNodeNeedsBase(int par1) - { - return par1 >= heightLimit * 0.2D; - } - - /** - * Places the trunk for the big tree that is being generated. Able to generate double-sized trunks by changing a - * field that is always 1 to 2. - */ - void generateTrunk() - { - int var1 = basePos[0]; - int var2 = basePos[1]; - int var3 = basePos[1] + height; - int var4 = basePos[2]; - int[] var5 = new int[] {var1, var2, var4}; - int[] var6 = new int[] {var1, var3, var4}; - this.placeBlockLine(var5, var6, Block.stone.blockID); - //worldObj.setBlock(var1, var2 - 1, var4, Block.dirt.blockID); - - - if (trunkSize == 2) - { - ++var5[0]; - ++var6[0]; - this.placeBlockLine(var5, var6, Block.stone.blockID); - - ++var5[2]; - ++var6[2]; - this.placeBlockLine(var5, var6, Block.stone.blockID); - - var5[0] += -1; - var6[0] += -1; - this.placeBlockLine(var5, var6, Block.stone.blockID); - } - } - - /** - * Generates additional wood blocks to fill out the bases of different leaf nodes that would otherwise degrade. - */ - void generateLeafNodeBases() - { - int var1 = 0; - int var2 = leafNodes.length; - - for (int[] var3 = new int[] {basePos[0], basePos[1], basePos[2]}; var1 < var2; ++var1) - { - int[] var4 = leafNodes[var1]; - int[] var5 = new int[] {var4[0], var4[1], var4[2]}; - var3[1] = var4[3]; - int var6 = var3[1] - basePos[1]; - - if (this.leafNodeNeedsBase(var6)) - { - this.placeBlockLine(var3, var5, Block.stone.blockID); - } - } - } - - /** - * Checks a line of blocks in the world from the first coordinate to triplet to the second, returning the distance - * (in blocks) before a non-air, non-leaf block is encountered and/or the end is encountered. - */ - int checkBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger) - { - int[] var3 = new int[] {0, 0, 0}; - byte var4 = 0; - byte var5; - - for (var5 = 0; var4 < 3; ++var4) - { - var3[var4] = par2ArrayOfInteger[var4] - par1ArrayOfInteger[var4]; - - if (Math.abs(var3[var4]) > Math.abs(var3[var5])) - { - var5 = var4; - } - } - - if (var3[var5] == 0) - return -1; - else - { - byte var6 = otherCoordPairs[var5]; - byte var7 = otherCoordPairs[var5 + 3]; - byte var8; - - if (var3[var5] > 0) - { - var8 = 1; - } - else - { - var8 = -1; - } - - double var9 = (double)var3[var6] / (double)var3[var5]; - double var11 = (double)var3[var7] / (double)var3[var5]; - int[] var13 = new int[] {0, 0, 0}; - int var14 = 0; - int var15; - - for (var15 = var3[var5] + var8; var14 != var15; var14 += var8) - { - var13[var5] = par1ArrayOfInteger[var5] + var14; - var13[var6] = MathHelper.floor_double(par1ArrayOfInteger[var6] + var14 * var9); - var13[var7] = MathHelper.floor_double(par1ArrayOfInteger[var7] + var14 * var11); - int var16 = worldObj.getBlockId(var13[0], var13[1], var13[2]); - - if (var16 != 0 && var16 != Block.leaves.blockID) - { - break; - } - } - - return var14 == var15 ? -1 : Math.abs(var14); - } - } - - /** - * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height - * limit, is valid. - */ - boolean validTreeLocation() - { - int[] var1 = new int[] {basePos[0], basePos[1], basePos[2]}; - int[] var2 = new int[] {basePos[0], basePos[1] + heightLimit - 1, basePos[2]}; - int var3 = worldObj.getBlockId(basePos[0], basePos[1] - 1, basePos[2]); - - if (var3 != 2 && var3 != 3) - return false; - else - { - int var4 = this.checkBlockLine(var1, var2); - - if (var4 == -1) - return true; - else if (var4 < 6) - return false; - else - { - heightLimit = var4; - return true; - } - } - } - - /** - * Rescales the generator settings, only used in WorldGenBigTree - */ - @Override - public void setScale(double par1, double par3, double par5) - { - heightLimitLimit = (int)(par1 * 12.0D); - - if (par1 > 0.5D) - { - leafDistanceLimit = 5; - } - - scaleWidth = par3; - leafDensity = par5; - } - - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - worldObj = par1World; - long var6 = par2Random.nextLong(); - rand.setSeed(var6); - basePos[0] = par3; - basePos[1] = par4; - basePos[2] = par5; - - if (heightLimit == 0) - { - heightLimit = 12 + par2Random.nextInt(10); - } - - if (!this.validTreeLocation()) - return false; - else - { - this.generateLeafNodeList(); - this.generateLeaves(); - this.generateTrunk(); - this.generateLeafNodeBases(); - return true; - } - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/RainforestGen1.java b/minecraft_server/betterbiomes/feature/tree/RainforestGen1.java deleted file mode 100644 index b5f384e..0000000 --- a/minecraft_server/betterbiomes/feature/tree/RainforestGen1.java +++ /dev/null @@ -1,264 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.Direction; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class RainforestGen1 extends WorldGenerator -{ - /** The minimum height of a generated tree. */ - private final int minTreeHeight; - - /** True if this tree should grow Vines. */ - private final boolean vinesGrow; - - /** The metadata value of the wood to use in tree generation. */ - private final int metaWood; - - /** The metadata value of the leaves to use in tree generation. */ - private final int metaLeaves; - - public RainforestGen1(boolean par1) - { - this(par1, 8, 3, 3, false); - } - - public RainforestGen1(boolean par1, int par2, int par3, int par4, boolean par5) - { - super(par1); - minTreeHeight = par2; - metaWood = par3; - metaLeaves = par4; - vinesGrow = par5; - } - - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - int var6 = par2Random.nextInt(8) + minTreeHeight; - boolean var7 = true; - - if (par4 >= 1 && par4 + var6 + 1 <= 256) - { - int var8; - byte var9; - int var11; - int var12; - - for (var8 = par4; var8 <= par4 + 1 + var6; ++var8) - { - var9 = 1; - - if (var8 == par4) - { - var9 = 0; - } - - if (var8 >= par4 + 1 + var6 - 2) - { - var9 = 2; - } - - for (int var10 = par3 - var9; var10 <= par3 + var9 && var7; ++var10) - { - for (var11 = par5 - var9; var11 <= par5 + var9 && var7; ++var11) - { - if (var8 >= 0 && var8 < 256) - { - var12 = par1World.getBlockId(var10, var8, var11); - - if (var12 != 0 && var12 != Block.leaves.blockID && var12 != Block.grass.blockID && var12 != Block.dirt.blockID && var12 != Block.wood.blockID) - { - var7 = false; - } - } - else - { - var7 = false; - } - } - } - } - - if (!var7) - return false; - else - { - var8 = par1World.getBlockId(par3, par4 - 1, par5); - - if ((var8 == Block.grass.blockID || var8 == Block.dirt.blockID) && par4 < 256 - var6 - 1) - { - this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); - var9 = 3; - byte var18 = 0; - int var13; - int var14; - int var15; - - for (var11 = par4 - var9 + var6; var11 <= par4 + var6; ++var11) - { - var12 = var11 - (par4 + var6); - var13 = var18 + 1 - var12; - - for (var14 = par3 - var13; var14 <= par3 + var13; ++var14) - { - var15 = var14 - par3; - - for (int var16 = par5 - var13; var16 <= par5 + var13; ++var16) - { - int var17 = var16 - par5; - - if ((Math.abs(var15) != var13 || Math.abs(var17) != var13 || par2Random.nextInt(2) != 0 && var12 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var14, var11, var16)]) - { - this.setBlockAndMetadata(par1World, var14, var11, var16, Block.leaves.blockID, metaLeaves); - } - } - } - } - - for (var11 = 0; var11 < var6; ++var11) - { - var12 = par1World.getBlockId(par3, par4 + var11, par5); - - if (var12 == 0 || var12 == Block.leaves.blockID) - { - this.setBlockAndMetadata(par1World, par3, par4 + var11, par5, Block.wood.blockID, metaWood); - this.setBlockAndMetadata(par1World, par3 - 3, par4 + (var6 - 3), par5, Block.wood.blockID, 7); - this.setBlockAndMetadata(par1World, par3 + 3, par4 + (var6 - 3), par5, Block.wood.blockID, 7); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 3), par5 - 3, Block.wood.blockID, 11); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 3), par5 + 3, Block.wood.blockID, 11); - this.setBlockAndMetadata(par1World, par3 - 2, par4 + (var6 - 4), par5, Block.wood.blockID, metaWood); - this.setBlockAndMetadata(par1World, par3 + 2, par4 + (var6 - 4), par5, Block.wood.blockID, metaWood); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 4), par5 - 2, Block.wood.blockID, metaWood); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 4), par5 + 2, Block.wood.blockID, metaWood); - this.setBlockAndMetadata(par1World, par3 - 2, par4 + (var6 - 5), par5, Block.wood.blockID, metaWood); - this.setBlockAndMetadata(par1World, par3 + 2, par4 + (var6 - 5), par5, Block.wood.blockID, metaWood); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 5), par5 - 2, Block.wood.blockID, metaWood); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 5), par5 + 2, Block.wood.blockID, metaWood); - this.setBlockAndMetadata(par1World, par3 - 1, par4 + (var6 - 6), par5, Block.wood.blockID, 7); - this.setBlockAndMetadata(par1World, par3 + 1, par4 + (var6 - 6), par5, Block.wood.blockID, 7); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 6), par5 - 1, Block.wood.blockID, 11); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 6), par5 + 1, Block.wood.blockID, 11); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 3), par5, Block.leaves.blockID, metaLeaves); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 2), par5, Block.leaves.blockID, metaLeaves); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 1), par5, Block.leaves.blockID, metaLeaves); - this.setBlockAndMetadata(par1World, par3, par4 + (var6), par5, Block.leaves.blockID, metaLeaves); - this.setBlock(par1World, par3, par4 + (var6 - 4), par5, 0); - this.setBlock(par1World, par3, par4 + (var6 - 5), par5, 0); - this.setBlockAndMetadata(par1World, par3 - 1, par4 + (var6 - 3), par5, Block.wood.blockID, 7); - this.setBlockAndMetadata(par1World, par3 + 1, par4 + (var6 - 3), par5, Block.wood.blockID, 7); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 3), par5 - 1, Block.wood.blockID, 11); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 3), par5 + 1, Block.wood.blockID, 11); - this.setBlockAndMetadata(par1World, par3, par4 + (var6 - 2), par5, Block.wood.blockID, metaWood); - - if (vinesGrow && var11 > 0) - { - if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(par3 - 1, par4 + var11, par5)) - { - this.setBlockAndMetadata(par1World, par3 - 1, par4 + var11, par5, Block.vine.blockID, 8); - } - - if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(par3 + 1, par4 + var11, par5)) - { - this.setBlockAndMetadata(par1World, par3 + 1, par4 + var11, par5, Block.vine.blockID, 2); - } - - if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(par3, par4 + var11, par5 - 1)) - { - this.setBlockAndMetadata(par1World, par3, par4 + var11, par5 - 1, Block.vine.blockID, 1); - } - - if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(par3, par4 + var11, par5 + 1)) - { - this.setBlockAndMetadata(par1World, par3, par4 + var11, par5 + 1, Block.vine.blockID, 4); - } - } - } - } - - par1World.setBlockMetadataWithClient(par3, par4, par5, metaWood | 12); // place stump - - if (vinesGrow) - { - for (var11 = par4 - 3 + var6; var11 <= par4 + var6; ++var11) - { - var12 = var11 - (par4 + var6); - var13 = 2 - var12 / 2; - - for (var14 = par3 - var13; var14 <= par3 + var13; ++var14) - { - for (var15 = par5 - var13; var15 <= par5 + var13; ++var15) - { - if (par1World.getBlockId(var14, var11, var15) == Block.leaves.blockID) - { - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var14 - 1, var11, var15) == 0) - { - this.growVines(par1World, var14 - 1, var11, var15, 8); - } - - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var14 + 1, var11, var15) == 0) - { - this.growVines(par1World, var14 + 1, var11, var15, 2); - } - - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var14, var11, var15 - 1) == 0) - { - this.growVines(par1World, var14, var11, var15 - 1, 1); - } - - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var14, var11, var15 + 1) == 0) - { - this.growVines(par1World, var14, var11, var15 + 1, 4); - } - } - } - - if (par2Random.nextInt(5) == 0 && var6 > 5) - { - for (int i = 0; i < 2; ++i) - { - for (int j = 0; j < 4; ++j) - { - if (par2Random.nextInt(4 - i) == 0) - { - var13 = par2Random.nextInt(3); - this.setBlockAndMetadata(par1World, par3 + Direction.offsetX[Direction.footInvisibleFaceRemap[j]], par4 + var6 - 5 + i, par5 + Direction.offsetZ[Direction.footInvisibleFaceRemap[j]], Block.cocoaPlant.blockID, var13 << 2 | j); - } - } - } - } - } - } - } - - return true; - } else - return false; - } - } else - return false; - } - - /** - * Grows vines downward from the given block for a given length. Args: World, x, starty, z, vine-length - */ - private void growVines(World par1World, int par2, int par3, int par4, int par5) - { - this.setBlockAndMetadata(par1World, par2, par3, par4, Block.vine.blockID, par5); - int var6 = 4; - - while (true) - { - --par3; - - if (par1World.getBlockId(par2, par3, par4) != 0 || var6 <= 0) - return; - - this.setBlockAndMetadata(par1World, par2, par3, par4, Block.vine.blockID, par5); - --var6; - } - } -} diff --git a/minecraft_server/betterbiomes/feature/tree/RainforestGen2.java b/minecraft_server/betterbiomes/feature/tree/RainforestGen2.java deleted file mode 100644 index e2fa106..0000000 --- a/minecraft_server/betterbiomes/feature/tree/RainforestGen2.java +++ /dev/null @@ -1,180 +0,0 @@ -package betterbiomes.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.Material; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class RainforestGen2 extends WorldGenerator -{ - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - int var6; - - for (var6 = par2Random.nextInt(4) + 8; par1World.getBlockMaterial(par3, par4 - 1, par5) == Material.water; --par4) - { - ; - } - - boolean var7 = true; - - if (par4 >= 1 && par4 + var6 + 1 <= 128) - { - int var8; - int var10; - int var11; - int var12; - - for (var8 = par4; var8 <= par4 + 1 + var6; ++var8) - { - byte var9 = 1; - - if (var8 == par4) - { - var9 = 0; - } - - if (var8 >= par4 + 1 + var6 - 2) - { - var9 = 3; - } - - for (var10 = par3 - var9; var10 <= par3 + var9 && var7; ++var10) - { - for (var11 = par5 - var9; var11 <= par5 + var9 && var7; ++var11) - { - if (var8 >= 0 && var8 < 128) - { - var12 = par1World.getBlockId(var10, var8, var11); - - if (var12 != 0 && var12 != Block.leaves.blockID) - { - if (var12 != Block.waterStill.blockID && var12 != Block.waterMoving.blockID) - { - var7 = false; - } - else if (var8 > par4) - { - var7 = false; - } - } - } - else - { - var7 = false; - } - } - } - } - - if (!var7) - return false; - else - { - var8 = par1World.getBlockId(par3, par4 - 1, par5); - - if ((var8 == Block.grass.blockID || var8 == Block.dirt.blockID) && par4 < 128 - var6 - 1) - { - this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); - int var13; - int var16; - - for (var16 = par4 - 3 + var6; var16 <= par4 + var6; ++var16) - { - var10 = var16 - (par4 + var6); - var11 = 2 - var10 / 2; - - for (var12 = par3 - var11; var12 <= par3 + var11; ++var12) - { - var13 = var12 - par3; - - for (int var14 = par5 - var11; var14 <= par5 + var11; ++var14) - { - int var15 = var14 - par5; - - if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var12, var16, var14)]) - { - this.setBlockAndMetadata(par1World, var12, var16, var14, Block.leaves.blockID, 3); - } - } - } - } - - for (var16 = 0; var16 < var6; ++var16) - { - var10 = par1World.getBlockId(par3, par4 + var16, par5); - - if (var10 == 0 || var10 == Block.leaves.blockID || var10 == Block.waterMoving.blockID || var10 == Block.waterStill.blockID) - { - this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 3); - } - } - - par1World.setBlockMetadataWithClient(par3, par4, par5, 3 | 12); // place stump - - for (var16 = par4 - 3 + var6; var16 <= par4 + var6; ++var16) - { - var10 = var16 - (par4 + var6); - var11 = 2 - var10 / 2; - - for (var12 = par3 - var11; var12 <= par3 + var11; ++var12) - { - for (var13 = par5 - var11; var13 <= par5 + var11; ++var13) - { - if (par1World.getBlockId(var12, var16, var13) == Block.leaves.blockID) - { - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var12 - 1, var16, var13) == 0) - { - this.generateVines(par1World, var12 - 1, var16, var13, 8); - } - - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var12 + 1, var16, var13) == 0) - { - this.generateVines(par1World, var12 + 1, var16, var13, 2); - } - - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var12, var16, var13 - 1) == 0) - { - this.generateVines(par1World, var12, var16, var13 - 1, 1); - } - - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var12, var16, var13 + 1) == 0) - { - this.generateVines(par1World, var12, var16, var13 + 1, 4); - } - } - } - } - } - - return true; - } else - return false; - } - } else - return false; - } - - /** - * Generates vines at the given position until it hits a block. - */ - private void generateVines(World par1World, int par2, int par3, int par4, int par5) - { - this.setBlockAndMetadata(par1World, par2, par3, par4, Block.vine.blockID, par5); - int var6 = 4; - - while (true) - { - --par3; - - if (par1World.getBlockId(par2, par3, par4) != 0 || var6 <= 0) - return; - - this.setBlockAndMetadata(par1World, par2, par3, par4, Block.vine.blockID, par5); - --var6; - } - } -} diff --git a/minecraft_server/betterbiomes/world/generate/surface/AlpineSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/AlpineSurfaceBuilder.java deleted file mode 100644 index da0da9d..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/AlpineSurfaceBuilder.java +++ /dev/null @@ -1,60 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterterrain.feature.tree.PineTreeGen; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenerator; - -public class AlpineSurfaceBuilder extends SurfaceBuilder { - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random treeRand = new Random(seed + 2000); - - this.treeNoiseGen = new OpenSimplexOctaves(treeRand.nextLong(), 2); - } - - public void generateTreesForBiome(World world, Random rand, WorldConfigurationInfo generatorInfo) { - int numTrees = 20; - - for (int i = 0; i < numTrees; ++i) - { - int x = this.chunkX + rand.nextInt(16) + 8; - int z = this.chunkZ + rand.nextInt(16) + 8; - - WorldGenerator gen; - - if (this.treeNoiseGen.noise2(x, z, this.treeNoiseScale) - .25 > 0) { - if (rand.nextInt(5) == 0) { - gen = new TaigaGen5(false); - } - else { - gen = new PineTreeGen(false, 2, 2); - } - } - else { - if (rand.nextInt(3) == 0) { - gen = new TaigaGen5(false); - } - else { - gen = new WorldGenTaiga2(false); - } - } - - if (world.getHeightValue(x, z) > 85 && rand.nextInt(3) == 0) - continue; - if (world.getHeightValue(x, z) > 100 && rand.nextInt(2) == 0) - continue; - - gen.setScale(1.0D, 1.0D, 1.0D); - gen.generate(world, rand, x, world.getHeightValue(x, z), z); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/AncientForestSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/AncientForestSurfaceBuilder.java deleted file mode 100644 index 8ced104..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/AncientForestSurfaceBuilder.java +++ /dev/null @@ -1,56 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterbiomes.feature.tree.OldOakGen; -import betterterrain.BTAVersion; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenBigTree; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenerator; - -public class AncientForestSurfaceBuilder extends SurfaceBuilder { - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random treeRand = new Random(seed + 2000); - - this.treeNoiseGen = new OpenSimplexOctaves(treeRand.nextLong(), 2); - - this.treeNoiseScale = 1/256D; - } - - public void generateTreesForBiome(World world, Random rand, WorldConfigurationInfo generatorInfo) { - if (generatorInfo.getBTAVersion().isVersionAtLeast(BTAVersion.V2_0_0)) { - int numTrees = (int) (8 + 2.9 * treeNoiseGen.noise2(this.chunkX + 16, this.chunkZ + 16, treeNoiseScale)); - - for (int i = 0; i < numTrees; ++i) - { - int x = this.chunkX + rand.nextInt(16) + 8; - int z = this.chunkZ + rand.nextInt(16) + 8; - - WorldGenerator gen; - - if (rand.nextInt(7) == 0) { - gen = new OldOakGen(false); - } - else if (rand.nextInt(2) == 0) { - gen = new WorldGenBigTree(false); - } - else { - gen = new WorldGenTrees(false, 6, 0, 0, false); - } - - gen.setScale(1.0D, 1.0D, 1.0D); - gen.generate(world, rand, x, world.getHeightValue(x, z), z); - } - } - else { - super.generateTreesForBiome(world, rand, generatorInfo); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/AshFieldsSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/AshFieldsSurfaceBuilder.java deleted file mode 100644 index 141aed2..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/AshFieldsSurfaceBuilder.java +++ /dev/null @@ -1,44 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.NetherSurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.WorldType; - -public class AshFieldsSurfaceBuilder extends NetherSurfaceBuilder { - protected static OpenSimplexOctaves pumiceNoiseGen; - protected static OpenSimplexOctaves pumiceNoiseGen2; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random pumiceRand = new Random(seed + 3000); - - pumiceNoiseGen = new OpenSimplexOctaves(pumiceRand.nextLong(), 2); - pumiceNoiseGen2 = new OpenSimplexOctaves(pumiceRand.nextLong(), 2); - } - - @Override - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, boolean isReversed, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - double pumiceNoiseScale = 0.0625D; - //k and i swapped because apparently I messed something up somewhere - boolean usePumice = pumiceNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), pumiceNoiseScale) > 0.2; - boolean usePumice2 = pumiceNoiseGen2.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), pumiceNoiseScale) > 0.2; - - if (usePumice && DecoIntegration.isDecoInstalled() && worldType.isDeco() && surfaceType != SurfaceType.SUBFILLER) { - return new int[] {DecoIntegration.pumice.blockID, 0}; - } - else if (usePumice2 && DecoIntegration.isDecoInstalled() && worldType.isDeco() && surfaceType != SurfaceType.SUBFILLER) { - return new int[] {DecoIntegration.pumice.blockID, 0}; - } - else { - return super.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, surfaceType, seaLevel, rand, generatorInfo, worldType); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/BadlandsPlateauSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/BadlandsPlateauSurfaceBuilder.java deleted file mode 100644 index a744818..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/BadlandsPlateauSurfaceBuilder.java +++ /dev/null @@ -1,89 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.ArrayList; -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.Block; -import net.minecraft.src.WorldType; - -public class BadlandsPlateauSurfaceBuilder extends SurfaceBuilder { - private static ArrayList allowedTerracottaMetadata = new ArrayList(); - private static int[] metaLocations; - protected static OpenSimplexOctaves grassNoiseGenSimplex; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random metaRand = new Random(seed); - - //Init terracotta striping data - done statically in case multiple badlands variants use this surface builder - if (allowedTerracottaMetadata.size() == 0) { - allowedTerracottaMetadata.add(1); - allowedTerracottaMetadata.add(3); - allowedTerracottaMetadata.add(7); - allowedTerracottaMetadata.add(11); - allowedTerracottaMetadata.add(14); - allowedTerracottaMetadata.add(15); - } - - if (metaLocations == null) { - metaLocations = new int[128]; - - for (int i = 0; i < metaLocations.length; i++) { - int meta = metaRand.nextInt(16); - - if (allowedTerracottaMetadata.contains(meta)) { - metaLocations[i] = meta; - } - else { - //Tries a second time to place a colored stripe - meta = metaRand.nextInt(16); - - if (allowedTerracottaMetadata.contains(meta)) { - metaLocations[i] = meta; - } - else { - metaLocations[i] = -1; - } - } - } - } - - grassNoiseGenSimplex = new OpenSimplexOctaves(metaRand.nextLong(), 2); - } - - @Override - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - double grassNoiseScale = 1/256D; - //k and i swapped because apparently I messed something up somewhere - boolean useGrass = grassNoiseGenSimplex.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), grassNoiseScale) + rand.nextDouble() * 0.15D - 0.125 > 0; - - if (useGrass && surfaceType == SurfaceType.TOP && j >= 95) { - return new int[] {Block.grass.blockID, 0}; - } - else { - int blockID = DecoIntegration.terracotta.blockID; - int metadata = 0; - - if (blockID == DecoIntegration.terracotta.blockID && metaLocations[j & 15] != -1) { - if (j < 95 || (j < 127 && j != surfaceJ)) { - blockID = DecoIntegration.stainedTerracotta.blockID; - metadata = metaLocations[j & 15]; - } - } - - return new int[] {blockID, metadata}; - } - } - - @Override - protected int getSubsurfaceDepth(Random rand) { - return 10; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/BasaltDeltasSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/BasaltDeltasSurfaceBuilder.java deleted file mode 100644 index 6cd71ba..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/BasaltDeltasSurfaceBuilder.java +++ /dev/null @@ -1,136 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceProcessingResult; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.Material; -import net.minecraft.src.WorldType; - -public class BasaltDeltasSurfaceBuilder extends SurfaceBuilder { - public OpenSimplexOctaves lavaNoiseGen; - public OpenSimplexOctaves spikeNoiseGen; - public OpenSimplexOctaves spikeHeightNoiseGen; - public OpenSimplexOctaves ashNoiseGen; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random noiseRand = new Random(seed + 2500); - - lavaNoiseGen = new OpenSimplexOctaves(noiseRand.nextLong(), 8); - spikeNoiseGen = new OpenSimplexOctaves(noiseRand.nextLong(), 8); - spikeHeightNoiseGen = new OpenSimplexOctaves(noiseRand.nextLong(), 8); - ashNoiseGen = new OpenSimplexOctaves(noiseRand.nextLong(), 2); - } - - @Override - protected void replaceBlocksForBiome(Random rand, int i, int k, int[] blockArray, int[] metaArray, BiomeGenBase[] biomesForGeneration, WorldConfigurationInfo generatorInfo, WorldType worldType, boolean isNether) { - byte seaLevel = 63; - - if (worldType.isSky() || isNether) - seaLevel = 0; - - float temperature = biome.getFloatTemperature(); - - int soilDepth = getSoilDepth(i, k, rand, generatorInfo); - int remainingDepth = -1; - - boolean useSubfiller = false; - - int surfaceJ = 127; - - for (int j = 127; j >= 0; j--) { - if (j <= 0 + rand.nextInt(5) && !worldType.isSky()) { - setBlockValue(blockArray, i, j, k, Block.bedrock.blockID); - } - else { - SurfaceProcessingResult result = generateSurfaceAtLocation(blockArray, metaArray, i, j, k, surfaceJ, soilDepth, remainingDepth, useSubfiller, seaLevel, temperature, true, rand, generatorInfo, worldType); - remainingDepth = result.remainingDepth; - useSubfiller = result.useSubfiller; - surfaceJ = result.surfaceJ; - } - } - - surfaceJ = 0; - - int lastBlockId = 1; - //boolean useSpikes = spikeNoiseGen.noise2(this.chunkX * 16 + k, this.chunkZ * 16 + i, 1/24D) + rand.nextDouble() * 0.2 > 0; - int spikeHeightBase = (int) ((spikeHeightNoiseGen.noise2(this.chunkX * 16 + k, this.chunkZ * 16 + i, 1/24D)) * 6); - boolean useSpikes = spikeHeightBase > 0; - int spikeHeight = spikeHeightBase; - - for (int j = 0; j <= 127; j++) { - if (j >= 127 - rand.nextInt(5) && !worldType.isSky()) { - setBlockValue(blockArray, i, j, k, Block.bedrock.blockID); - } - else { - - int blockID = getBlockValue(blockArray, i, j, k); - - if (blockID == 0) { - remainingDepth = -1; - - if ((lastBlockId != 0 && lastBlockId != Block.lavaStill.blockID) && spikeHeight > 0 && useSpikes) { - int[] fillerBlock = this.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, SurfaceType.FILLER, seaLevel, rand, generatorInfo, worldType); - - setBlockValue(blockArray, i, j, k, fillerBlock[0]); - setBlockValue(metaArray, i, j, k, fillerBlock[1]); - - spikeHeight -= rand.nextInt(3); - } - } - else if (Block.blocksList[blockID].blockMaterial == Material.lava) { - spikeHeight = 0; - } - else if (blockID == Block.stone.blockID || blockID == Block.netherrack.blockID) { - if (remainingDepth == -1) { - remainingDepth = soilDepth; - surfaceJ = j; - - int[] surfaceBlock = this.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, SurfaceType.TOP, seaLevel, rand, generatorInfo, worldType); - - setBlockValue(blockArray, i, j, k, surfaceBlock[0]); - setBlockValue(metaArray, i, j, k, surfaceBlock[1]); - } - else if (remainingDepth > 0) { - remainingDepth--; - - SurfaceType surfaceType = useSubfiller ? SurfaceType.SUBFILLER : SurfaceType.FILLER; - - int[] fillerBlock = this.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, surfaceType, seaLevel, rand, generatorInfo, worldType); - - setBlockValue(blockArray, i, j, k, fillerBlock[0]); - setBlockValue(metaArray, i, j, k, fillerBlock[1]); - - spikeHeight = spikeHeightBase; - } - } - } - } - } - - @Override - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - double ashNoiseScale = 0.0625D; - //k and i swapped because apparently I messed something up somewhere - boolean useAsh = ashNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), ashNoiseScale) > 0.2; - - int spikeHeightBase = (int) ((spikeHeightNoiseGen.noise2(this.chunkX * 16 + k, this.chunkZ * 16 + i, 1/24D)) * 6); - boolean useSpikes = spikeHeightBase > 0; - - if (useAsh && DecoIntegration.isDecoInstalled() && worldType.isDeco() && surfaceType != SurfaceType.SUBFILLER && !useSpikes) { - return new int[] {DecoIntegration.ash.blockID, 0}; - } - else { - return super.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, surfaceType, seaLevel, rand, generatorInfo, worldType); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/HeathlandSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/HeathlandSurfaceBuilder.java deleted file mode 100644 index c51cf9a..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/HeathlandSurfaceBuilder.java +++ /dev/null @@ -1,53 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenerator; - -public class HeathlandSurfaceBuilder extends SurfaceBuilder { - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random treeRand = new Random(seed + 2000); - - this.treeNoiseGen = new OpenSimplexOctaves(treeRand.nextLong(), 2); - - this.treeNoiseScale = 1/256D; - } - - public void generateTreesForBiome(World world, Random rand, WorldConfigurationInfo generatorInfo) { - int numTrees = 12; - - for (int i = 0; i < numTrees; ++i) - { - int x = this.chunkX + rand.nextInt(16) + 8; - int z = this.chunkZ + rand.nextInt(16) + 8; - - WorldGenerator gen; - - if (this.treeNoiseGen.noise2(x, z, this.treeNoiseScale) - .5 > 0) { - gen = new WorldGenTaiga2(false); - } - else if (rand.nextInt(12) < 7) { - if (rand.nextInt(3) == 0) { - gen = new WorldGenTrees(false); - } - else { - gen = new WorldGenShrub(0,0); - } - } - else continue; - - gen.setScale(1.0D, 1.0D, 1.0D); - gen.generate(world, rand, x, world.getHeightValue(x, z), z); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/HotSpringsSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/HotSpringsSurfaceBuilder.java deleted file mode 100644 index 9d4f513..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/HotSpringsSurfaceBuilder.java +++ /dev/null @@ -1,184 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.ArrayList; -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.NoShorelineSurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.Block; -import net.minecraft.src.FCUtilsColor; -import net.minecraft.src.Material; -import net.minecraft.src.World; -import net.minecraft.src.WorldType; - -public class HotSpringsSurfaceBuilder extends NoShorelineSurfaceBuilder { - public OpenSimplexOctaves springsNoiseGen; - protected OpenSimplexOctaves coarseDirtNoiseGen; - - private final boolean generateSprings; - - private static ArrayList springBiomes = new ArrayList(); - - public HotSpringsSurfaceBuilder(int biomeID, boolean generateSprings) { - this.generateSprings = generateSprings; - springBiomes.add(biomeID); - } - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random noiseRand = new Random(seed + 2500); - - springsNoiseGen = new OpenSimplexOctaves(noiseRand.nextLong(), 6); - coarseDirtNoiseGen = new OpenSimplexOctaves(noiseRand.nextLong(), 4); - } - - @Override - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - double grassNoiseScale = 1/48D; - //k and i swapped because apparently I messed something up somewhere - boolean useCoarseDirt = coarseDirtNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), grassNoiseScale) + rand.nextDouble() * 0.1D - .25 > 0; - - if (useCoarseDirt && DecoIntegration.isDecoInstalled() && worldType.isDeco() && surfaceType == SurfaceType.TOP) { - return new int[] {DecoIntegration.coarseDirt.blockID, 0}; - } - else { - return super.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, surfaceType, seaLevel, rand, generatorInfo, worldType); - } - } - - @Override - public void decorateSurface(World world, Random rand, BTABiome biome, int chunkX, int chunkZ, WorldConfigurationInfo generatorOptions) { - if (this.generateSprings) { - for (int i = chunkX + 8; i < chunkX + 24; i++) { - for (int k = chunkZ + 8; k < chunkZ + 24; k++) { - if (!this.springBiomes.contains(world.getBiomeGenForCoords(i, k).biomeID)) { - continue; - } - - double waterNoiseScale = 1/192D; - double waterNoise = springsNoiseGen.noise2(i, k, waterNoiseScale); - - int previousBlockID = -1; - int thisBlockID = -1; - int nextBlockID = -1; - - int depth = this.getSoilDepth(i - chunkX - 8, k - chunkZ - 8, rand, generatorOptions); - - for (int j = 60; j < 128; j++) { - if (previousBlockID == -1) { - previousBlockID = world.getBlockId(i, j - 1, k); - thisBlockID = world.getBlockId(i, j, k); - nextBlockID = world.getBlockId(i, j + 1, k); - } - else { - previousBlockID = thisBlockID; - thisBlockID = nextBlockID; - nextBlockID = world.getBlockId(i, j + 1, k); - } - - if (nextBlockID != 0 && Block.blocksList[nextBlockID].blockMaterial.isReplaceable() && Block.blocksList[nextBlockID].blockMaterial != Material.water) { - world.setBlockToAir(i, j + 1, k); - nextBlockID = 0; - } - - if (previousBlockID != 0 && previousBlockID != Block.waterStill.blockID && - (thisBlockID == ((BTABiome) this.biome).topBlockExt || thisBlockID == DecoIntegration.stainedTerracotta.blockID || thisBlockID == DecoIntegration.coarseDirt.blockID) && - nextBlockID == 0) - { - if (waterNoise > 0.825) { - int numBlockNeighbors = 8; - - for (int offsetI = -1; offsetI <= 1; offsetI++) { - for (int offsetK = -1; offsetK <= 1; offsetK++) { - if (offsetI == 0 && offsetK == 0) { - continue; - } - - int neighborID = world.getBlockId(i + offsetI, j, k + offsetK); - int neighborAboveID = world.getBlockId(i + offsetI, j + 1, k + offsetK); - - if (neighborID == 0 || neighborAboveID != 0) { - numBlockNeighbors--; - } - } - } - - if (numBlockNeighbors == 8) { - world.setBlock(i, j, k, Block.waterStill.blockID); - fillToDepth(world, i, j - 1, k, depth, DecoIntegration.stainedTerracotta.blockID, FCUtilsColor.YELLOW.colorID); - } - else { - fillToDepth(world, i, j, k, depth + 1, DecoIntegration.redSand.blockID, 0); - } - - for (int offsetI = -1; offsetI <= 1; offsetI++) { - for (int offsetK = -1; offsetK <= 1; offsetK++) { - if (offsetI == 0 && offsetK == 0) { - break; - } - - if (springsNoiseGen.noise2(i + offsetI, k + offsetK, waterNoiseScale) <= 0.825) { - fillToDepth(world, i + offsetI, j, k + offsetK, 4, DecoIntegration.redSand.blockID, 0); - } - } - } - } - else if (waterNoise > 0.75) { - fillToDepth(world, i, j, k, depth + 1, DecoIntegration.redSand.blockID, 0); - } - else if (waterNoise > 0.625) { - fillToDepth(world, i, j, k, depth + 1, DecoIntegration.infusedStone.blockID, 0); - } - else if (waterNoise > 0.5) { - fillToDepth(world, i, j, k, depth + 1, DecoIntegration.basalt.blockID, 0); - } - else if (waterNoise > 0.375) { - fillToDepth(world, i, j, k, depth + 1, Block.gravel.blockID, 0); - } - else if (waterNoise > 0.125) { - fillToDepth(world, i, j, k, depth + 1, DecoIntegration.stoneTypes.blockID, 2); - } - } - } - } - } - - for (int i = chunkX + 8; i < chunkX + 24; i++) { - for (int k = chunkZ + 8; k < chunkZ + 24; k++) { - for (int j = 60; j < 128; j++) { - if (world.getBlockId(i, j, k) == DecoIntegration.redSand.blockID) { - for (int offsetI = -1; offsetI <= 1; offsetI++) { - for (int offsetK = -1; offsetK <= 1; offsetK++) { - if (offsetI == 0 && offsetK == 0) { - break; - } - - int blockID = world.getBlockId(i + offsetI, j, k + offsetK); - - if (blockID != 0 && Block.blocksList[blockID].blockMaterial == Material.water) { - fillToDepth(world, i, j, k, 1, DecoIntegration.stainedTerracotta.blockID, FCUtilsColor.YELLOW.colorID); - } - } - } - } - } - } - } - } - } - - private void fillToDepth(World world, int x, int y, int z, int depth, int blockID, int metadata) { - for (int i = 0; i < depth; i++) { - if (world.getBlockId(x, y - i, z) != 0) { - world.setBlockAndMetadata(x, y - i, z, blockID, metadata); - } - } - } -} diff --git a/minecraft_server/betterbiomes/world/generate/surface/IvoryHillsSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/IvoryHillsSurfaceBuilder.java deleted file mode 100644 index f9b0474..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/IvoryHillsSurfaceBuilder.java +++ /dev/null @@ -1,96 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.ArrayList; -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.Block; -import net.minecraft.src.FCUtilsColor; -import net.minecraft.src.WorldType; - -public class IvoryHillsSurfaceBuilder extends SurfaceBuilder { - private static int[] metaLocations; - - protected OpenSimplexOctaves grassNoiseGen; - protected OpenSimplexOctaves coarseDirtNoiseGen; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random metaRand = new Random(seed); - - if (metaLocations == null) { - metaLocations = new int[128]; - - for (int i = 0; i < metaLocations.length; i++) { - switch (metaRand.nextInt(3)) { - case 0: - metaLocations[i] = FCUtilsColor.BROWN.colorID; - break; - case 1: - metaLocations[i] = FCUtilsColor.BLACK.colorID; - break; - default: - metaLocations[i] = FCUtilsColor.WHITE.colorID; - } - } - } - - grassNoiseGen = new OpenSimplexOctaves(metaRand.nextLong(), 4); - coarseDirtNoiseGen = new OpenSimplexOctaves(metaRand.nextLong(), 4); - } - - @Override - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - double dirtNoiseScale = 1/256D; - //k and i swapped because apparently I messed something up somewhere - boolean useCoarseDirt = coarseDirtNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), dirtNoiseScale) + rand.nextDouble() * 0.15D > -0.125; - - useCoarseDirt = useCoarseDirt && j >= 85; - - if (useCoarseDirt) { - double grassNoiseScale = 1/48D; - //k and i swapped because apparently I messed something up somewhere - boolean useGrass = grassNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), grassNoiseScale) + rand.nextDouble() * 0.15D > -0.125; - - if (surfaceType == SurfaceType.TOP) { - if (useGrass) { - if (j >= seaLevel - 1) { - return new int[] {Block.grass.blockID, 0}; - } - else { - return new int[] {Block.dirt.blockID, 0}; - } - } - else { - return new int[] {DecoIntegration.coarseDirt.blockID, 0}; - } - } - } - - if (!useCoarseDirt || surfaceType != SurfaceType.TOP) { - int blockID = DecoIntegration.terracotta.blockID; - int metadata = 0; - - if (blockID == DecoIntegration.terracotta.blockID && metaLocations[j & 15] != -1) { - blockID = DecoIntegration.stainedTerracotta.blockID; - metadata = metaLocations[j & 15]; - } - - return new int[] {blockID, metadata}; - } - - //Make the compiler happy - return null; - } - - @Override - protected int getSubsurfaceDepth(Random rand) { - return 10; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/LushDesertSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/LushDesertSurfaceBuilder.java deleted file mode 100644 index 1e44dfc..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/LushDesertSurfaceBuilder.java +++ /dev/null @@ -1,125 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterterrain.BTAVersion; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.NoShorelineSurfaceBuilder; -import net.minecraft.src.Block; -import net.minecraft.src.FCUtilsColor; -import net.minecraft.src.Material; -import net.minecraft.src.World; - -public class LushDesertSurfaceBuilder extends NoShorelineSurfaceBuilder { - public OpenSimplexOctaves springsNoiseGen; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random noiseRand = new Random(seed + 2500); - - springsNoiseGen = new OpenSimplexOctaves(noiseRand.nextLong(), 6); - } - - @Override - public void decorateSurface(World world, Random rand, BTABiome biome, int chunkX, int chunkZ, WorldConfigurationInfo generatorOptions) { - if (generatorOptions.getBTAVersion().isVersionAtLeast(BTAVersion.V3_0_0)) { - for (int i = chunkX + 8; i < chunkX + 24; i++) { - for (int k = chunkZ + 8; k < chunkZ + 24; k++) { - if (world.getBiomeGenForCoords(i, k) != this.biome) { - continue; - } - - double waterNoiseScale = 1/192D; - double waterNoise = springsNoiseGen.noise2(i, k, waterNoiseScale); - - int previousBlockID = -1; - int thisBlockID = -1; - int nextBlockID = -1; - - int depth = this.getSoilDepth(i - chunkX - 8, k - chunkZ - 8, rand, generatorOptions); - - for (int j = 60; j < 65; j++) { - if (previousBlockID == -1) { - previousBlockID = world.getBlockId(i, j - 1, k); - thisBlockID = world.getBlockId(i, j, k); - nextBlockID = world.getBlockId(i, j + 1, k); - } - else { - previousBlockID = thisBlockID; - thisBlockID = nextBlockID; - nextBlockID = world.getBlockId(i, j + 1, k); - } - - if (nextBlockID != 0 && Block.blocksList[nextBlockID].blockMaterial.isReplaceable() && Block.blocksList[nextBlockID].blockMaterial != Material.water) { - world.setBlockToAir(i, j + 1, k); - nextBlockID = 0; - } - - if (previousBlockID != 0 && previousBlockID != Block.waterStill.blockID && - (thisBlockID == ((BTABiome) this.biome).topBlockExt || thisBlockID == Block.grass.blockID) && - nextBlockID == 0) - { - if (waterNoise > 0.125) { - int numBlockNeighbors = 8; - - for (int offsetI = -1; offsetI <= 1; offsetI++) { - for (int offsetK = -1; offsetK <= 1; offsetK++) { - if (offsetI == 0 && offsetK == 0) { - continue; - } - - int neighborID = world.getBlockId(i + offsetI, j, k + offsetK); - int neighborAboveID = world.getBlockId(i + offsetI, j + 1, k + offsetK); - - if (neighborID == 0 || neighborAboveID != 0) { - numBlockNeighbors--; - } - } - } - - if (numBlockNeighbors == 8) { - world.setBlock(i, j, k, Block.waterStill.blockID); - fillToDepth(world, i, j - 1, k, depth, Block.dirt.blockID, 0); - } - else { - world.setBlock(i, j, k, Block.grass.blockID); - fillToDepth(world, i, j - 1, k, depth, Block.dirt.blockID, 0); - } - - for (int offsetI = -1; offsetI <= 1; offsetI++) { - for (int offsetK = -1; offsetK <= 1; offsetK++) { - if (offsetI == 0 && offsetK == 0) { - break; - } - - if (springsNoiseGen.noise2(i + offsetI, k + offsetK, waterNoiseScale) <= 0.825) { - world.setBlock(i + offsetI, j, k + offsetK, Block.grass.blockID); - fillToDepth(world, i + offsetI, j - 1, k + offsetK, depth, Block.dirt.blockID, 0); - } - } - } - } - else if (waterNoise > 0) { - world.setBlock(i, j, k, Block.grass.blockID); - fillToDepth(world, i, j - 1, k, depth, Block.dirt.blockID, 0); - } - } - } - } - } - } - } - - private void fillToDepth(World world, int x, int y, int z, int depth, int blockID, int metadata) { - for (int i = 0; i < depth; i++) { - if (world.getBlockId(x, y - i, z) != 0) { - world.setBlockAndMetadata(x, y - i, z, blockID, metadata); - } - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/OrchardSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/OrchardSurfaceBuilder.java deleted file mode 100644 index 41729c2..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/OrchardSurfaceBuilder.java +++ /dev/null @@ -1,55 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterbiomes.feature.tree.OldOakGen; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenBigTree; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenerator; - -public class OrchardSurfaceBuilder extends SurfaceBuilder { - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random treeRand = new Random(seed + 1000); - - this.treeNoiseGen = new OpenSimplexOctaves(treeRand.nextLong(), 2); - - this.treeNoiseScale = 1/256D; - } - - public void generateTreesForBiome(World world, Random rand, WorldConfigurationInfo generatorInfo) { - int numTrees = 3; - - for (int i = 0; i < numTrees; ++i) - { - int x = this.chunkX + rand.nextInt(16) + 8; - int z = this.chunkZ + rand.nextInt(16) + 8; - - WorldGenerator gen; - - if (this.treeNoiseGen.noise2(x, z, this.treeNoiseScale) - .375 > 0) { - gen = new WorldGenTrees(false, 6, 0, 0, false); - } - else { - if (rand.nextInt(20) == 0) { - gen = new OldOakGen(false); - } - else if (rand.nextInt(2) == 0) { - gen = new WorldGenBigTree(false); - } - else { - gen = new WorldGenTrees(false, 6, 0, 0, false); - } - } - - gen.setScale(1.0D, 1.0D, 1.0D); - gen.generate(world, rand, x, world.getHeightValue(x, z), z); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/OutbackSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/OutbackSurfaceBuilder.java deleted file mode 100644 index 0ad504f..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/OutbackSurfaceBuilder.java +++ /dev/null @@ -1,50 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.Block; -import net.minecraft.src.WorldType; -import opensimplex2.OpenSimplex2F; - -public class OutbackSurfaceBuilder extends SurfaceBuilder { - protected static OpenSimplexOctaves grassNoiseGenSimplex; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random grassRand = new Random(seed + 3000); - - grassNoiseGenSimplex = new OpenSimplexOctaves(grassRand.nextLong(), 2); - } - - @Override - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - double grassNoiseScale = 0.0625D; - //k and i swapped because apparently I messed something up somewhere - boolean useGrass = grassNoiseGenSimplex.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), grassNoiseScale) > 0; - - boolean useGravel = this.useGravelAtLocation(i, k, rand, generatorInfo) && surfaceJ <= seaLevel + 1; - - if (useGrass && DecoIntegration.isDecoInstalled() && worldType.isDeco() && !useGravel) { - if (surfaceType == SurfaceType.TOP) { - return new int[] {Block.grass.blockID, 0}; - } - else if (surfaceType == SurfaceType.FILLER) { - return new int[] {Block.dirt.blockID, 0}; - } - } - - return super.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, surfaceType, seaLevel, rand, generatorInfo, worldType); - } - - @Override - protected boolean useSandAtLocation(int i, int k, Random rand) { - return false; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/SoulSandValleySurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/SoulSandValleySurfaceBuilder.java deleted file mode 100644 index 1ed7c6e..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/SoulSandValleySurfaceBuilder.java +++ /dev/null @@ -1,7 +0,0 @@ -package betterbiomes.world.generate.surface; - -import betterterrain.world.generate.surface.NetherSurfaceBuilder; - -public class SoulSandValleySurfaceBuilder extends NetherSurfaceBuilder { - -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/SteppeSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/SteppeSurfaceBuilder.java deleted file mode 100644 index a2ddf28..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/SteppeSurfaceBuilder.java +++ /dev/null @@ -1,55 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterterrain.feature.tree.SmallShrubGen; -import betterterrain.feature.tree.TinyShrubGen; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.NoShorelineSurfaceBuilder; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenerator; - -public class SteppeSurfaceBuilder extends NoShorelineSurfaceBuilder { - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random treeRand = new Random(seed + 4000); - - this.treeNoiseGen = new OpenSimplexOctaves(treeRand.nextLong(), 2); - - this.treeNoiseScale = 1/256D; - } - - public void generateTreesForBiome(World world, Random rand, WorldConfigurationInfo generatorInfo) { - int numTrees = 15; - - for (int i = 0; i < numTrees; ++i) - { - int x = this.chunkX + rand.nextInt(16) + 8; - int z = this.chunkZ + rand.nextInt(16) + 8; - - WorldGenerator gen; - - if (this.treeNoiseGen.noise2(x, z, this.treeNoiseScale) + .5 > 0) { - continue; - } - else { - if (rand.nextInt(3) == 0) { - gen = new SmallShrubGen(); - } - else if (rand.nextInt(10) == 0) { - gen = new WorldGenShrub(0, 0); - } - else { - gen = new TinyShrubGen(); - } - } - - gen.setScale(1.0D, 1.0D, 1.0D); - gen.generate(world, rand, x, world.getHeightValue(x, z), z); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/TropicsSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/TropicsSurfaceBuilder.java deleted file mode 100644 index c8a88cf..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/TropicsSurfaceBuilder.java +++ /dev/null @@ -1,18 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.surface.SurfaceBuilder; - -public class TropicsSurfaceBuilder extends SurfaceBuilder { - @Override - protected boolean useSandAtLocation(int i, int k, Random rand) { - return true; - } - - @Override - protected boolean useGravelAtLocation(int i, int k, Random rand, WorldConfigurationInfo generatorInfo) { - return false; - } -} \ No newline at end of file diff --git a/minecraft_server/betterbiomes/world/generate/surface/VolcanicBeachSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/VolcanicBeachSurfaceBuilder.java deleted file mode 100644 index 0f183b0..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/VolcanicBeachSurfaceBuilder.java +++ /dev/null @@ -1,72 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.Block; -import net.minecraft.src.WorldType; - -public class VolcanicBeachSurfaceBuilder extends SurfaceBuilder { - protected OpenSimplexOctaves basaltNoiseGen; - protected OpenSimplexOctaves grassNoiseGen; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random noiseRand = new Random(seed + 100); - - basaltNoiseGen = new OpenSimplexOctaves(noiseRand.nextLong(), 4); - grassNoiseGen = new OpenSimplexOctaves(noiseRand.nextLong(), 4); - } - - /** - * Gets the block to use for the surface layer for this biome - * @param i Local x value for this chunk - * @param y Absolute y value - * @param k Local z value for this chunk - * @param isTopBlock Whether to return the top block or the filler block - * @param rand - * @param generatorInfo - * @param worldType - * @return An int array of blockID, metadata - */ - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - int blockID = -1; - int metadata = 0; - - double basaltNoiseScale = 1/128D; - double grassNoiseScale = 1/64D; - - boolean useGrass = grassNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), grassNoiseScale) + rand.nextDouble() > 1.75; - - if (!useGrass) { - double basaltNoise = basaltNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), basaltNoiseScale) + rand.nextDouble() * 0.5D; - - if (basaltNoise < -0.75) { - blockID = DecoIntegration.stoneTypes.blockID; - metadata = 1; - } - else if (basaltNoise < 0.125 || basaltNoise > 1) { - blockID = DecoIntegration.basalt.blockID; - } - else { - blockID = DecoIntegration.infusedStone.blockID; - } - } - - if (blockID == -1) { - if (j < seaLevel - 1 && surfaceType == surfaceType.TOP) { - surfaceType = SurfaceType.FILLER; - } - - blockID = getDefaultSurfaceBlock(i, k, surfaceType, Block.stone.blockID); - } - - return new int[] {blockID, metadata}; - } -} diff --git a/minecraft_server/betterbiomes/world/generate/surface/VolcanicJungleSurfaceBuilder.java b/minecraft_server/betterbiomes/world/generate/surface/VolcanicJungleSurfaceBuilder.java deleted file mode 100644 index eaf05ac..0000000 --- a/minecraft_server/betterbiomes/world/generate/surface/VolcanicJungleSurfaceBuilder.java +++ /dev/null @@ -1,79 +0,0 @@ -package betterbiomes.world.generate.surface; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.Block; -import net.minecraft.src.WorldType; - -public class VolcanicJungleSurfaceBuilder extends SurfaceBuilder { - protected OpenSimplexOctaves basaltNoiseGen; - protected OpenSimplexOctaves grassNoiseGen; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random noiseRand = new Random(seed + 100); - - basaltNoiseGen = new OpenSimplexOctaves(noiseRand.nextLong(), 4); - grassNoiseGen = new OpenSimplexOctaves(noiseRand.nextLong(), 4); - } - - /** - * Gets the block to use for the surface layer for this biome - * @param i Local x value for this chunk - * @param y Absolute y value - * @param k Local z value for this chunk - * @param isTopBlock Whether to return the top block or the filler block - * @param rand - * @param generatorInfo - * @param worldType - * @return An int array of blockID, metadata - */ - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - int blockID = -1; - int metadata = 0; - - double basaltNoiseScale = 1/128D; - double grassNoiseScale = 1/64D; - - if (generatorInfo.generatePerlinBeaches() && - surfaceJ >= seaLevel - (8 + rand.nextInt(2)) && - surfaceJ <= seaLevel + 4) - { - if (useSandAtLocation(i, k, rand) || surfaceJ <= seaLevel + 3) { - boolean useGrass = grassNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), grassNoiseScale) + rand.nextDouble() > 1.75; - - if (!useGrass) { - double basaltNoise = basaltNoiseGen.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), basaltNoiseScale) + rand.nextDouble() * 0.5D; - - if (basaltNoise < -0.75) { - blockID = DecoIntegration.stoneTypes.blockID; - metadata = 1; - } - else if (basaltNoise < 0.125 || basaltNoise > 1) { - blockID = DecoIntegration.basalt.blockID; - } - else { - blockID = DecoIntegration.infusedStone.blockID; - } - } - } - } - - if (blockID == -1) { - if (j < seaLevel - 1 && surfaceType == surfaceType.TOP) { - surfaceType = SurfaceType.FILLER; - } - - blockID = getDefaultSurfaceBlock(i, k, surfaceType, Block.stone.blockID); - } - - return new int[] {blockID, metadata}; - } -} diff --git a/minecraft_server/betterterrain/AddonVersion.java b/minecraft_server/betterterrain/AddonVersion.java deleted file mode 100644 index 66e6892..0000000 --- a/minecraft_server/betterterrain/AddonVersion.java +++ /dev/null @@ -1,89 +0,0 @@ -package betterterrain; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import betterterrain.BTAVersion; - -public class AddonVersion { - private static final Map> versions = new HashMap(); - - private final int major; - private final int minor; - private final int patch; - - public AddonVersion(int major, int minor, int patch, BTAAddon addon) { - this.major = major; - this.minor = minor; - this.patch = patch; - - if (versions.get(addon) == null) { - versions.put(addon, new HashSet()); - } - - versions.get(addon).add(this); - } - - public String toString() { - return this.major + "." + this.minor + "." + this.patch; - } - - public static AddonVersion fromString(String info, BTAAddon addon) { - String[] infoSplit = info.split("\\."); - - if (infoSplit.length != 3) { - throw new IllegalArgumentException("Incorrect format for version comnpatibility string. String must be in the format of where X are integers."); - } - - try { - for (AddonVersion version : versions.get(addon)) { - if (version.major == Integer.parseInt(infoSplit[0]) && version.minor == Integer.parseInt(infoSplit[1]) && version.patch == Integer.parseInt(infoSplit[2]) ) { - return version; - } - } - - throw new IllegalArgumentException("Specified version " + info + " not found for addon " + addon.getName()); - } - catch (NumberFormatException e) { - throw new IllegalArgumentException("Incorrect format for version compatibility string. String must be in the format of where X are integers."); - } - } - - public boolean isVersionAtOrBelow(AddonVersion version) { - if (this.major > version.major) { - return false; - } - else if (this.major == version.major) { - if (this.minor > version.minor) { - return false; - } - else if (this.minor == version.minor) { - if (this.patch > version.patch) { - return false; - } - } - } - - return true; - } - - public boolean isVersionAtLeast(AddonVersion version) { - if (this.major < version.major) { - return false; - } - else if (this.major == version.major) { - if (this.minor < version.minor) { - return false; - } - else if (this.minor == version.minor) { - if (this.patch < version.patch) { - return false; - } - } - } - - return true; - } -} diff --git a/minecraft_server/betterterrain/BTAAddon.java b/minecraft_server/betterterrain/BTAAddon.java deleted file mode 100644 index 2ae23e5..0000000 --- a/minecraft_server/betterterrain/BTAAddon.java +++ /dev/null @@ -1,55 +0,0 @@ -package betterterrain; - -import java.util.HashSet; -import java.util.Set; - -import com.google.gson.JsonObject; - -import betterterrain.biome.BiomeConfiguration; -import betterterrain.world.config.AddonConfigurationInfo; -import net.minecraft.src.FCAddOn; -import net.minecraft.src.FCAddOnHandler; - -public abstract class BTAAddon extends FCAddOn { - public final String internalName; - - public AddonVersion currentVersion; - - public BTAAddon(String addonName, String internalName, String version, String prefix) { - super(addonName, version, prefix); - this.internalName = internalName; - } - - //------ World Configuration Functionality ------// - - public abstract BiomeConfiguration getBiomeConfiguration(); - - public final AddonConfigurationInfo createDefaultConfigInfo() { - AddonConfigurationInfo info = createConfigInfo(); - - info.setName(this.internalName); - info.setVersion(this.currentVersion); - - this.setDefaultSettings(info); - - return info; - } - - public AddonConfigurationInfo createConfigInfo() { - return new AddonConfigurationInfo(); - } - - public void setDefaultSettings(AddonConfigurationInfo info) {} - - //------ Other Functionality ------// - - public static BTAAddon getAddonByInternalName(String name) { - for (FCAddOn mod : FCAddOnHandler.m_ModList.values()) { - if (mod instanceof BTAAddon && ((BTAAddon) mod).internalName.equals(name)) { - return (BTAAddon) mod; - } - } - - return null; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/BTAMod.java b/minecraft_server/betterterrain/BTAMod.java deleted file mode 100644 index 1ff96f3..0000000 --- a/minecraft_server/betterterrain/BTAMod.java +++ /dev/null @@ -1,78 +0,0 @@ -package betterterrain; - -import betterterrain.biome.BiomeConfiguration; -import betterterrain.block.BTABlockClay; -import betterterrain.item.BTAItemBloodMossSpores; -import betterterrain.item.BTAItemPileSoulSand; -import betterterrain.world.type.BTADefaultWorldType; -import betterterrain.world.type.BetaWorldType; -import betterterrain.world.type.SkyWorldType; -import net.minecraft.src.Block; -import net.minecraft.src.EntityList; -import net.minecraft.src.FCAddOn; -import net.minecraft.src.FCAddOnHandler; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.Item; -import net.minecraft.src.ItemMultiTextureTile; -import net.minecraft.src.MapColor; -import net.minecraft.src.Material; -import net.minecraft.src.ServerCommandManager; -import net.minecraft.src.WorldType; - -public class BTAMod extends FCAddOn { - private static BTAMod instance; - - public final BTAVersion currentVersion; - - public static final WorldType BTAWorldType = new BTADefaultWorldType(4, "BTA"); - public static final WorldType BTAWorldTypeDeco = new BTADefaultWorldType(5, "BTADeco").setIsDeco().setCanBeCreated(false).setParent(BTAWorldType); - public static final WorldType BTAWorldTypeBeta = new BetaWorldType(6, "BTABeta"); - public static final WorldType BTAWorldTypeBetaDeco = new BetaWorldType(7, "BTABetaDeco").setIsDeco().setCanBeCreated(false).setParent(BTAWorldTypeBeta); - public static final WorldType BTAWorldTypeSky = new SkyWorldType(8, "BTASky"); - public static final WorldType BTAWorldTypeSkyDeco = new SkyWorldType(9, "BTASkyDeco").setIsDeco().setCanBeCreated(false).setParent(BTAWorldTypeSky); - public static final WorldType BTAWorldTypeSmall = new BTADefaultWorldType(10, "BTASmall").setCanBeCreated(false).setParent(BTAWorldType); - public static final WorldType BTAWorldTypeSmallDeco = new BTADefaultWorldType(11, "BTASmallDeco").setIsDeco().setCanBeCreated(false).setParent(BTAWorldType); - - public static Material netherSand; - - private BTAMod() { - super("Better Terrain", "3.0.0", "BTA"); - this.currentVersion = BTAVersion.fromString(this.getVersionString()); - } - - @Override - public void Initialize() { - DecoIntegration.init(); - - netherSand = new Material(MapColor.sandColor).setRequiresTool().SetNetherMobsCanSpawnOn(); - - FCBetterThanWolves.fcItemPileSoulSand = Item.replaceItem(FCBetterThanWolves.fcItemPileSoulSand.itemID, BTAItemPileSoulSand.class, instance); - - Block.blockClay = Block.replaceBlock(Block.blockClay.blockID, BTABlockClay.class, instance); - Item.itemsList[Block.blockClay.blockID] = new ItemMultiTextureTile(Block.blockClay.blockID - 256, Block.blockClay, new String[] {"dirt", "sand", "redSand", "grass"}); - - FCBetterThanWolves.fcItemBloodMossSpores = Item.replaceItem(FCBetterThanWolves.fcItemBloodMossSpores.itemID, BTAItemBloodMossSpores.class, instance); - Block.blockNetherQuartz.SetBlockMaterial(FCBetterThanWolves.fcMaterialNetherRock); - Block.slowSand.SetBlockMaterial(netherSand); - - for (FCAddOn mod : FCAddOnHandler.m_ModList.values()) { - if (mod instanceof BTAAddon) { - BTAAddon addon = (BTAAddon) mod; - addon.currentVersion = AddonVersion.fromString(addon.getVersionString(), addon); - } - } - } - - @Override - public void PostInitialize() { - BiomeConfiguration.init(); - } - - public static BTAMod getInstance() { - if (instance == null) { - instance = new BTAMod(); - } - - return instance; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/DecoIntegration.java b/minecraft_server/betterterrain/DecoIntegration.java deleted file mode 100644 index f4abc24..0000000 --- a/minecraft_server/betterterrain/DecoIntegration.java +++ /dev/null @@ -1,102 +0,0 @@ -package betterterrain; - -import net.minecraft.src.Block; -import net.minecraft.src.DecoManager; -import net.minecraft.src.FCAddOn; -import net.minecraft.src.FCAddOnHandler; -import net.minecraft.src.Item; - -public class DecoIntegration { - private static boolean isDecoInstalled = false; - private static FCAddOn decoManager = null; - - public static Block redSand; - public static Block redSandStone; - public static Block redSandStoneStairs; - public static Block terracotta; - public static Block stainedTerracotta; - public static Block cherryLog; - public static Block cherryStump; - public static Block cherryLeaves; - public static Block acaciaLog; - public static Block acaciaStump; - public static Block acaciaLeaves; - public static Block flower; - public static Block flower2; - public static Block tulip; - public static Block stoneTypes; - public static Block autumnLeaves; - public static Block coarseDirt; - public static Block podzol; - public static Block basalt; - public static Block infusedStone; - public static Block magma; - public static Block ash; - public static Block pumice; - public static Block amethyst; - public static Block amethystShardBlock; - public static Block bonePillar; - - public static Item pileRedSand; - - public static void init() { - try { - if (FCAddOnHandler.isModInstalled("Deco Addon")) { - decoManager = FCAddOnHandler.getModByName("Deco Addon"); - } - - if (decoManager != null) { - isDecoInstalled = true; - - redSand = (Block) getDecoField("redSand"); - redSandStone = (Block) getDecoField("redSandStone"); - redSandStoneStairs = (Block) getDecoField("redSandStoneStairs"); - terracotta = (Block) getDecoField("terracotta"); - stainedTerracotta = (Block) getDecoField("stainedTerracotta"); - cherryLog = (Block) getDecoField("cherryLog"); - cherryStump = (Block) getDecoField("cherryStump"); - cherryLeaves = (Block) getDecoField("cherryLeaves"); - acaciaLog = (Block) getDecoField("acaciaLog"); - acaciaStump = (Block) getDecoField("acaciaStump"); - acaciaLeaves = (Block) getDecoField("acaciaLeaves"); - flower = (Block) getDecoField("flower"); - flower2 = (Block) getDecoField("flower2"); - tulip = (Block) getDecoField("tulip"); - stoneTypes = (Block) getDecoField("stoneTypes"); - autumnLeaves = (Block) getDecoField("autumnLeaves"); - coarseDirt = (Block) getDecoField("coarseDirt"); - podzol = (Block) getDecoField("podzol"); - basalt = (Block) getDecoField("basalt"); - infusedStone = (Block) getDecoField("infusedStone"); - magma = (Block) getDecoField("magma"); - ash = (Block) getDecoField("ashBlock"); - pumice = (Block) getDecoField("pumice"); - amethyst = (Block) getDecoField("amethyst"); - amethystShardBlock = (Block) getDecoField("amethystShardBlock"); - bonePillar = (Block) getDecoField("bonePillar"); - - pileRedSand = (Item) getDecoField("pileRedSand"); - } - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (NoSuchFieldException e) { - e.printStackTrace(); - } catch (SecurityException e) { - e.printStackTrace(); - } - } - - private static Object getDecoField(String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { - if (isDecoInstalled) { - return ((DecoManager) decoManager).decoDefs.getClass().getDeclaredField(fieldName).get(null); - } - - return null; - } - - public static boolean isDecoInstalled() { - return isDecoInstalled; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/BTABiome.java b/minecraft_server/betterterrain/biome/BTABiome.java deleted file mode 100644 index 5c56895..0000000 --- a/minecraft_server/betterterrain/biome/BTABiome.java +++ /dev/null @@ -1,741 +0,0 @@ -package betterterrain.biome; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Random; - -import betterterrain.BTAVersion; -import betterterrain.biome.layer.HillsLayer; -import betterterrain.biome.layer.RiverLayer; -import betterterrain.biome.layer.ShoreLayer; -import betterterrain.biome.layer.SporadicLayer; -import betterterrain.feature.plant.MelonGen; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.terrain.OreGen; -import betterterrain.structure.mapgen.BTAMapGenScatteredFeature; -import betterterrain.structure.mapgen.BTAMapGenVillage; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.config.WorldConfigurationInfoLegacy; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.ComponentVillageStartPiece; -import net.minecraft.src.FCIBiomeDecorator; -import net.minecraft.src.MapGenVillage; -import net.minecraft.src.StructureScatteredFeatureStart; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenPumpkin; -import net.minecraft.src.WorldGenReed; -import net.minecraft.src.WorldGenerator; -import net.minecraft.src.WorldType; - -public class BTABiome extends BiomeGenBase { - public int topBlockExt; - public int fillerBlockExt; - - private boolean enableSnow; - private boolean enableRain; - private boolean isSpawnable; - - public Climate climate; - - public BiomeDecorator btaBiomeDecorator; - private SurfaceBuilder surfaceBuilder; - - private static WorldConfigurationInfo generatorInfoCache; - - private String internalName; - - public BTABiome(int id, String internalName, Climate climate) { - super(id); - - this.setInternalName(internalName); - - this.enableRain = true; - this.isSpawnable = true; - this.btaBiomeDecorator = new BiomeDecorator(this); - - this.topBlockExt = Block.grass.blockID; - this.fillerBlockExt = Block.dirt.blockID; - - this.climate = climate; - - this.isPlateau = false; - } - - /** - * Sets the temperature and rainfall of this biome. - */ - public BTABiome setTemperatureRainfall(float par1, float par2) - { - if (par1 > 0.1F && par1 < 0.2F) - { - throw new IllegalArgumentException("Please avoid temperatures in the range 0.1 - 0.2 because of snow"); - } - else - { - this.temperature = par1; - this.rainfall = par2; - return this; - } - } - - public void decorate(World world, Random rand, int chunkX, int chunkZ, WorldConfigurationInfo generatorOptions) - { - this.btaBiomeDecorator.decorate(world, rand, chunkX, chunkZ); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random par1Random, WorldConfigurationInfo generatorOptions) - { - return this.getRandomWorldGenForTrees(par1Random); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random par1Random, WorldConfigurationInfo generatorOptions, WorldType worldType) - { - return this.getRandomWorldGenForTrees(par1Random, generatorOptions); - } - - /** - * Sets the minimum and maximum height of this biome. Seems to go from -2.0 to 2.0. - */ - public BTABiome setMinMaxHeight(float par1, float par2) - { - this.minHeight = par1; - this.maxHeight = par2; - return this; - } - - /** - * Disable the rain for the biome. - */ - public BTABiome setDisableRain() - { - this.enableRain = false; - return this; - } - - /** - * sets enableSnow to true during biome initialization. returns BiomeGenBase. - */ - public BTABiome setEnableSnow() - { - this.enableSnow = true; - return this; - } - - /** - * Returns true if the biome have snowfall instead a normal rain. - */ - public boolean getEnableSnow() - { - return this.enableSnow; - } - - public BTABiome setBiomeName(String par1Str) - { - this.biomeName = par1Str; - return this; - } - - public BTABiome func_76733_a(int par1) - { - this.field_76754_C = par1; - return this; - } - - public BTABiome setColor(int par1) - { - this.color = par1; - return this; - } - - public boolean isSpawnable() { - return isSpawnable; - } - - public BTABiome setNotSpawnable() { - this.isSpawnable = false; - return this; - } - - public boolean CanRainInBiome() - { - return this.enableSnow ? false : this.enableRain; - } - - public boolean CanLightningStrikeInBiome() - { - return this.CanRainInBiome(); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return new TallGrassGen(Block.tallGrass.blockID, 1); - } - - public SurfaceBuilder getSurfaceBuilder() { - return surfaceBuilder; - } - - public boolean canSlimesSpawnOnSurface() { - return StructureScatteredFeatureStart.swampBiomeList.contains(this); - } - - public BTABiome setSurfaceBuilder(SurfaceBuilder surfaceBuilder) { - this.surfaceBuilder = surfaceBuilder; - - if (this.surfaceBuilder.getBiome() == null) { - this.surfaceBuilder.setBiome(this); - } - - return this; - } - - @Override - public boolean canSnowAt(World world, int x, int y, int z) { - if (generatorInfoCache == null || !generatorInfoCache.toString().equals(world.provider.generatorOptions)) { - if (world.provider.generatorOptions.equals("")) { - generatorInfoCache = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(world.provider.terrainType.isDeco()); - } - else { - generatorInfoCache = WorldConfigurationInfo.createInfoFromString(world.provider.generatorOptions); - } - } - - if (generatorInfoCache.getBTAVersion().isVersionAtLeast(BTAVersion.V1_3_0)) { - int minHeightForSnow = this.climate.minHeightForSnow; - - SurfaceBuilder surfaceBuilder; - - if (this.surfaceBuilder == null) { - surfaceBuilder = SurfaceBuilder.defaultBuilder; - surfaceBuilder.setBiome(this); - } - else { - surfaceBuilder = this.surfaceBuilder; - } - - if (!surfaceBuilder.hasBeenInit()) { - surfaceBuilder.init(world.rand, world.getSeed()); - surfaceBuilder.setHasBeenInit(true); - } - - minHeightForSnow += surfaceBuilder.getSnowHeightOffset(x, z, world.rand); - - return y >= minHeightForSnow; - } - else { - return this.getEnableSnow(); - } - } - - //------ Compatibility Functionality ------// - - boolean isDecoOnly; - boolean isLegacyCompatible; - - public boolean isDecoOnly() { - return isDecoOnly; - } - - public BTABiome setDecoOnly() { - this.isDecoOnly = true; - return this; - } - - public boolean isLegacyCompatible() { - return isLegacyCompatible; - } - - /** - * Only used for biomes in BTA 1.1.3 or before - * DO NOT USE except for those biomes as it will break backwards compatibility if you do - */ - public BTABiome setLegacyCompatible() { - this.isLegacyCompatible = true; - return this; - } - - //------ Biome Variant Functionality ------// - - //--- Sub Biomes ---// - - //Different biome variants which spawn within the larger biome - protected Map subBiomeVariants = new LinkedHashMap(); - protected Map subBiomeVariantsCommon = new LinkedHashMap(); - - public BTABiome addSubVariant(BTABiome biome) { - return this.addSubVariant(biome, null); - } - - public BTABiome addSubVariant(BTABiome biome, WorldConfigurationInfo.Condition condition) { - this.subBiomeVariants.put(biome, condition); - return this; - } - - public int getSubVariant(WorldConfigurationInfo generatorOptions, HillsLayer layer) { - return this.getSubVariant(generatorOptions); - } - - public int getSubVariant(WorldConfigurationInfo generatorOptions) { - if (!this.subBiomeVariants.isEmpty()) { - for (BTABiome biome : this.subBiomeVariants.keySet()) { - if (this.subBiomeVariants.get(biome) == null || this.subBiomeVariants.get(biome).satisfiesContraints(generatorOptions)) { - return biome.biomeID; - } - } - } - - return this.biomeID; - } - - public BTABiome addSubVariantCommon(BTABiome biome) { - return this.addSubVariant(biome, null); - } - - public BTABiome addSubVariantCommon(BTABiome biome, WorldConfigurationInfo.Condition condition) { - this.subBiomeVariantsCommon.put(biome, condition); - return this; - } - - public int getSubVariantCommon(WorldConfigurationInfo generatorOptions, HillsLayer layer) { - return this.getSubVariantCommon(generatorOptions); - } - - public int getSubVariantCommon(WorldConfigurationInfo generatorOptions) { - if (!this.subBiomeVariantsCommon.isEmpty()) { - for (BTABiome biome : this.subBiomeVariantsCommon.keySet()) { - if (this.subBiomeVariantsCommon.get(biome) == null || this.subBiomeVariantsCommon.get(biome).satisfiesContraints(generatorOptions)) { - return biome.biomeID; - } - } - } - - return this.biomeID; - } - - //--- Sporadic Biomes ---// - - //Rare small sub biomes - protected Map sporadicVariants = new LinkedHashMap(); - //Chance the sporadic variant will generate - protected Map sporadicChances = new LinkedHashMap(); - - public BTABiome addSporadicVariant(BTABiome biome) { - return this.addSporadicVariant(biome, null); - } - - public BTABiome addSporadicVariant(BTABiome biome, WorldConfigurationInfo.Condition condition) { - this.sporadicVariants.put(biome, condition); - return this; - } - - public int getSporadicVariant(WorldConfigurationInfo generatorOptions, SporadicLayer layer) { - return this.getSporadicVariant(generatorOptions); - } - - public int getSporadicVariant(WorldConfigurationInfo generatorOptions) { - if (!this.sporadicVariants.isEmpty()) { - for (BTABiome biome : this.sporadicVariants.keySet()) { - if (this.sporadicVariants.get(biome) == null || this.sporadicVariants.get(biome).satisfiesContraints(generatorOptions)) { - return biome.biomeID; - } - } - } - - return this.biomeID; - } - - public BTABiome addSporadicChance(int chance) { - return this.addSporadicChance(chance, null); - } - - public BTABiome addSporadicChance(int chance, WorldConfigurationInfo.Condition condition) { - this.sporadicChances.put(chance, condition); - return this; - } - - public int getSporadicChance(WorldConfigurationInfo generatorOptions, SporadicLayer layer) { - return this.getSporadicChance(generatorOptions); - } - - public int getSporadicChance(WorldConfigurationInfo generatorOptions) { - if (!this.sporadicChances.isEmpty()) { - for (int chance : this.sporadicChances.keySet()) { - if (this.sporadicChances.get(chance) == null || this.sporadicChances.get(chance).satisfiesContraints(generatorOptions)) { - return chance; - } - } - } - - return 0; - } - - //--- Beaches ---// - - //Beach variants - protected Map beachVariants = new LinkedHashMap(); - //Keeps track of whether the biome should spawn a beach - protected Map hasBeach = new LinkedHashMap(); - - public BTABiome addBeachVariant(BTABiome biome) { - return this.addBeachVariant(biome, null); - } - - public BTABiome addBeachVariant(BTABiome biome, WorldConfigurationInfo.Condition condition) { - this.beachVariants.put(biome, condition); - return this; - } - - public int getBeachVariant(WorldConfigurationInfo generatorOptions, ShoreLayer layer) { - return this.getBeachVariant(generatorOptions); - } - - public int getBeachVariant(WorldConfigurationInfo generatorOptions) { - if (!this.beachVariants.isEmpty()) { - for (BTABiome biome : this.beachVariants.keySet()) { - if (this.beachVariants.get(biome) == null || this.beachVariants.get(biome).satisfiesContraints(generatorOptions)) { - return biome.biomeID; - } - } - } - - return this.biomeID; - } - - public BTABiome setHasBeach(boolean connect) { - return this.setHasBeach(connect, null); - } - - public BTABiome setHasBeach(boolean connect, WorldConfigurationInfo.Condition condition) { - this.hasBeach.put(condition, connect); - return this; - } - - public boolean hasBeach(WorldConfigurationInfo generatorOptions, ShoreLayer layer) { - return this.hasBeach(generatorOptions); - } - - public boolean hasBeach(WorldConfigurationInfo generatorOptions) { - if (!this.hasBeach.isEmpty()) { - for (WorldConfigurationInfo.Condition condition : this.hasBeach.keySet()) { - if (condition == null || condition.satisfiesContraints(generatorOptions)) { - return this.hasBeach.get(condition); - } - } - } - - return true; - } - - //--- Rivers ---// - - //River biome to use when a river cuts through - protected Map riverVariants = new LinkedHashMap(); - - public BTABiome addRiverVariant(BTABiome biome) { - return this.addRiverVariant(biome, null); - } - - public BTABiome addRiverVariant(BTABiome biome, WorldConfigurationInfo.Condition condition) { - this.riverVariants.put(biome, condition); - return this; - } - - public int getRiverVariant(WorldConfigurationInfo generatorOptions, RiverLayer layer) { - return this.getRiverVariant(generatorOptions); - } - - public int getRiverVariant(WorldConfigurationInfo generatorOptions) { - if (!this.riverVariants.isEmpty()) { - for (BTABiome biome : this.riverVariants.keySet()) { - if (this.riverVariants.get(biome) == null || this.riverVariants.get(biome).satisfiesContraints(generatorOptions)) { - return biome.biomeID; - } - } - } - - return this.biomeID; - } - - //--- Edges ---// - - //Edge variants, used when transitioning disparate biomes - protected Map edgeVariants = new LinkedHashMap(); - //Controls whether an edge should be formed with this biome - protected Map shouldConnectWithEdge = new LinkedHashMap(); - - public BTABiome addEdgeVariant(BTABiome biome) { - return this.addEdgeVariant(biome, null); - } - - public BTABiome addEdgeVariant(BTABiome biome, WorldConfigurationInfo.Condition condition) { - this.edgeVariants.put(biome, condition); - return this; - } - - public int getEdgeVariant(WorldConfigurationInfo generatorOptions, ShoreLayer layer) { - return this.getEdgeVariant(generatorOptions); - } - - public int getEdgeVariant(WorldConfigurationInfo generatorOptions) { - if (!this.edgeVariants.isEmpty()) { - for (BTABiome biome : this.edgeVariants.keySet()) { - if (this.edgeVariants.get(biome) == null || this.edgeVariants.get(biome).satisfiesContraints(generatorOptions)) { - return biome.biomeID; - } - } - } - - return this.biomeID; - } - - public BTABiome setConnectToEdge(boolean connect) { - return this.setConnectToEdge(connect, null); - } - - public BTABiome setConnectToEdge(boolean connect, WorldConfigurationInfo.Condition condition) { - this.shouldConnectWithEdge.put(condition, connect); - return this; - } - - public boolean shouldConnectWithEdge(WorldConfigurationInfo generatorOptions, ShoreLayer layer) { - return this.shouldConnectWithEdge(generatorOptions); - } - - public boolean shouldConnectWithEdge(WorldConfigurationInfo generatorOptions) { - if (!this.shouldConnectWithEdge.isEmpty()) { - for (WorldConfigurationInfo.Condition condition : this.shouldConnectWithEdge.keySet()) { - if (condition == null || condition.satisfiesContraints(generatorOptions)) { - return this.shouldConnectWithEdge.get(condition) && this.getEdgeVariant(generatorOptions) == this.biomeID; - } - } - } - - return getEdgeVariant(generatorOptions) == this.biomeID; - } - - //------ Biome type Functionality ------// - - private boolean isPlateau; - private boolean isNether; - private boolean isEdge; - private boolean isRiver; - private boolean isBeach; - - public BTABiome setPlateau() { - this.isPlateau = true; - return this; - } - - public boolean isPlateau() { - return isPlateau; - } - - public BTABiome setNether() { - this.isNether = true; - this.setDisableRain(); - this.setTemperatureRainfall(2.0F, 0.0F); - return this; - } - - public boolean isNether() { - return isNether; - } - - public BTABiome setEdge() { - this.isEdge = true; - return this; - } - - public boolean isEdge() { - return this.isEdge; - } - - public BTABiome setRiver() { - this.isRiver = true; - this.addRiverVariant(this); - return this; - } - - public boolean isRiver() { - return this.isRiver; - } - - public BTABiome setBeach() { - this.isBeach = true; - this.addBeachVariant(this); - return this; - } - - public boolean isBeach() { - return this.isBeach; - } - - //------ Structure Functionality ------// - - private boolean canSpawnStronghold = true; - - public BTABiome setSpawnsVillages(boolean isDesert) { - MapGenVillage.villageSpawnBiomes.add(this); - - if (isDesert) { - ComponentVillageStartPiece.addDesertBiome(this); - } - - return this; - } - - public BTABiome setSpawnsDesertTemples() { - BTAMapGenScatteredFeature.biomelist.add(this); - StructureScatteredFeatureStart.addDesertBiome(this); - return this; - } - - public BTABiome setSpawnsRedDesertTemples() { - BTAMapGenScatteredFeature.biomelist.add(this); - StructureScatteredFeatureStart.addRedDesertBiome(this); - return this; - } - - public BTABiome setSpawnsJungleTemples() { - BTAMapGenScatteredFeature.biomelist.add(this); - StructureScatteredFeatureStart.addJungleBiome(this); - return this; - } - - public BTABiome setSpawnsWitchHuts() { - BTAMapGenScatteredFeature.biomelist.add(this); - StructureScatteredFeatureStart.addSwampBiome(this); - return this; - } - - public BTABiome setSpawnsPumpkins() { - WorldGenPumpkin.addBiomeToGenerator(this); - return this; - } - - public BTABiome setSpawnsMelons() { - MelonGen.addBiomeToGenerator(this); - return this; - } - - public BTABiome setSpawnsSugarCane() { - WorldGenReed.addBiomeToGenerator(this); - return this; - } - - public BTABiome setCannotSpawnStronghold() { - this.canSpawnStronghold = false; - return this; - } - - public boolean canSpawnStronghold() { - return this.canSpawnStronghold; - } - - //------ Generator Functionality ------// - - /** - * Only used if better beaches is turned off - */ - public boolean spawnSand(WorldConfigurationInfo info) { - return true; - } - - public void addEmeralds(World world, Random rand, int startX, int startZ) { - int count = 3 + rand.nextInt(6); - - for (int i = 0; i < count; ++i) { - int x = startX + rand.nextInt(16); - int y = rand.nextInt(28) + 4; - int z = startZ + rand.nextInt(16); - - if (world.getBlockId(x, y, z) == Block.stone.blockID) { - int oreMeta = 0; - - int[] stratas = world.provider.terrainType.getStrataLevels(); - - int strata1Height = stratas[0]; - int strata2Height = stratas[1]; - int strata3Height = -2; - - if (stratas.length > 2) { - strata3Height = stratas[2]; - } - - if (y <= strata1Height + world.rand.nextInt(2)) { - oreMeta = 1; - - if (y <= strata2Height + world.rand.nextInt(2)) - { - oreMeta = 2; - } - - if (y <= strata3Height + world.rand.nextInt(2)) - { - oreMeta = 3; - } - } - - world.setBlock(x, y, z, Block.oreEmerald.blockID, oreMeta, 2); - } - } - } - - public void addSilverfishBlocks(World world, Random rand, int startX, int startZ) { - for (int i = 0; i < 7; ++i) { - int x = startX + rand.nextInt(16); - int y = rand.nextInt(64); - int z = startZ + rand.nextInt(16); - new OreGen(Block.silverfish.blockID, 0, 8, Block.stone.blockID).generate(world, rand, x, y, z); - } - } - - public void genStandardOre1(World world, Random rand, int count, WorldGenerator generator, int startX, int startZ, int minY, int maxY) { - for (int i = 0; i < count; ++i) { - int x = startX + rand.nextInt(16); - int y = rand.nextInt(maxY - minY) + minY; - int z = startZ + rand.nextInt(16); - generator.generate(world, rand, x, y, z); - } - } - - /** - * Allows for intercepting other mods' custom decorators in case you want to use your own custom implementation - * @return true if the decorator was intercepted, false otherwise - */ - public boolean interceptCustomDecorator(FCIBiomeDecorator decorator, World world, Random rand, int x, int y) { - return false; - } - - public static int getIDFromInternalName(String internalName) { - for (int i = 0; i < BiomeGenBase.biomeList.length; i++) { - BiomeGenBase b = BiomeGenBase.biomeList[i]; - - if (b != null && b instanceof BTABiome && ((BTABiome) b).getInternalName().equals(internalName)) { - return b.biomeID; - } - } - - return -1; - } - - public String getInternalName() { - return internalName; - } - - public void setInternalName(String internalName) { - this.internalName = internalName; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/BTABiomeConfiguration.java b/minecraft_server/betterterrain/biome/BTABiomeConfiguration.java deleted file mode 100644 index ed91a40..0000000 --- a/minecraft_server/betterterrain/biome/BTABiomeConfiguration.java +++ /dev/null @@ -1,365 +0,0 @@ -package betterterrain.biome; - -import java.util.ArrayList; - -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.surface.IcyPeaksSurfaceBuilder; -import betterterrain.BTAVersion; -import betterterrain.biome.biomes.AridForestBiome; -import betterterrain.biome.biomes.BeachBiome; -import betterterrain.biome.biomes.DesertBiome; -import betterterrain.biome.biomes.DesertRiverBiome; -import betterterrain.biome.biomes.IcyPeaksBiome; -import betterterrain.biome.biomes.JungleBiome; -import betterterrain.biome.biomes.JungleEdgeBiome; -import betterterrain.biome.biomes.JungleRiverBiome; -import betterterrain.biome.biomes.MountainBiome; -import betterterrain.biome.biomes.NetherWastesBiome; -import betterterrain.biome.biomes.PlainsBiome; -import betterterrain.biome.biomes.RiverBiome; -import betterterrain.biome.biomes.SiberiaBiome; -import betterterrain.biome.biomes.SwampBiome; -import betterterrain.biome.biomes.SwampRiverBiome; -import betterterrain.biome.biomes.TundraBiome; -import betterterrain.biome.biomes.WoodsBiome; -import betterterrain.biome.biomes.deprecated.ForestedIcyPeaksBiome; -import betterterrain.world.generate.surface.NetherSurfaceBuilder; -import betterterrain.world.generate.surface.NoShorelineSurfaceBuilder; -import betterterrain.world.generate.surface.StonySurfaceBuilder; -import betterterrain.world.generate.surface.SwampSurfaceBuilder; -import net.minecraft.src.FCAddOnHandler; -import net.minecraft.src.FCUtilsHardcoreSpawn; - -public class BTABiomeConfiguration extends BiomeConfiguration { - public static final int - SWAMP_ID = 50, - SWAMP_RIVER_ID = 51, - - NETHER_WASTES_ID = 90, - - WOODS_ID = 100, - DESERT_ID = 101, - JUNGLE_ID = 113, - MOUNTAINS_ID = 125, - TUNDRA_ID = 132, - ICY_PEAKS_ID = 134, - SIBERIA_ID = 137, - PLAINS_ID = 138, - ARID_FOREST_ID = 142, - - WOODS_HILLS_ID = 150, - DESERT_HILLS_ID = 151, - JUNGLE_HILLS_ID = 157, - ICY_PEAKS_FORESTED_ID = 165, - - DESERT_RIVER_ID = 200, - JUNGLE_RIVER_ID = 207, - RIVER_ID = 211, - FROZEN_RIVER_ID = 212, - - MOUNTAIN_EDGE_ID = 231, - ICY_PEAKS_EDGE_ID = 233, - JUNGLE_EDGE_ID = 235, - - BEACH_ID = 241, - FROZEN_BEACH_ID = 242, - - max_id = 4096; - - //------ Primary Biomes ------// - - public static final BTABiome desert = new DesertBiome(DESERT_ID, "betterterrain:desert", Climate.ARID) - .setBiomeName("Better Desert") - .setSpawnsVillages(true) - .setDisableRain() - .setSpawnsDesertTemples() - .setTemperatureRainfall(2.0F, 0.0F) - .setMinMaxHeight(0.2F, 0.4F) - .setSurfaceBuilder(new NoShorelineSurfaceBuilder()) - .setNotSpawnable() - .setLegacyCompatible(); - - public static final BTABiome icyPeaks = new IcyPeaksBiome(ICY_PEAKS_ID, "betterterrain:icy_peaks", Climate.SNOWY) - .setBiomeName("Icy Peaks") - .setSurfaceBuilder(new IcyPeaksSurfaceBuilder()) - .setTemperatureRainfall(0.1F, 0.1F) - .setMinMaxHeight(0.5F, 1.5F) - .setEnableSnow() - .setNotSpawnable(); - - public static final BTABiome jungle = new JungleBiome(JUNGLE_ID, "betterterrain:jungle", Climate.TROPICAL) - .setBiomeName("Better Jungle") - .setSpawnsSugarCane() - .setSpawnsJungleTemples() - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(0.0F, 0.4F) - .setLegacyCompatible() - .setNotSpawnable(); - - public static final BTABiome mountains = new MountainBiome(MOUNTAINS_ID, "betterterrain:mountains", Climate.COLD) - .setBiomeName("Mountains") - .setTemperatureRainfall(0.5F, 0.1F) - .setMinMaxHeight(0.8F, 2.5F) - .setLegacyCompatible(); - - public static final BTABiome plains = new PlainsBiome(PLAINS_ID, "betterterrain:plains", Climate.ARID) - .setBiomeName("Better Plains") - .setSpawnsPumpkins() - .setSpawnsSugarCane() - .setSpawnsVillages(false) - .setTemperatureRainfall(0.8F, 0.3F) - .setMinMaxHeight(0.2F, 0.4F); - - public static final BTABiome siberia = new SiberiaBiome(SIBERIA_ID, "betterterrain:siberia", Climate.SNOWY) - .setBiomeName("Siberia") - .setTemperatureRainfall(0.1F, 0.4F) - .setMinMaxHeight(0.3F, 0.7F) - .setEnableSnow(); - - public static final BTABiome tundra = new TundraBiome(TUNDRA_ID, "betterbiomes:tundra", Climate.SNOWY) - .setBiomeName("Tundra") - .setTemperatureRainfall(0.1F, 0.1F) - .setMinMaxHeight(0.1F, 0.4F) - .setEnableSnow() - .setLegacyCompatible() - .setNotSpawnable(); - - public static final BTABiome swamp = new SwampBiome(SWAMP_ID, "betterterrain:swamp", Climate.TROPICAL) - .setBiomeName("Better Swamp") - .setSurfaceBuilder(new SwampSurfaceBuilder()) - .setSpawnsSugarCane() - .setSpawnsWitchHuts() - .setMinMaxHeight(-0.1F, 0.3F) - .setTemperatureRainfall(0.8F, 0.9F); - - public static final BTABiome woods = new WoodsBiome(WOODS_ID, "betterterrain:woods", Climate.TEMPERATE) - .setBiomeName("Woods") - .setTemperatureRainfall(0.7F, 0.8F) - .setMinMaxHeight(0.1F, 0.5F) - .setLegacyCompatible(); - - public static final BTABiome netherWastes = new NetherWastesBiome(NETHER_WASTES_ID, "betterterrain:nether_wastes") - .setBiomeName("Nether Wastes") - .setSurfaceBuilder(new NetherSurfaceBuilder()) - .setNether(); - - //------ Variant Biomes ------// - - public static final BTABiome mountainEdge = new MountainBiome(MOUNTAIN_EDGE_ID, "betterterrain:mountain_edge", Climate.COLD) - .setBiomeName("Mountains Edge") - .setTemperatureRainfall(0.5F, 0.1F) - .setMinMaxHeight(0.2F, 0.5F) - .setEdge(); - - public static final BTABiome icyPeaksEdge = new IcyPeaksBiome(ICY_PEAKS_EDGE_ID, "betterterrain:icy_peaks_edge", Climate.SNOWY) - .setBiomeName("Icy Peaks Edge") - .setSurfaceBuilder(new IcyPeaksSurfaceBuilder()) - .setEnableSnow() - .setTemperatureRainfall(0.1F, 0.1F) - .setMinMaxHeight(0.1F, 0.5F) - .setEdge(); - - public static final BTABiome jungleEdge = new JungleEdgeBiome(JUNGLE_EDGE_ID, "betterterrain:jungle_edge", Climate.TROPICAL) - .setBiomeName("Better Jungle Edge") - .setSpawnsSugarCane() - .setSpawnsJungleTemples() - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(0.0F, 0.4F) - .setEdge() - .setNotSpawnable(); - - public static final BTABiome beach = new BeachBiome(BEACH_ID, "betterterrain:beach", Climate.TEMPERATE) - .setBiomeName("Better Beach") - .setTemperatureRainfall(0.8F, 0.4F) - .setMinMaxHeight(0.0F, 0.1F) - .setBeach() - .setNotSpawnable(); - - public static final BTABiome frozenBeach = new BeachBiome(FROZEN_BEACH_ID, "betterterrain:frozen_beach", Climate.SNOWY) - .setBiomeName("Frozen Beach") - .setTemperatureRainfall(0.0F, 0.4F) - .setMinMaxHeight(0.0F, 0.1F) - .setEnableSnow() - .setBeach() - .setNotSpawnable(); - - public static final BTABiome river = new RiverBiome(RIVER_ID, "betterterrain:river", Climate.TEMPERATE) - .setBiomeName("Better River") - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver(); - - public static final BTABiome jungleRiver = new JungleRiverBiome(JUNGLE_RIVER_ID, "betterterrain:jungle_river") - .setBiomeName("Jungle River") - .setSpawnsSugarCane() - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver() - .setNotSpawnable(); - - public static final BTABiome desertRiver = new DesertRiverBiome(DESERT_RIVER_ID, "betterterrain:desert_river") - .setBiomeName("Desert River") - .setDisableRain() - .setTemperatureRainfall(2.0F, 0.0F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver() - .setNotSpawnable(); - - public static final BTABiome swampRiver = new SwampRiverBiome(SWAMP_RIVER_ID, "betterterrain:swamp_river") - .setBiomeName("Swamp River") - .setSpawnsSugarCane() - .setSurfaceBuilder(new SwampSurfaceBuilder()) - .setTemperatureRainfall(0.8F, 0.9F) - .setMinMaxHeight(-0.5F, 0.0F) - .setRiver(); - - public static final BTABiome frozenRiver = new RiverBiome(FROZEN_RIVER_ID, "betterterrain:frozen_river", Climate.SNOWY) - .setBiomeName("Better Frozen River") - .setEnableSnow() - .setMinMaxHeight(-0.5F, 0.0F) - .setTemperatureRainfall(0.0F, 0.5F) - .setRiver(); - - public static final BTABiome desertHills = new DesertBiome(DESERT_HILLS_ID, "betterterrain:desert_hills", Climate.ARID) - .setBiomeName("Better Desert Hills") - .setDisableRain() - .setSpawnsDesertTemples() - .setTemperatureRainfall(2.0F, 0.0F) - .setMinMaxHeight(0.3F, 1.0F) - .setNotSpawnable(); - - public static final BTABiome woodsHills = new WoodsBiome(WOODS_HILLS_ID, "betterterrain:woods_hills", Climate.TEMPERATE) - .setBiomeName("Wooded Hills") - .setTemperatureRainfall(0.7F, 0.8F) - .setMinMaxHeight(0.3F, 1.0F); - - public static final BTABiome aridForest = new AridForestBiome(ARID_FOREST_ID, "betterterrain:arid_forest", Climate.ARID) - .setBiomeName("Arid Forest") - .setSurfaceBuilder(new StonySurfaceBuilder()) - .setTemperatureRainfall(0.8F, 0.3F) - .setMinMaxHeight(0.2F, 0.4F); - - public static final BTABiome jungleHills = new JungleBiome(JUNGLE_HILLS_ID, "betterterrain:jungle_hills", Climate.TROPICAL) - .setBiomeName("Better Jungle Hills") - .setSpawnsSugarCane() - .setSpawnsJungleTemples() - .setTemperatureRainfall(1.2F, 0.9F) - .setMinMaxHeight(1.8F, 0.5F) - .setNotSpawnable(); - - //------ Deprecated Biomes ------// - - public static final BTABiome icyPeaksForested = new ForestedIcyPeaksBiome(ICY_PEAKS_FORESTED_ID, "betterterrain:icy_peaks_forested", Climate.SNOWY) - .setBiomeName("Forested Icy Peaks") - .setEnableSnow() - .setTemperatureRainfall(0.1F, 0.1F) - .setMinMaxHeight(0.5F, 1.5F); - - @Override - public void addBiomesToList(ArrayList biomeList) { - //Done to preserve backwards compatible biome order - if (!FCAddOnHandler.isModInstalled("Better Biomes")) { - biomeList.add(woods); - biomeList.add(desert); - biomeList.add(jungle); - biomeList.add(mountains); - biomeList.add(tundra); - biomeList.add(icyPeaks); - biomeList.add(siberia); - biomeList.add(plains); - } - - biomeList.add(swamp); - - FCUtilsHardcoreSpawn.blacklistedBiomes.add(jungle); - FCUtilsHardcoreSpawn.blacklistedBiomes.add(jungleRiver); - FCUtilsHardcoreSpawn.blacklistedBiomes.add(jungleHills); - FCUtilsHardcoreSpawn.blacklistedBiomes.add(jungleEdge); - } - - @Override - public void setBiomeVariants() { - desert.addSubVariant(desertHills); - icyPeaks.addSubVariant(icyPeaksForested, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_3_4); - } - }); - jungle.addSubVariant(jungleHills); - plains.addSubVariant(woods, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_2_1); - } - }); - plains.addSubVariant(aridForest, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtLeast(BTAVersion.V1_3_0); - } - }); - woods.addSubVariant(woodsHills); - - jungle.addSporadicVariant(jungleRiver); - jungle.addSporadicChance(8); - swamp.addSporadicVariant(swampRiver); - swamp.addSporadicChance(5); - - mountains.setHasBeach(false); - tundra.setHasBeach(false, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_3_1); - } - }); - icyPeaks.setHasBeach(false); - siberia.setHasBeach(false, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_3_1); - } - }); - tundra.addBeachVariant(frozenBeach, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtLeast(BTAVersion.V1_3_2); - } - }); - siberia.addBeachVariant(frozenBeach, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtLeast(BTAVersion.V1_3_2); - } - }); - - desert.addRiverVariant(desertRiver); - desertHills.addRiverVariant(desertRiver); - jungle.addRiverVariant(jungleRiver); - jungleHills.addRiverVariant(jungleRiver); - jungleEdge.addRiverVariant(jungleRiver); - swamp.addRiverVariant(swampRiver); - tundra.addRiverVariant(frozenRiver); - icyPeaks.addRiverVariant(frozenRiver); - siberia.addRiverVariant(frozenRiver); - - mountains.addEdgeVariant(mountainEdge); - icyPeaks.addEdgeVariant(icyPeaksEdge); - jungle.addEdgeVariant(jungleEdge, new WorldConfigurationInfo.Condition() { - @Override - public boolean satisfiesContraints(WorldConfigurationInfo info) { - return info.getBTAVersion().isVersionAtLeast(BTAVersion.V1_3_2); - } - }); - jungleHills.setConnectToEdge(false); - } - - private static BTABiomeConfiguration instance; - - public static BTABiomeConfiguration getInstance() { - if (instance == null) { - instance = new BTABiomeConfiguration(); - } - - return instance; - } -} diff --git a/minecraft_server/betterterrain/biome/BiomeDecorator.java b/minecraft_server/betterterrain/biome/BiomeDecorator.java deleted file mode 100644 index 7c5e5f9..0000000 --- a/minecraft_server/betterterrain/biome/BiomeDecorator.java +++ /dev/null @@ -1,647 +0,0 @@ -package betterterrain.biome; - -import java.util.Random; - -import betterterrain.BTAVersion; -import betterterrain.DecoIntegration; -import betterterrain.feature.plant.DecoFlowerGen; -import betterterrain.feature.plant.FlowerGen; -import betterterrain.feature.plant.MelonGen; -import betterterrain.feature.plant.MyceliumGen; -import betterterrain.feature.terrain.ClayGen; -import betterterrain.feature.terrain.OasisGen; -import betterterrain.feature.terrain.OreGen; -import betterterrain.feature.terrain.SkyClayGen; -import betterterrain.feature.terrain.SteppeGen; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.config.WorldConfigurationInfoLegacy; -import betterterrain.world.generate.BTADefaultChunkProvider; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.ChunkProviderServer; -import net.minecraft.src.FCAddOn; -import net.minecraft.src.FCAddOnHandler; -import net.minecraft.src.FCIBiomeDecorator; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenBigMushroom; -import net.minecraft.src.WorldGenCactus; -import net.minecraft.src.WorldGenDeadBush; -import net.minecraft.src.WorldGenLiquids; -import net.minecraft.src.WorldGenPumpkin; -import net.minecraft.src.WorldGenReed; -import net.minecraft.src.WorldGenSand; -import net.minecraft.src.WorldGenWaterlily; -import net.minecraft.src.WorldGenerator; - -public class BiomeDecorator implements FCIBiomeDecorator -{ - /** The world the BiomeDecorator is currently decorating */ - protected World currentWorld; - - /** The Biome Decorator's random number generator. */ - protected Random randomGenerator; - - /** The X-coordinate of the chunk currently being decorated */ - protected int chunk_X; - - /** The Z-coordinate of the chunk currently being decorated */ - protected int chunk_Z; - - /** The biome generator object. */ - protected BiomeGenBase biome; - - /** The clay generator. */ - protected WorldGenerator clayGen = new ClayGen(4); - protected WorldGenerator clayGenSky = new SkyClayGen(4); - - /** The sand generator. */ - protected WorldGenerator sandGen; - - /** The gravel generator. */ - protected WorldGenerator gravelAsSandGen; - - /** The dirt generator. */ - protected WorldGenerator dirtGen; - protected WorldGenerator gravelGen; - protected WorldGenerator coalGen; - protected WorldGenerator ironGen; - - /** Field that holds gold WorldGenMinable */ - protected WorldGenerator goldGen; - - /** Field that holds redstone WorldGenMinable */ - protected WorldGenerator redstoneGen; - - /** Field that holds diamond WorldGenMinable */ - protected WorldGenerator diamondGen; - - /** Field that holds Lapis WorldGenMinable */ - protected WorldGenerator lapisGen; - - /** Field that holds one of the plantYellow WorldGenFlowers */ - protected WorldGenerator plantYellowGen; - - /** Field that holds one of the plantRed WorldGenFlowers */ - protected WorldGenerator plantRedGen; - - /** Field that holds mushroomBrown WorldGenFlowers */ - protected WorldGenerator mushroomBrownGen; - - /** Field that holds mushroomRed WorldGenFlowers */ - protected WorldGenerator mushroomRedGen; - - /** Field that holds big mushroom generator */ - protected WorldGenerator bigMushroomGen; - - /** Field that holds WorldGenReed */ - protected WorldGenerator reedGen; - - /** Field that holds WorldGenCactus */ - protected WorldGenerator cactusGen; - - /** The water lily generation! */ - protected WorldGenerator waterlilyGen; - - /** Amount of waterlilys per chunk. */ - public int waterlilyPerChunk; - - /** - * The number of trees to attempt to generate per chunk. Up to 10 in forests, none in deserts. - */ - public int treesPerChunk; - - /** - * The number of yellow flower patches to generate per chunk. The game generates much less than this number, since - * it attempts to generate them at a random altitude. - */ - public int flowersPerChunk; - - /** The amount of tall grass to generate per chunk. */ - public int grassPerChunk; - - /** - * The number of dead bushes to generate per chunk. Used in deserts and swamps. - */ - public int deadBushPerChunk; - - /** - * The number of extra mushroom patches per chunk. It generates 1/4 this number in brown mushroom patches, and 1/8 - * this number in red mushroom patches. These mushrooms go beyond the default base number of mushrooms. - */ - public int mushroomsPerChunk; - - /** - * The number of reeds to generate per chunk. Reeds won't generate if the randomly selected placement is unsuitable. - */ - public int reedsPerChunk; - - /** - * The number of cactus plants to generate per chunk. Cacti only work on sand. - */ - public int cactiPerChunk; - - /** - * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. - */ - public int sandPerChunk; - - /** - * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. There - * appear to be two separate fields for this. - */ - public int sandPerChunk2; - - /** - * The number of clay patches to generate per chunk. Only generates when part of it is underwater. - */ - public int clayPerChunk; - - /** Amount of big mushrooms per chunk */ - protected int bigMushroomsPerChunk; - - /** True if decorator should generate surface lava & water */ - public boolean generateLakes; - - //BTA - protected WorldGenerator oasisGen; - protected WorldGenerator pumpkinGen; - protected WorldGenerator steppeGen; - protected WorldGenerator steppeGenGravel; - protected WorldGenerator stoneInGrassGen; - protected WorldGenerator stoneInGrassGen2; - protected WorldGenerator bigRedMushroomGen; - protected WorldGenerator outbackGen; - protected WorldGenerator decoFlowerGen; - protected WorldGenerator graniteGen; - protected WorldGenerator andesiteGen; - protected WorldGenerator dioriteGen; - protected WorldGenerator slateGen; - protected WorldGenerator melonGen; - - public int oasesPerChunk; - public int waterLakesPerChunk; - public int lavaLakesPerChunk; - public int steppePerChunk; - public int steppeGravelPerChunk; - public int bigRedMushroomsPerChunk; - public boolean generateStoneInGrass; - public boolean generateStoneInGrass2; - public boolean generateOutback; - - public int fractionalTreeChance; - public int melonChancePerChunk; - - private WorldConfigurationInfo generatorInfo; - - public BiomeDecorator(BiomeGenBase par1BiomeGenBase) - { - this.sandGen = new WorldGenSand(7, Block.sand.blockID); - this.gravelAsSandGen = new WorldGenSand(6, Block.gravel.blockID); - this.dirtGen = new OreGen(Block.dirt.blockID, 0, 32, Block.stone.blockID); - this.gravelGen = new OreGen(Block.gravel.blockID, 0, 32, Block.stone.blockID); - this.coalGen = new OreGen(Block.oreCoal.blockID, 0, 16, Block.stone.blockID); - this.ironGen = new OreGen(Block.oreIron.blockID, 0, 8, Block.stone.blockID); - this.goldGen = new OreGen(Block.oreGold.blockID, 0, 8, Block.stone.blockID); - this.redstoneGen = new OreGen(Block.oreRedstone.blockID, 0, 7, Block.stone.blockID); - this.diamondGen = new OreGen(Block.oreDiamond.blockID, 0, 7, Block.stone.blockID); - this.lapisGen = new OreGen(Block.oreLapis.blockID, 0, 6, Block.stone.blockID); - this.plantYellowGen = new FlowerGen(Block.plantYellow.blockID); - this.plantRedGen = new FlowerGen(Block.plantRed.blockID); - this.mushroomBrownGen = new FlowerGen(Block.mushroomBrown.blockID); - this.mushroomRedGen = new FlowerGen(Block.mushroomRed.blockID); - this.bigMushroomGen = new WorldGenBigMushroom(); - this.reedGen = new WorldGenReed(); - this.cactusGen = new WorldGenCactus(); - this.waterlilyGen = new WorldGenWaterlily(); - this.waterlilyPerChunk = 0; - this.treesPerChunk = 0; - this.flowersPerChunk = 2; - this.grassPerChunk = 1; - this.deadBushPerChunk = 0; - this.mushroomsPerChunk = 0; - this.reedsPerChunk = 0; - this.cactiPerChunk = 0; - this.sandPerChunk = 1; - this.sandPerChunk2 = 3; - this.clayPerChunk = 1; - this.bigMushroomsPerChunk = 0; - this.generateLakes = true; - this.biome = par1BiomeGenBase; - - //BTA - pumpkinGen = new WorldGenPumpkin(); - melonGen = new MelonGen(); - oasisGen = new OasisGen(7, Block.grass.blockID); - steppeGen = new SteppeGen(Block.sand.blockID, 0); - stoneInGrassGen = new MyceliumGen(Block.stone.blockID, 32); - stoneInGrassGen2 = new OreGen(Block.stone.blockID, 48); - bigRedMushroomGen = new WorldGenBigMushroom(1); - decoFlowerGen = new DecoFlowerGen(); - - if (DecoIntegration.isDecoInstalled()) { - outbackGen = new MyceliumGen(Block.grass.blockID, 48, DecoIntegration.redSand.blockID); - - graniteGen = new OreGen(DecoIntegration.stoneTypes.blockID, 0, 32, Block.stone.blockID); - andesiteGen = new OreGen(DecoIntegration.stoneTypes.blockID, 1, 32, Block.stone.blockID); - dioriteGen = new OreGen(DecoIntegration.stoneTypes.blockID, 2, 32, Block.stone.blockID); - slateGen = new OreGen(Block.stone.blockID, 3, 32, Block.stone.blockID); - } - - oasesPerChunk = 0; - steppePerChunk = 0; - waterLakesPerChunk = 50; - lavaLakesPerChunk = 20; - bigRedMushroomsPerChunk = 0; - fractionalTreeChance = 10; - melonChancePerChunk = 24; - } - - /** - * Decorates the world. Calls code that was formerly (pre-1.8) in ChunkProviderGenerate.populate - */ - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - if (this.currentWorld != null) - { - //throw new RuntimeException("Already decorating!!"); - FCAddOnHandler.LogWarning("WARNING: Already decorating!"); - } - else - { - this.currentWorld = par1World; - if (this.currentWorld.provider.generatorOptions.equals("")) { - this.generatorInfo = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(this.currentWorld.provider.terrainType.isDeco()); - } - else { - this.generatorInfo = WorldConfigurationInfo.createInfoFromString(this.currentWorld.provider.generatorOptions); - } - this.randomGenerator = par2Random; - this.chunk_X = par3; - this.chunk_Z = par4; - this.decorate(); - this.currentWorld = null; - this.randomGenerator = null; - } - } - - public void init(World par1World, Random par2Random, int par3, int par4) { - this.currentWorld = par1World; - if (this.currentWorld.provider.generatorOptions.equals("")) { - this.generatorInfo = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(this.currentWorld.provider.terrainType.isDeco()); - } - else { - this.generatorInfo = WorldConfigurationInfo.createInfoFromString(this.currentWorld.provider.generatorOptions); - } - this.randomGenerator = par2Random; - this.chunk_X = par3; - this.chunk_Z = par4; - this.currentWorld = null; - this.randomGenerator = null; - } - - /** - * The method that does the work of actually decorating chunks - */ - protected void decorate() - { - this.generateOres(); - int var1; - int var2; - int var3; - - for (var1 = 0; var1 < oasesPerChunk; ++var1) - { - try - { - var2 = chunk_X + randomGenerator.nextInt(16) + 8; - var3 = chunk_Z + randomGenerator.nextInt(16) + 8; - oasisGen.generate(currentWorld, randomGenerator, var2, currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); - } - catch (Exception e) - { - - } - } - - for (var1 = 0; var1 < this.sandPerChunk2; ++var1) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - if (this.currentWorld.provider.terrainType.canPerlinBeachesBeToggled() && !(this.currentWorld.getChunkProvider() instanceof ChunkProviderServer)) - if (!this.generatorInfo.generatePerlinBeaches()) - if ((this.biome instanceof BTABiome && ((BTABiome) this.biome).spawnSand(this.generatorInfo))) - this.sandGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); - } - - for (var1 = 0; var1 < this.clayPerChunk; ++var1) - { - if (this.currentWorld.rand.nextInt(3) != 0) { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - if (this.currentWorld.provider.terrainType.isSky()) { - if (this.randomGenerator.nextInt(5) == 0) - this.clayGenSky.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); - } - else { - this.clayGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); - } - } - } - - for (var1 = 0; var1 < this.sandPerChunk; ++var1) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - if (this.currentWorld.provider.terrainType.canPerlinBeachesBeToggled() && !(this.currentWorld.getChunkProvider() instanceof ChunkProviderServer)) - if (!this.generatorInfo.generatePerlinBeaches()) - if ((this.biome instanceof BTABiome && ((BTABiome) this.biome).spawnSand(this.generatorInfo))) - this.sandGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); - } - - if (generateOutback && this.generatorInfo.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_2_1)) - { - this.genStandardOre1(30, outbackGen, 64, 128); - } - - var1 = this.treesPerChunk; - - if (this.randomGenerator.nextInt(fractionalTreeChance) == 0) - { - ++var1; - } - - SurfaceBuilder.generateTrees(this.currentWorld, this.randomGenerator, this.currentWorld.getSeed(), this.generatorInfo, this.chunk_X, this.chunk_Z, (BTABiome) this.biome); - - int var4; - - for (var2 = 0; var2 < this.bigMushroomsPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, var3, this.currentWorld.getHeightValue(var3, var4), var4); - } - - int var7; - - for (var2 = 0; var2 < this.flowersPerChunk; ++var2) - { - if (DecoIntegration.isDecoInstalled() && (this.currentWorld.provider.terrainType.isDeco())) { - if (this.randomGenerator.nextInt(24) > 1) { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.decoFlowerGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - else { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.plantYellowGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.plantRedGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - } - else { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.plantYellowGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - - if (this.randomGenerator.nextInt(4) == 0) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.plantRedGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - } - } - - for (var2 = 0; var2 < this.grassPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - WorldGenerator var6 = this.biome.getRandomWorldGenForGrass(this.randomGenerator); - var6.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - - for (var2 = 0; var2 < this.deadBushPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - (new WorldGenDeadBush(Block.deadBush.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - - for (var2 = 0; var2 < this.waterlilyPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - - for (var7 = this.randomGenerator.nextInt(128); var7 > 0 && this.currentWorld.getBlockId(var3, var7 - 1, var4) == 0; --var7) - { - ; - } - - this.waterlilyGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); - } - - for (var2 = 0; var2 < this.mushroomsPerChunk; ++var2) - { - if (this.randomGenerator.nextInt(4) == 0) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - var7 = this.currentWorld.getHeightValue(var3, var4); - this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); - } - - if (this.randomGenerator.nextInt(8) == 0) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - var7 = this.randomGenerator.nextInt(128); - this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); - } - } - - if (this.randomGenerator.nextInt(4) == 0) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.randomGenerator.nextInt(128); - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4); - } - - if (this.randomGenerator.nextInt(8) == 0) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.randomGenerator.nextInt(128); - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4); - } - - for (var2 = 0; var2 < this.reedsPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - var7 = this.randomGenerator.nextInt(128); - this.reedGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); - - if (this.currentWorld.provider.terrainType.isSky()) { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - var7 = this.randomGenerator.nextInt(128); - this.reedGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); - } - } - - if (this.randomGenerator.nextInt(32) == 0) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.randomGenerator.nextInt(128); - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.pumpkinGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4); - } - - if (this.randomGenerator.nextInt(melonChancePerChunk) == 0) - { - var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var3 = this.randomGenerator.nextInt(128); - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.melonGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4); - } - - //BTA modified - if (this.generateLakes || generatorInfo.getBTAVersion().isVersionAtOrBelow(BTAVersion.V2_0_2)) - { - for (var2 = 0; var2 < waterLakesPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(this.randomGenerator.nextInt(120) + 8); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - (new WorldGenLiquids(Block.waterMoving.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - - for (var2 = 0; var2 < lavaLakesPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(this.randomGenerator.nextInt(this.randomGenerator.nextInt(112) + 8) + 8); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - (new WorldGenLiquids(Block.lavaMoving.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - } - - for (var2 = 0; var2 < steppePerChunk; ++var2) - { - try - { - var3 = chunk_X + randomGenerator.nextInt(16) + 8; - var4 = randomGenerator.nextInt(128); - var7 = chunk_Z + randomGenerator.nextInt(16) + 8; - steppeGen.generate(currentWorld, randomGenerator, var3, var4, var7); - } - catch (Exception e) - { - - } - } - - for (var2 = 0; var2 < this.bigRedMushroomsPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.bigRedMushroomGen.generate(this.currentWorld, this.randomGenerator, var3, this.currentWorld.getHeightValue(var3, var4), var4); - } - - if (generateStoneInGrass && this.generatorInfo.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_3_4)) - { - this.genStandardOre1(15, stoneInGrassGen, 64, 128); - } - - if (generateStoneInGrass2 && this.generatorInfo.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_3_4)) - { - this.genStandardOre1(20, stoneInGrassGen2, 64, 128); - } - - for (var2 = 0; var2 < this.cactiPerChunk; ++var2) - { - var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; - var4 = this.randomGenerator.nextInt(128); - var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; - this.cactusGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); - } - - for (FCAddOn mod : FCAddOnHandler.m_ModList.values()) { - if (!((BTABiome) this.biome).interceptCustomDecorator(this, this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z)) { - mod.decorateWorld(this, this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z, this.biome); - } - } - } - - /** - * Standard ore generation helper. Generates most ores. - */ - public void genStandardOre1(int par1, WorldGenerator par2WorldGenerator, int par3, int par4) - { - for (int var5 = 0; var5 < par1; ++var5) - { - int var6 = this.chunk_X + this.randomGenerator.nextInt(16); - int var7 = this.randomGenerator.nextInt(par4 - par3) + par3; - int var8 = this.chunk_Z + this.randomGenerator.nextInt(16); - par2WorldGenerator.generate(this.currentWorld, this.randomGenerator, var6, var7, var8); - } - } - - /** - * Standard ore generation helper. Generates Lapis Lazuli. - */ - public void genStandardOre2(int par1, WorldGenerator par2WorldGenerator, int par3, int par4) - { - for (int var5 = 0; var5 < par1; ++var5) - { - int var6 = this.chunk_X + this.randomGenerator.nextInt(16); - int var7 = this.randomGenerator.nextInt(par4) + this.randomGenerator.nextInt(par4) + (par3 - par4); - int var8 = this.chunk_Z + this.randomGenerator.nextInt(16); - par2WorldGenerator.generate(this.currentWorld, this.randomGenerator, var6, var7, var8); - } - } - - /** - * Generates ores in the current chunk - */ - protected void generateOres() - { - this.genStandardOre1(20, this.dirtGen, 0, 128); - this.genStandardOre1(10, this.gravelGen, 0, 128); - - if (this.currentWorld.provider.terrainType.isSky()) { - this.genStandardOre1(20, this.coalGen, 0, 128); - this.genStandardOre1(24, this.ironGen, 0, 80); - this.genStandardOre1(3, this.goldGen, 0, 48); - this.genStandardOre1(12, this.redstoneGen, 0, 32); - this.genStandardOre1(2, this.diamondGen, 16, 32); - this.genStandardOre2(1, this.lapisGen, 32, 16); - } - else { - this.genStandardOre1(20, this.coalGen, 0, 128); - this.genStandardOre1(20, this.ironGen, 0, 64); - this.genStandardOre1(2, this.goldGen, 0, 32); - this.genStandardOre1(8, this.redstoneGen, 0, 16); - this.genStandardOre1(1, this.diamondGen, 0, 16); - this.genStandardOre2(1, this.lapisGen, 16, 16); - } - - if (DecoIntegration.isDecoInstalled() && (this.currentWorld.provider.terrainType.isDeco())) { - this.genStandardOre1(12, this.graniteGen, 0, 128); - this.genStandardOre1(12, this.andesiteGen, 0, 128); - this.genStandardOre1(12, this.dioriteGen, 0, 128); - this.genStandardOre1(12, this.slateGen, 0, this.currentWorld.provider.terrainType.getStrataLevels()[1]); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/BiomeHeight.java b/minecraft_server/betterterrain/biome/BiomeHeight.java deleted file mode 100644 index abedc74..0000000 --- a/minecraft_server/betterterrain/biome/BiomeHeight.java +++ /dev/null @@ -1,9 +0,0 @@ -package betterterrain.biome; - -public enum BiomeHeight { - MOUNTAINS, - HILLY, - FLAT, - SHALLOWS, - WATER -} diff --git a/minecraft_server/betterterrain/biome/BiomeInfo.java b/minecraft_server/betterterrain/biome/BiomeInfo.java deleted file mode 100644 index a317f03..0000000 --- a/minecraft_server/betterterrain/biome/BiomeInfo.java +++ /dev/null @@ -1,61 +0,0 @@ -package betterterrain.biome; - -import net.minecraft.src.BiomeGenBase; - -public class BiomeInfo { - private int id; - private boolean enabled; - private boolean decoOnly; - - public BiomeInfo(int id, boolean enabled) { - this(id, enabled, false); - } - - public BiomeInfo(int id, boolean enabled, boolean decoOnly) { - this.id = id; - this.enabled = enabled; - this.decoOnly = decoOnly; - } - - public int getID() { - return id; - } - - public String getName() { - return BiomeGenBase.biomeList[id].biomeName; - } - - public BiomeGenBase getBiome() { - return BiomeGenBase.biomeList[this.id]; - } - - public boolean isDecoOnly() { - return decoOnly; - } - - public boolean getEnabled() { - return this.enabled; - } - - public BiomeInfo setEnabled(boolean enabled) { - this.enabled = enabled; - return this; - } - - public String toString() { - String var1 = ""; - - if (this.enabled) { - var1 = this.id + "=true"; - } - else { - var1 = this.id + "=false"; - } - - return var1; - } - - public BiomeInfo copy() { - return new BiomeInfo(this.id, this.enabled, this.decoOnly); - } -} diff --git a/minecraft_server/betterterrain/biome/Climate.java b/minecraft_server/betterterrain/biome/Climate.java deleted file mode 100644 index 0c0f54b..0000000 --- a/minecraft_server/betterterrain/biome/Climate.java +++ /dev/null @@ -1,34 +0,0 @@ -package betterterrain.biome; - -public enum Climate { - SNOWY(-1, 0, true), - COLD(-2, 95, true), - TEMPERATE(-3, 256, true), - TROPICAL(-4, 256, true), - ARID(-5, 256, true), - HELL(-6, 256, false); - - public final int id; - public final int minHeightForSnow; - public final boolean isOverworld; - - private Climate(int id, int minHeightForSnow, boolean isOverworld) { - this.id = id; - this.minHeightForSnow = minHeightForSnow; - this.isOverworld = isOverworld; - } - - public static Climate fromID(int id) { - for (Climate c : Climate.values()) { - if (c.id == id) { - return c; - } - } - - return null; - } - - public boolean hasSnowVariance() { - return this.minHeightForSnow != 0 && this.minHeightForSnow != 256; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/BeachBiome.java b/minecraft_server/betterterrain/biome/biomes/BeachBiome.java deleted file mode 100644 index d1ee129..0000000 --- a/minecraft_server/betterterrain/biome/biomes/BeachBiome.java +++ /dev/null @@ -1,19 +0,0 @@ -package betterterrain.biome.biomes; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.Block; - -public class BeachBiome extends BTABiome -{ - public BeachBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.clear(); - this.topBlockExt = (byte)Block.sand.blockID; - this.fillerBlockExt = (byte)Block.sand.blockID; - this.btaBiomeDecorator.treesPerChunk = -999; - this.btaBiomeDecorator.deadBushPerChunk = 0; - this.btaBiomeDecorator.reedsPerChunk = 0; - this.btaBiomeDecorator.cactiPerChunk = 0; - } -} diff --git a/minecraft_server/betterterrain/biome/biomes/DesertBiome.java b/minecraft_server/betterterrain/biome/biomes/DesertBiome.java deleted file mode 100644 index a6bc007..0000000 --- a/minecraft_server/betterterrain/biome/biomes/DesertBiome.java +++ /dev/null @@ -1,42 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenDesertWells; - -public class DesertBiome extends BTABiome -{ - public DesertBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.clear(); - this.topBlockExt = (byte)Block.sand.blockID; - this.fillerBlockExt = (byte)Block.sand.blockID; - this.btaBiomeDecorator.treesPerChunk = -999; - this.btaBiomeDecorator.deadBushPerChunk = 2; - this.btaBiomeDecorator.cactiPerChunk = 10; - this.btaBiomeDecorator.generateLakes = false; - } - - public void decorate(World par1World, Random par2Random, int par3, int par4, WorldConfigurationInfo generatorOptions) - { - super.decorate(par1World, par2Random, par3, par4, generatorOptions); - - if (par2Random.nextInt(1000) == 0) - { - int var5 = par3 + par2Random.nextInt(16) + 8; - int var6 = par4 + par2Random.nextInt(16) + 8; - WorldGenDesertWells var7 = new WorldGenDesertWells(); - var7.generate(par1World, par2Random, var5, par1World.getHeightValue(var5, var6) + 1, var6); - } - } - - public boolean CanLightningStrikeInBiome() - { - return true; - } -} diff --git a/minecraft_server/betterterrain/biome/biomes/DesertRiverBiome.java b/minecraft_server/betterterrain/biome/biomes/DesertRiverBiome.java deleted file mode 100644 index 9e9b531..0000000 --- a/minecraft_server/betterterrain/biome/biomes/DesertRiverBiome.java +++ /dev/null @@ -1,18 +0,0 @@ -package betterterrain.biome.biomes; - -import betterterrain.biome.BTABiomeConfiguration; -import net.minecraft.src.Block; - -public class DesertRiverBiome extends RiverBiome { - public DesertRiverBiome(int id, String internalName) { - super(id, internalName, BTABiomeConfiguration.desert.climate); - this.spawnableCreatureList.clear(); - this.topBlockExt = (byte)Block.sand.blockID; - this.fillerBlockExt = (byte)Block.sand.blockID; - } - - public boolean CanLightningStrikeInBiome() - { - return true; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/IcyPeaksBiome.java b/minecraft_server/betterterrain/biome/biomes/IcyPeaksBiome.java deleted file mode 100644 index 4232400..0000000 --- a/minecraft_server/betterterrain/biome/biomes/IcyPeaksBiome.java +++ /dev/null @@ -1,33 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenerator; - -public class IcyPeaksBiome extends BTABiome { - public IcyPeaksBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.grassPerChunk = 2; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return (WorldGenerator)(par1Random.nextInt(3) == 0 ? new TaigaGen5(false) : new WorldGenTaiga2(false)); - } - - public void decorate(World var1, Random var2, int var3, int var4, WorldConfigurationInfo generatorOptions) - { - super.decorate(var1, var2, var3, var4, generatorOptions); - this.addEmeralds(var1, var2, var3, var4); - this.addSilverfishBlocks(var1, var2, var3, var4); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/JungleBiome.java b/minecraft_server/betterterrain/biome/biomes/JungleBiome.java deleted file mode 100644 index e716181..0000000 --- a/minecraft_server/betterterrain/biome/biomes/JungleBiome.java +++ /dev/null @@ -1,83 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenHugeTrees; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenVines; -import net.minecraft.src.WorldGenerator; - -public class JungleBiome extends BTABiome -{ - public JungleBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 50; - this.btaBiomeDecorator.grassPerChunk = 25; - this.btaBiomeDecorator.flowersPerChunk = 4; - this.btaBiomeDecorator.sandPerChunk = 100; - this.btaBiomeDecorator.sandPerChunk2 = 100; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - this.waterColorMultiplier = 10083127; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return (WorldGenerator)(par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : (par1Random.nextInt(2) == 0 ? new WorldGenShrub(3, 0) : (par1Random.nextInt(3) == 0 ? new WorldGenHugeTrees(false, 10 + par1Random.nextInt(20), 3, 3) : new WorldGenTrees(false, 4 + par1Random.nextInt(7), 3, 3, true)))); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(4) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } - - public void decorate(World par1World, Random par2Random, int par3, int par4, WorldConfigurationInfo generatorOptions) - { - super.decorate(par1World, par2Random, par3, par4, generatorOptions); - WorldGenVines var5 = new WorldGenVines(); - - for (int var6 = 0; var6 < 50; ++var6) - { - int var7 = par3 + par2Random.nextInt(16) + 8; - byte var8 = 64; - int var9 = par4 + par2Random.nextInt(16) + 8; - var5.generate(par1World, par2Random, var7, var8, var9); - } - } -} diff --git a/minecraft_server/betterterrain/biome/biomes/JungleEdgeBiome.java b/minecraft_server/betterterrain/biome/biomes/JungleEdgeBiome.java deleted file mode 100644 index c06b033..0000000 --- a/minecraft_server/betterterrain/biome/biomes/JungleEdgeBiome.java +++ /dev/null @@ -1,83 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityChicken; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntityPig; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenHugeTrees; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenVines; -import net.minecraft.src.WorldGenerator; - -public class JungleEdgeBiome extends BTABiome -{ - public JungleEdgeBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 5; - this.btaBiomeDecorator.grassPerChunk = 25; - this.btaBiomeDecorator.flowersPerChunk = 4; - this.btaBiomeDecorator.sandPerChunk = 100; - this.btaBiomeDecorator.sandPerChunk2 = 100; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.spawnableCreatureList.clear(); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityPig.class, 10, 4, 4)); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityChicken.class, 10, 4, 4)); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - this.waterColorMultiplier = 10083127; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return (WorldGenerator)(par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : (par1Random.nextInt(2) == 0 ? new WorldGenShrub(3, 0) : (par1Random.nextInt(3) == 0 ? new WorldGenHugeTrees(false, 10 + par1Random.nextInt(20), 3, 3) : new WorldGenTrees(false, 4 + par1Random.nextInt(7), 3, 3, true)))); - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(4) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } - - public void decorate(World par1World, Random par2Random, int par3, int par4, WorldConfigurationInfo generatorOptions) - { - super.decorate(par1World, par2Random, par3, par4, generatorOptions); - WorldGenVines var5 = new WorldGenVines(); - - for (int var6 = 0; var6 < 50; ++var6) - { - int var7 = par3 + par2Random.nextInt(16) + 8; - byte var8 = 64; - int var9 = par4 + par2Random.nextInt(16) + 8; - var5.generate(par1World, par2Random, var7, var8, var9); - } - } -} diff --git a/minecraft_server/betterterrain/biome/biomes/JungleRiverBiome.java b/minecraft_server/betterterrain/biome/biomes/JungleRiverBiome.java deleted file mode 100644 index 7f80ed2..0000000 --- a/minecraft_server/betterterrain/biome/biomes/JungleRiverBiome.java +++ /dev/null @@ -1,32 +0,0 @@ -package betterterrain.biome.biomes; - -import betterterrain.biome.BTABiomeConfiguration; -import net.minecraft.src.FCEntityCreeper; -import net.minecraft.src.FCEntityEnderman; -import net.minecraft.src.FCEntityJungleSpider; -import net.minecraft.src.FCEntityOcelot; -import net.minecraft.src.FCEntitySkeleton; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntitySpider; -import net.minecraft.src.FCEntityZombie; -import net.minecraft.src.SpawnListEntry; - -public class JungleRiverBiome extends RiverBiome { - public JungleRiverBiome(int id, String internalName) { - super(id, internalName, BTABiomeConfiguration.jungle.climate); - this.waterColorMultiplier = BTABiomeConfiguration.jungle.waterColorMultiplier; - this.btaBiomeDecorator.sandPerChunk = 100; - this.btaBiomeDecorator.sandPerChunk2 = 100; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.spawnableCreatureList.clear(); - this.spawnableMonsterList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityJungleSpider.class, 2, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySpider.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityZombie.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySkeleton.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityCreeper.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 10, 4, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityEnderman.class, 1, 1, 4)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityOcelot.class, 2, 1, 1)); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/MountainBiome.java b/minecraft_server/betterterrain/biome/biomes/MountainBiome.java deleted file mode 100644 index 2491a7d..0000000 --- a/minecraft_server/betterterrain/biome/biomes/MountainBiome.java +++ /dev/null @@ -1,35 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.PineTreeGen; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class MountainBiome extends BTABiome { - - public MountainBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 2; - this.btaBiomeDecorator.grassPerChunk = 3; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(4) == 0 ? worldGeneratorTrees : new PineTreeGen(false); - } - - public void decorate(World var1, Random var2, int var3, int var4, WorldConfigurationInfo generatorOptions) - { - super.decorate(var1, var2, var3, var4, generatorOptions); - this.addEmeralds(var1, var2, var3, var4); - this.addSilverfishBlocks(var1, var2, var3, var4); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/NetherWastesBiome.java b/minecraft_server/betterterrain/biome/biomes/NetherWastesBiome.java deleted file mode 100644 index f55dc60..0000000 --- a/minecraft_server/betterterrain/biome/biomes/NetherWastesBiome.java +++ /dev/null @@ -1,9 +0,0 @@ -package betterterrain.biome.biomes; - -import betterterrain.biome.BTANetherBiome; - -public class NetherWastesBiome extends BTANetherBiome { - public NetherWastesBiome(int id, String internalName) { - super(id, internalName); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/PlainsBiome.java b/minecraft_server/betterterrain/biome/biomes/PlainsBiome.java deleted file mode 100644 index 9da0ebe..0000000 --- a/minecraft_server/betterterrain/biome/biomes/PlainsBiome.java +++ /dev/null @@ -1,44 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.SmallShrubGen; -import betterterrain.feature.tree.TinyShrubGen; -import net.minecraft.src.WorldGenBigTree; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenerator; - -public class PlainsBiome extends BTABiome { - public PlainsBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.reedsPerChunk = 10; - this.btaBiomeDecorator.fractionalTreeChance = 5; - this.btaBiomeDecorator.grassPerChunk = 30; - this.btaBiomeDecorator.flowersPerChunk = 20; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(10) == 0) { - gen = new WorldGenBigTree(false); - } - else if (rand.nextInt(3) == 0) { - gen = new SmallShrubGen(); - } - else if (rand.nextInt(2) == 0) { - gen = new WorldGenShrub(0, 0); - } - else { - gen = new TinyShrubGen(); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/RiverBiome.java b/minecraft_server/betterterrain/biome/biomes/RiverBiome.java deleted file mode 100644 index 50e818c..0000000 --- a/minecraft_server/betterterrain/biome/biomes/RiverBiome.java +++ /dev/null @@ -1,12 +0,0 @@ -package betterterrain.biome.biomes; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; - -public class RiverBiome extends BTABiome -{ - public RiverBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.clear(); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/SiberiaBiome.java b/minecraft_server/betterterrain/biome/biomes/SiberiaBiome.java deleted file mode 100644 index 829e132..0000000 --- a/minecraft_server/betterterrain/biome/biomes/SiberiaBiome.java +++ /dev/null @@ -1,60 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.SmallShrubGen; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.feature.tree.TaigaGen6; -import betterterrain.feature.tree.TaigaGen7; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenerator; - -public class SiberiaBiome extends BTABiome { - public SiberiaBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 20; - this.btaBiomeDecorator.grassPerChunk = 2; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(7) == 0) { - gen = new WorldGenTaiga2(false); - } - else if (rand.nextInt(6) == 0) { - gen = new TaigaGen5(false); - } - else if (rand.nextInt(5) == 0) { - gen = new TaigaGen6(false); - } - else if (rand.nextInt(4) == 0) { - gen = new TaigaGen7(false); - } - else { - gen = new SmallShrubGen(1, 1); - } - - return gen; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/SwampRiverBiome.java b/minecraft_server/betterterrain/biome/biomes/SwampRiverBiome.java deleted file mode 100644 index ba714fa..0000000 --- a/minecraft_server/betterterrain/biome/biomes/SwampRiverBiome.java +++ /dev/null @@ -1,27 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiomeConfiguration; -import betterterrain.biome.biomes.RiverBiome; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.surface.SwampSurfaceBuilder; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntitySlime; -import net.minecraft.src.FCEntityWitch; -import net.minecraft.src.Material; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenVines; - -public class SwampRiverBiome extends RiverBiome { - public SwampRiverBiome(int id, String internalName) { - super(id, internalName, BTABiomeConfiguration.swamp.climate); - this.waterColorMultiplier = BTABiomeConfiguration.swamp.waterColorMultiplier; - this.btaBiomeDecorator.waterlilyPerChunk = 4; - this.spawnableCreatureList.clear(); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntitySlime.class, 1, 1, 1)); - this.spawnableMonsterList.add(new SpawnListEntry(FCEntityWitch.class, 1, 1, 1)); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/TundraBiome.java b/minecraft_server/betterterrain/biome/biomes/TundraBiome.java deleted file mode 100644 index 7ec51d8..0000000 --- a/minecraft_server/betterterrain/biome/biomes/TundraBiome.java +++ /dev/null @@ -1,33 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.WorldGenShrub; -import net.minecraft.src.WorldGenerator; - -public class TundraBiome extends BTABiome { - public TundraBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.flowersPerChunk = -999; - this.btaBiomeDecorator.treesPerChunk = 2; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(10) == 0) { - gen = this.worldGeneratorTrees; - } - else { - gen = new WorldGenShrub(1, 1); - } - - return gen; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/WoodsBiome.java b/minecraft_server/betterterrain/biome/biomes/WoodsBiome.java deleted file mode 100644 index 3b24b4f..0000000 --- a/minecraft_server/betterterrain/biome/biomes/WoodsBiome.java +++ /dev/null @@ -1,55 +0,0 @@ -package betterterrain.biome.biomes; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.feature.tree.LogGen; -import net.minecraft.src.Block; -import net.minecraft.src.FCEntityWolf; -import net.minecraft.src.SpawnListEntry; -import net.minecraft.src.WorldGenBigTree; -import net.minecraft.src.WorldGenTrees; -import net.minecraft.src.WorldGenerator; - -public class WoodsBiome extends BTABiome { - public WoodsBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.spawnableCreatureList.add(new SpawnListEntry(FCEntityWolf.class, 5, 4, 4)); - this.btaBiomeDecorator.treesPerChunk = 10; - this.btaBiomeDecorator.grassPerChunk = 2; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random rand) - { - WorldGenerator gen; - - if (rand.nextInt(5) == 0) { - gen = this.worldGeneratorForest; - } - else if (rand.nextInt(10) == 0) { - gen = new LogGen(); - } - else if (rand.nextInt(10) == 0) { - gen = new WorldGenBigTree(false); - } - else { - gen = new WorldGenTrees(false); - } - - return gen; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(2) == 0 ? new TallGrassGen(Block.tallGrass.blockID, 2) : new TallGrassGen(Block.tallGrass.blockID, 1); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/biomes/deprecated/ForestedIcyPeaksBiome.java b/minecraft_server/betterterrain/biome/biomes/deprecated/ForestedIcyPeaksBiome.java deleted file mode 100644 index 10508cd..0000000 --- a/minecraft_server/betterterrain/biome/biomes/deprecated/ForestedIcyPeaksBiome.java +++ /dev/null @@ -1,34 +0,0 @@ -package betterterrain.biome.biomes.deprecated; - -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenerator; - -public class ForestedIcyPeaksBiome extends BTABiome { - public ForestedIcyPeaksBiome(int id, String internalName, Climate climate) { - super(id, internalName, climate); - this.btaBiomeDecorator.treesPerChunk = 3; - this.btaBiomeDecorator.grassPerChunk = 2; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return (WorldGenerator)(par1Random.nextInt(3) == 0 ? new TaigaGen5(false) : new WorldGenTaiga2(false)); - } - - public void decorate(World var1, Random var2, int var3, int var4, WorldConfigurationInfo generatorOptions) - { - super.decorate(var1, var2, var3, var4, generatorOptions); - this.addEmeralds(var1, var2, var3, var4); - this.addSilverfishBlocks(var1, var2, var3, var4); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/layer/BTALayer.java b/minecraft_server/betterterrain/biome/layer/BTALayer.java deleted file mode 100644 index bd4b866..0000000 --- a/minecraft_server/betterterrain/biome/layer/BTALayer.java +++ /dev/null @@ -1,113 +0,0 @@ -package betterterrain.biome.layer; - -import java.util.ArrayList; - -import betterterrain.BTAVersion; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.BTAMod; -import net.minecraft.src.GenLayer; -import net.minecraft.src.GenLayerAddIsland; -import net.minecraft.src.GenLayerAddMushroomIsland; -import net.minecraft.src.GenLayerFuzzyZoom; -import net.minecraft.src.GenLayerRiver; -import net.minecraft.src.GenLayerRiverInit; -import net.minecraft.src.GenLayerSmooth; -import net.minecraft.src.GenLayerVoronoiZoom; -import net.minecraft.src.GenLayerZoom; -import net.minecraft.src.WorldType; - -public abstract class BTALayer extends GenLayer { - - public BTALayer(long par1) { - super(par1); - } - - /** - * the first array item is a linked list of the bioms, the second is the zoom function, the third is the same as the - * first. - */ - public static GenLayer[] initializeAllBiomeGenerators(long seed, WorldType worldType, WorldConfigurationInfo generatorInfo) { - ContinentsLayer layerContinents = new ContinentsLayer(1L, generatorInfo.getOceanSize()); - GenLayerFuzzyZoom layerFuzzyZoom = new GenLayerFuzzyZoom(2000L, layerContinents); - - GenLayerAddIsland layerIsland = new GenLayerAddIsland(1L, layerFuzzyZoom); - GenLayerZoom layerZoom = new GenLayerZoom(2001L, layerIsland); - layerIsland = new GenLayerAddIsland(2L, layerZoom); - - ClimatesLayer layerClimates = new ClimatesLayer(2L, layerIsland, generatorInfo.getBiomesForGeneration()); - - layerZoom = new GenLayerZoom(2002L, layerIsland); - layerIsland = new GenLayerAddIsland(3L, layerZoom); - layerZoom = new GenLayerZoom(2003L, layerIsland); - layerIsland = new GenLayerAddIsland(4L, layerZoom); - GenLayerAddMushroomIsland layerMushroomIsland = new GenLayerAddMushroomIsland(5L, layerIsland); - - int scale = 3 + generatorInfo.getBiomeSize(); - - if (worldType == BTAMod.BTAWorldTypeSmall || worldType == BTAMod.BTAWorldTypeSmallDeco) - scale = 4; - - GenLayer layerMagnifyRiver = GenLayerZoom.magnify(1000L, layerMushroomIsland, 0); - GenLayerRiverInit layerRiverInit = new GenLayerRiverInit(100L, layerMagnifyRiver); - layerMagnifyRiver = GenLayerZoom.magnify(1000L, layerRiverInit, scale + 2); - GenLayerRiver layerRiver = new GenLayerRiver(1L, layerMagnifyRiver); - GenLayerSmooth layerSmoothRivers = new GenLayerSmooth(1000L, layerRiver); - GenLayer layerRivers = layerSmoothRivers; - - if (generatorInfo.hasWideRivers()) { - layerRivers = GenLayerZoom.magnify(2500L, layerRivers, 2); - } - - GenLayer layerMangnifyBiome = GenLayerZoom.magnify(1000L, layerMushroomIsland, 0); - GenLayer layerBiome; - if (generatorInfo.isClimatized() && generatorInfo.getBTAVersion().isVersionAtLeast(BTAVersion.V1_3_0)) { - GenLayer layerClimateZoom = GenLayerZoom.magnify(1000l, layerClimates, 2); - GenLayer layerClimateSmooth = new ClimateSmoothLayer(2000L, layerClimateZoom, generatorInfo.getBiomesForGeneration()); - layerClimateSmooth = new ClimateSmoothLayer2(2000L, layerClimateSmooth, generatorInfo.getBiomesForGeneration()); - layerClimateSmooth.initWorldGenSeed(seed); - - layerBiome = new BiomeClimatizedLayer(200L, layerMangnifyBiome, layerClimateSmooth, generatorInfo.getBiomesForGeneration()); - } - else { - layerBiome = new BiomeLayer(200L, layerMangnifyBiome, worldType, generatorInfo.getBiomesForGeneration()); - } - - layerMangnifyBiome = GenLayerZoom.magnify(1000L, layerBiome, 2); - GenLayer layerExtras = new HillsLayer(1000L, layerMangnifyBiome, generatorInfo); - - for (int passNum = 0; passNum < scale; passNum++) { - layerExtras = new GenLayerZoom((long)(1000 + passNum), layerExtras); - - if (passNum == 0) { - layerExtras = new GenLayerAddIsland(3L, layerExtras); - } - - if (generatorInfo.getBTAVersion().isVersionAtLeast(BTAVersion.V1_3_2)) { - if (passNum == 0) { - layerExtras = new ShoreLayer(1000L, layerExtras, generatorInfo, 0); - } - } - - if (passNum == 1) { - layerExtras = new ShoreLayer(1000L, layerExtras, generatorInfo, 1); - - // 3.0.0 and higher allow for biomes to control their own conditions for edges - if (generatorInfo.getBTAVersion().isVersionAtLeast(BTAVersion.V1_4_0) && generatorInfo.getBTAVersion().isVersionAtOrBelow(BTAVersion.V2_0_8)) { - layerExtras = new GuaranteedShoreLayer(1000L, layerExtras, generatorInfo); - } - } - - if (passNum == scale - 3) { - layerExtras = new SporadicLayer(1000L, layerExtras, generatorInfo); - } - } - - GenLayerSmooth layerSmoothBiome = new GenLayerSmooth(1000L, layerExtras); - RiverLayer layerRiverMix = new RiverLayer(100L, layerSmoothBiome, layerRivers, generatorInfo); - GenLayerVoronoiZoom layerVoronoiZoom = new GenLayerVoronoiZoom(10L, layerRiverMix); - - layerRiverMix.initWorldGenSeed(seed); - layerVoronoiZoom.initWorldGenSeed(seed); - return new GenLayer[] {layerRiverMix, layerVoronoiZoom, layerRiverMix}; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/layer/BiomeClimatizedLayer.java b/minecraft_server/betterterrain/biome/layer/BiomeClimatizedLayer.java deleted file mode 100644 index e571b9a..0000000 --- a/minecraft_server/betterterrain/biome/layer/BiomeClimatizedLayer.java +++ /dev/null @@ -1,61 +0,0 @@ -package betterterrain.biome.layer; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.biome.Climate; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; - -public class BiomeClimatizedLayer extends BTALayer { - private ArrayList biomesForGeneration; - private GenLayer climateLayer; - public static Map> biomeCategoryMapCached = new HashMap(); - - public BiomeClimatizedLayer(long baseSeed, GenLayer parent, GenLayer climates, ArrayList biomesForGeneration) - { - super(baseSeed); - this.parent = parent; - this.climateLayer = climates; - this.biomesForGeneration = biomesForGeneration; - - for (Climate c : Climate.values()) { - if (c.isOverworld) { - biomeCategoryMapCached.put(c, BiomeConfiguration.getClimateListForGenerator(c, this.biomesForGeneration)); - } - } - } - - @Override - public int[] getInts(int xOffset, int zOffset, int sizeX, int sizeZ) - { - int[] parentInts = this.parent.getInts(xOffset, zOffset, sizeX, sizeZ); - int[] climateInts = this.climateLayer.getInts(xOffset, zOffset, sizeX, sizeZ); - int[] cache = IntCache.getIntCache(sizeX * sizeZ); - - for (int i = 0; i < sizeZ; ++i) - { - for (int k = 0; k < sizeX; ++k) - { - this.initChunkSeed((long)(k + xOffset), (long)(i + zOffset)); - - int parentInt = parentInts[k + i * sizeX]; - - if (parentInt == 0) { - cache[k + i * sizeX] = 0; - } - else { - int climateID = climateInts[k + i * sizeX]; - Climate climate = Climate.fromID(climateID); - ArrayList biomesForClimate = biomeCategoryMapCached.get(climate); - - cache[k + i * sizeX] = biomesForClimate.get(this.nextInt(biomesForClimate.size())).biomeID; - } - } - } - return cache; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/layer/BiomeLayer.java b/minecraft_server/betterterrain/biome/layer/BiomeLayer.java deleted file mode 100644 index 171086d..0000000 --- a/minecraft_server/betterterrain/biome/layer/BiomeLayer.java +++ /dev/null @@ -1,44 +0,0 @@ -package betterterrain.biome.layer; - -import java.util.ArrayList; - -import betterterrain.biome.BTABiome; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; -import net.minecraft.src.WorldType; - -public class BiomeLayer extends BTALayer { - private ArrayList biomesForGeneration; - - public BiomeLayer(long par1, GenLayer par3GenLayer, WorldType par4WorldType, ArrayList biomesForGeneration) - { - super(par1); - parent = par3GenLayer; - this.biomesForGeneration = biomesForGeneration; - } - - @Override - public int[] getInts(int par1, int par2, int par3, int par4) - { - int[] var5 = this.parent.getInts(par1, par2, par3, par4); - int[] var6 = IntCache.getIntCache(par3 * par4); - - for (int var7 = 0; var7 < par4; ++var7) - { - for (int var8 = 0; var8 < par3; ++var8) - { - this.initChunkSeed((long)(var8 + par1), (long)(var7 + par2)); - int var9 = var5[var8 + var7 * par3]; - if (var9 == 0) - { - var6[var8 + var7 * par3] = 0; - } - else - { - var6[var8 + var7 * par3] = biomesForGeneration.get(this.nextInt(biomesForGeneration.size())).biomeID; - } - } - } - return var6; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/biome/layer/ClimateSmoothLayer.java b/minecraft_server/betterterrain/biome/layer/ClimateSmoothLayer.java deleted file mode 100644 index 43641e5..0000000 --- a/minecraft_server/betterterrain/biome/layer/ClimateSmoothLayer.java +++ /dev/null @@ -1,68 +0,0 @@ -package betterterrain.biome.layer; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.biome.Climate; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; - -public class ClimateSmoothLayer extends BTALayer { - private ArrayList biomesForGeneration; - public static Map> biomeCategoryMapCached = new HashMap(); - - public ClimateSmoothLayer(long baseSeed, GenLayer parent, ArrayList biomesForGeneration) { - super(baseSeed); - this.parent = parent; - this.biomesForGeneration = biomesForGeneration; - - for (Climate c : Climate.values()) { - if (c.isOverworld) { - biomeCategoryMapCached.put(c, BiomeConfiguration.getClimateListForGenerator(c, this.biomesForGeneration)); - } - } - } - - /** - * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall - * amounts, or biomeList[] indices based on the particular GenLayer subclass. - */ - public int[] getInts(int xOffset, int zOffset, int sizeX, int sizeZ) { - int parentXOffset = xOffset - 1; - int parentZOffset = zOffset - 1; - int parentSizeX = sizeX + 2; - int parentSizeZ = sizeZ + 2; - int[] parentArray = this.parent.getInts(parentXOffset, parentZOffset, parentSizeX, parentSizeZ); - int[] cache = IntCache.getIntCache(sizeX * sizeZ); - - for (int i = 0; i < sizeZ; ++i) { - for (int k = 0; k < sizeX; ++k) { - int climateID = parentArray[k + 1 + (i + 1) * parentSizeX]; - this.initChunkSeed((long)(k + xOffset), (long)(i + zOffset)); - - int neighborInt1 = parentArray[k + 0 + (i + 1) * parentSizeX]; - int neighborInt2 = parentArray[k + 1 + (i + 2) * parentSizeX]; - int neighborInt3 = parentArray[k + 1 + (i + 0) * parentSizeX]; - int neighborInt4 = parentArray[k + 2 + (i + 1) * parentSizeX]; - - if (climateID == Climate.SNOWY.id && biomeCategoryMapCached.get(Climate.COLD).size() > 0) { - if (neighborInt1 == Climate.TROPICAL.id || neighborInt1 == Climate.ARID.id || neighborInt1 == Climate.TEMPERATE.id) - climateID = Climate.COLD.id; - if (neighborInt2 == Climate.TROPICAL.id || neighborInt2 == Climate.ARID.id || neighborInt2 == Climate.TEMPERATE.id) - climateID = Climate.COLD.id; - if (neighborInt3 == Climate.TROPICAL.id || neighborInt3 == Climate.ARID.id || neighborInt3 == Climate.TEMPERATE.id) - climateID = Climate.COLD.id; - if (neighborInt4 == Climate.TROPICAL.id || neighborInt4 == Climate.ARID.id || neighborInt4 == Climate.TEMPERATE.id) - climateID = Climate.COLD.id; - } - - cache[k + i * sizeX] = climateID; - } - } - - return cache; - } -} diff --git a/minecraft_server/betterterrain/biome/layer/ClimateSmoothLayer2.java b/minecraft_server/betterterrain/biome/layer/ClimateSmoothLayer2.java deleted file mode 100644 index 2f478fc..0000000 --- a/minecraft_server/betterterrain/biome/layer/ClimateSmoothLayer2.java +++ /dev/null @@ -1,78 +0,0 @@ -package betterterrain.biome.layer; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.biome.Climate; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; - -public class ClimateSmoothLayer2 extends BTALayer { - private ArrayList biomesForGeneration; - public static Map> biomeCategoryMapCached = new HashMap(); - - public ClimateSmoothLayer2(long baseSeed, GenLayer parent, ArrayList biomesForGeneration) { - super(baseSeed); - this.parent = parent; - this.biomesForGeneration = biomesForGeneration; - - for (Climate c : Climate.values()) { - if (c.isOverworld) { - biomeCategoryMapCached.put(c, BiomeConfiguration.getClimateListForGenerator(c, this.biomesForGeneration)); - } - } - } - - /** - * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall - * amounts, or biomeList[] indices based on the particular GenLayer subclass. - */ - public int[] getInts(int xOffset, int zOffset, int sizeX, int sizeZ) { - int parentXOffset = xOffset - 1; - int parentZOffset = zOffset - 1; - int parentSizeX = sizeX + 2; - int parentSizeZ = sizeZ + 2; - int[] parentArray = this.parent.getInts(parentXOffset, parentZOffset, parentSizeX, parentSizeZ); - int[] cache = IntCache.getIntCache(sizeX * sizeZ); - - for (int i = 0; i < sizeZ; ++i) { - for (int k = 0; k < sizeX; ++k) { - int climateID = parentArray[k + 1 + (i + 1) * parentSizeX]; - this.initChunkSeed((long)(k + xOffset), (long)(i + zOffset)); - - int neighborInt1 = parentArray[k + 0 + (i + 1) * parentSizeX]; - int neighborInt2 = parentArray[k + 1 + (i + 2) * parentSizeX]; - int neighborInt3 = parentArray[k + 1 + (i + 0) * parentSizeX]; - int neighborInt4 = parentArray[k + 2 + (i + 1) * parentSizeX]; - - if (climateID == Climate.TROPICAL.id && biomeCategoryMapCached.get(Climate.TEMPERATE).size() > 0) { - if (neighborInt1 == Climate.COLD.id || neighborInt1 == Climate.ARID.id) - climateID = Climate.TEMPERATE.id; - if (neighborInt2 == Climate.COLD.id || neighborInt2 == Climate.ARID.id) - climateID = Climate.TEMPERATE.id; - if (neighborInt3 == Climate.COLD.id || neighborInt3 == Climate.ARID.id) - climateID = Climate.TEMPERATE.id; - if (neighborInt4 == Climate.COLD.id || neighborInt4 == Climate.ARID.id) - climateID = Climate.TEMPERATE.id; - } - else if (climateID == Climate.ARID.id && biomeCategoryMapCached.get(Climate.TEMPERATE).size() > 0) { - if (neighborInt1 == Climate.COLD.id || neighborInt1 == Climate.TROPICAL.id) - climateID = Climate.TEMPERATE.id; - if (neighborInt2 == Climate.COLD.id || neighborInt2 == Climate.TROPICAL.id) - climateID = Climate.TEMPERATE.id; - if (neighborInt3 == Climate.COLD.id || neighborInt3 == Climate.TROPICAL.id) - climateID = Climate.TEMPERATE.id; - if (neighborInt4 == Climate.COLD.id || neighborInt4 == Climate.TROPICAL.id) - climateID = Climate.TEMPERATE.id; - } - - cache[k + i * sizeX] = climateID; - } - } - - return cache; - } -} diff --git a/minecraft_server/betterterrain/biome/layer/ContinentsLayer.java b/minecraft_server/betterterrain/biome/layer/ContinentsLayer.java deleted file mode 100644 index 6c67dc2..0000000 --- a/minecraft_server/betterterrain/biome/layer/ContinentsLayer.java +++ /dev/null @@ -1,40 +0,0 @@ -package betterterrain.biome.layer; - -import net.minecraft.src.GenLayerIsland; -import net.minecraft.src.IntCache; - -public class ContinentsLayer extends GenLayerIsland -{ - private int oceanSize; - - public ContinentsLayer(long baseSeed, int oceanSize) - { - super(baseSeed); - this.oceanSize = oceanSize; - } - - /** - * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall - * amounts, or biomeList[] indices based on the particular GenLayer subclass. - */ - public int[] getInts(int par1, int par2, int par3, int par4) - { - int[] var5 = IntCache.getIntCache(par3 * par4); - - for (int var6 = 0; var6 < par4; ++var6) - { - for (int var7 = 0; var7 < par3; ++var7) - { - this.initChunkSeed((long)(par1 + var7), (long)(par2 + var6)); - var5[var7 + var6 * par3] = this.nextInt(10) <= (10 - oceanSize) ? 1 : 0; - } - } - - if (par1 > -par3 && par1 <= 0 && par2 > -par4 && par2 <= 0) - { - var5[-par1 + -par2 * par3] = 1; - } - - return var5; - } -} diff --git a/minecraft_server/betterterrain/biome/layer/GuaranteedShoreLayer.java b/minecraft_server/betterterrain/biome/layer/GuaranteedShoreLayer.java deleted file mode 100644 index 8796b40..0000000 --- a/minecraft_server/betterterrain/biome/layer/GuaranteedShoreLayer.java +++ /dev/null @@ -1,60 +0,0 @@ -package betterterrain.biome.layer; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; - -public class GuaranteedShoreLayer extends BTALayer -{ - private WorldConfigurationInfo generatorInfo; - - public GuaranteedShoreLayer(long par1, GenLayer parent, WorldConfigurationInfo generatorInfo) - { - super(par1); - this.parent = parent; - this.generatorInfo = generatorInfo; - } - - /** - * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall - * amounts, or biomeList[] indices based on the particular GenLayer subclass. - */ - public int[] getInts(int xOffset, int zOffset, int xSize, int zSize) - { - int[] parentInts = this.parent.getInts(xOffset - 1, zOffset - 1, xSize + 2, zSize + 2); - int[] intCache = IntCache.getIntCache(xSize * zSize); - - for (int i = 0; i < zSize; ++i) - { - for (int j = 0; j < xSize; ++j) - { - this.initChunkSeed((long)(j + xOffset), (long)(i + zOffset)); - int currentBiome = parentInts[j + 1 + (i + 1) * (xSize + 2)]; - int neighbor1; - int neighbor2; - int neighbor3; - int neighbor4; - - - neighbor1 = parentInts[j + 1 + (i + 1 - 1) * (xSize + 2)]; - neighbor2 = parentInts[j + 1 + 1 + (i + 1) * (xSize + 2)]; - neighbor3 = parentInts[j + 1 - 1 + (i + 1) * (xSize + 2)]; - neighbor4 = parentInts[j + 1 + (i + 1 + 1) * (xSize + 2)]; - - //If all surrounding biomes are the same as the current biome do not form an edge - if (neighbor1 == currentBiome && neighbor2 == currentBiome && neighbor3 == currentBiome && neighbor4 == currentBiome) { - intCache[j + i * xSize] = currentBiome; - } - else if (BetterBiomesConfiguration.getEdgeVariantForBiomeGuaranteed(currentBiome, this.generatorInfo) != -1) { - intCache[j + i * xSize] = BetterBiomesConfiguration.getEdgeVariantForBiomeGuaranteed(currentBiome, this.generatorInfo); - } - else { - intCache[j + i * xSize] = currentBiome; - } - } - } - - return intCache; - } -} diff --git a/minecraft_server/betterterrain/biome/layer/HillsLayer.java b/minecraft_server/betterterrain/biome/layer/HillsLayer.java deleted file mode 100644 index 131511b..0000000 --- a/minecraft_server/betterterrain/biome/layer/HillsLayer.java +++ /dev/null @@ -1,99 +0,0 @@ -package betterterrain.biome.layer; - -import betterterrain.biome.BiomeConfiguration; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; - -public class HillsLayer extends GenLayer -{ - private WorldConfigurationInfo generatorInfo; - - public HillsLayer(long par1, GenLayer par3GenLayer, WorldConfigurationInfo generatorInfo) - { - super(par1); - this.parent = par3GenLayer; - this.generatorInfo = generatorInfo; - } - - /** - * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall - * amounts, or biomeList[] indices based on the particular GenLayer subclass. - */ - public int[] getInts(int par1, int par2, int par3, int par4) - { - int[] var5 = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2); - int[] var6 = IntCache.getIntCache(par3 * par4); - - for (int var7 = 0; var7 < par4; ++var7) - { - for (int var8 = 0; var8 < par3; ++var8) - { - this.initChunkSeed((long)(var8 + par1), (long)(var7 + par2)); - int baseBiome = var5[var8 + 1 + (var7 + 1) * (par3 + 2)]; - - if (this.nextInt(3) == 0) - { - int hillsBiome = BiomeConfiguration.getSubVariantForBiomes(baseBiome, generatorInfo, this); - - if (hillsBiome == baseBiome) - { - var6[var8 + var7 * par3] = baseBiome; - } - else - { - int var11 = var5[var8 + 1 + (var7 + 1 - 1) * (par3 + 2)]; - int var12 = var5[var8 + 1 + 1 + (var7 + 1) * (par3 + 2)]; - int var13 = var5[var8 + 1 - 1 + (var7 + 1) * (par3 + 2)]; - int var14 = var5[var8 + 1 + (var7 + 1 + 1) * (par3 + 2)]; - - if (var11 == baseBiome && var12 == baseBiome && var13 == baseBiome && var14 == baseBiome) - { - var6[var8 + var7 * par3] = hillsBiome; - } - else - { - var6[var8 + var7 * par3] = baseBiome; - } - - continue; - } - } - else { - var6[var8 + var7 * par3] = baseBiome; - } - - if (this.nextInt(5) != 0) - { - int hillsBiome = BiomeConfiguration.getSubVariantForBiomesCommon(baseBiome, generatorInfo, this); - - if (hillsBiome == baseBiome) - { - var6[var8 + var7 * par3] = baseBiome; - } - else - { - int var11 = var5[var8 + 1 + (var7 + 1 - 1) * (par3 + 2)]; - int var12 = var5[var8 + 1 + 1 + (var7 + 1) * (par3 + 2)]; - int var13 = var5[var8 + 1 - 1 + (var7 + 1) * (par3 + 2)]; - int var14 = var5[var8 + 1 + (var7 + 1 + 1) * (par3 + 2)]; - - if (var11 == baseBiome && var12 == baseBiome && var13 == baseBiome && var14 == baseBiome) - { - var6[var8 + var7 * par3] = hillsBiome; - } - else - { - var6[var8 + var7 * par3] = baseBiome; - } - } - } - else { - var6[var8 + var7 * par3] = baseBiome; - } - } - } - - return var6; - } -} diff --git a/minecraft_server/betterterrain/biome/layer/RiverLayer.java b/minecraft_server/betterterrain/biome/layer/RiverLayer.java deleted file mode 100644 index 31f7d2a..0000000 --- a/minecraft_server/betterterrain/biome/layer/RiverLayer.java +++ /dev/null @@ -1,74 +0,0 @@ -package betterterrain.biome.layer; - -import betterterrain.biome.BiomeConfiguration; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; - -public class RiverLayer extends BTALayer -{ - private GenLayer biomePatternGeneratorChain; - private GenLayer riverPatternGeneratorChain; - - private WorldConfigurationInfo generatorInfo; - - public RiverLayer(long par1, GenLayer par3GenLayer, GenLayer par4GenLayer, WorldConfigurationInfo generatorInfo) - { - super(par1); - this.biomePatternGeneratorChain = par3GenLayer; - this.riverPatternGeneratorChain = par4GenLayer; - this.generatorInfo = generatorInfo; - } - - /** - * Initialize layer's local worldGenSeed based on its own baseSeed and the world's global seed (passed in as an - * argument). - */ - public void initWorldGenSeed(long par1) - { - this.biomePatternGeneratorChain.initWorldGenSeed(par1); - this.riverPatternGeneratorChain.initWorldGenSeed(par1); - super.initWorldGenSeed(par1); - } - - /** - * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall - * amounts, or biomeList[] indices based on the particular GenLayer subclass. - */ - public int[] getInts(int par1, int par2, int par3, int par4) - { - int[] var5 = this.biomePatternGeneratorChain.getInts(par1, par2, par3, par4); - int[] var6 = this.riverPatternGeneratorChain.getInts(par1, par2, par3, par4); - int[] var7 = IntCache.getIntCache(par3 * par4); - - for (int var8 = 0; var8 < par3 * par4; ++var8) - { - if (var5[var8] == BiomeGenBase.ocean.biomeID) - { - var7[var8] = var5[var8]; - } - else if (var6[var8] >= 0) - { - if (BiomeConfiguration.getRiverVariantForBiomes(var5[var8], generatorInfo, this) != var5[var8]) - { - var7[var8] = BiomeConfiguration.getRiverVariantForBiomes(var5[var8], generatorInfo, this); - } - else if (var5[var8] != BiomeGenBase.mushroomIsland.biomeID && var5[var8] != BiomeGenBase.mushroomIslandShore.biomeID) - { - var7[var8] = var6[var8]; - } - else - { - var7[var8] = BiomeGenBase.mushroomIslandShore.biomeID; - } - } - else - { - var7[var8] = var5[var8]; - } - } - - return var7; - } -} diff --git a/minecraft_server/betterterrain/biome/layer/ShoreLayer.java b/minecraft_server/betterterrain/biome/layer/ShoreLayer.java deleted file mode 100644 index d324d67..0000000 --- a/minecraft_server/betterterrain/biome/layer/ShoreLayer.java +++ /dev/null @@ -1,117 +0,0 @@ -package betterterrain.biome.layer; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; - -public class ShoreLayer extends BTALayer -{ - private WorldConfigurationInfo generatorInfo; - private int passNum; - - public ShoreLayer(long par1, GenLayer parent, WorldConfigurationInfo generatorInfo, int pass) - { - super(par1); - this.parent = parent; - this.generatorInfo = generatorInfo; - this.passNum = pass; - } - - /** - * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall - * amounts, or biomeList[] indices based on the particular GenLayer subclass. - */ - public int[] getInts(int xOffset, int zOffset, int xSize, int zSize) - { - int[] parentInts = this.parent.getInts(xOffset - 1, zOffset - 1, xSize + 2, zSize + 2); - int[] intCache = IntCache.getIntCache(xSize * zSize); - - for (int i = 0; i < zSize; ++i) - { - for (int j = 0; j < xSize; ++j) - { - this.initChunkSeed((long)(j + xOffset), (long)(i + zOffset)); - int currentBiome = parentInts[j + 1 + (i + 1) * (xSize + 2)]; - int neighbor1; - int neighbor2; - int neighbor3; - int neighbor4; - - if (currentBiome == BiomeGenBase.mushroomIsland.biomeID) - { - neighbor1 = parentInts[j + 1 + (i + 1 - 1) * (xSize + 2)]; - neighbor2 = parentInts[j + 1 + 1 + (i + 1) * (xSize + 2)]; - neighbor3 = parentInts[j + 1 - 1 + (i + 1) * (xSize + 2)]; - neighbor4 = parentInts[j + 1 + (i + 1 + 1) * (xSize + 2)]; - - if (neighbor1 != BiomeGenBase.ocean.biomeID && neighbor2 != BiomeGenBase.ocean.biomeID && neighbor3 != BiomeGenBase.ocean.biomeID && neighbor4 != BiomeGenBase.ocean.biomeID) - { - intCache[j + i * xSize] = currentBiome; - } - else - { - intCache[j + i * xSize] = BiomeGenBase.mushroomIslandShore.biomeID; - } - } - else if (currentBiome != BiomeGenBase.ocean.biomeID && BiomeConfiguration.getEdgeVariantForBiomes(currentBiome, this.generatorInfo, this) == currentBiome) - { - neighbor1 = parentInts[j + 1 + (i + 1 - 1) * (xSize + 2)]; - neighbor2 = parentInts[j + 1 + 1 + (i + 1) * (xSize + 2)]; - neighbor3 = parentInts[j + 1 - 1 + (i + 1) * (xSize + 2)]; - neighbor4 = parentInts[j + 1 + (i + 1 + 1) * (xSize + 2)]; - - if (neighbor1 != BiomeGenBase.ocean.biomeID && neighbor2 != BiomeGenBase.ocean.biomeID && neighbor3 != BiomeGenBase.ocean.biomeID && neighbor4 != BiomeGenBase.ocean.biomeID) - { - intCache[j + i * xSize] = currentBiome; - } - else - { - if (BiomeConfiguration.getBeachVariantForBiomes(currentBiome, generatorInfo, this) != currentBiome || (BiomeGenBase.biomeList[currentBiome] instanceof BTABiome && ((BTABiome) BiomeGenBase.biomeList[currentBiome]).isBeach())) { - intCache[j + i * xSize] = BiomeConfiguration.getBeachVariantForBiomes(currentBiome, generatorInfo, this); - } - else if (BiomeConfiguration.shouldBiomeSpawnBeach(currentBiome, this.generatorInfo, this)){ - intCache[j + i * xSize] = BiomeGenBase.beach.biomeID; - } - else { - intCache[j + i * xSize] = currentBiome; - } - } - } - else - { - neighbor1 = parentInts[j + 1 + (i + 1 - 1) * (xSize + 2)]; - neighbor2 = parentInts[j + 1 + 1 + (i + 1) * (xSize + 2)]; - neighbor3 = parentInts[j + 1 - 1 + (i + 1) * (xSize + 2)]; - neighbor4 = parentInts[j + 1 + (i + 1 + 1) * (xSize + 2)]; - - //If all surrounding biomes are the same as the current biome do not form an edge - if (neighbor1 == currentBiome && neighbor2 == currentBiome && neighbor3 == currentBiome && neighbor4 == currentBiome) { - intCache[j + i * xSize] = currentBiome; - } - //If an edge can be formed with any of the adjacent biomes - else if ((BiomeConfiguration.shouldBiomeConnectWithEdge(neighbor1, this.generatorInfo, this)) || - (BiomeConfiguration.shouldBiomeConnectWithEdge(neighbor2, this.generatorInfo, this)) || - (BiomeConfiguration.shouldBiomeConnectWithEdge(neighbor3, this.generatorInfo, this)) || - (BiomeConfiguration.shouldBiomeConnectWithEdge(neighbor4, this.generatorInfo, this))) - { - //If current biome is a biome that forms edges - if (BiomeConfiguration.getEdgeVariantForBiomes(currentBiome, this.generatorInfo, this) != currentBiome) { - intCache[j + i * xSize] = BiomeConfiguration.getEdgeVariantForBiomes(currentBiome, this.generatorInfo, this); - } - else { - intCache[j + i * xSize] = currentBiome; - } - } - else { - intCache[j + i * xSize] = currentBiome; - } - } - } - } - - return intCache; - } -} diff --git a/minecraft_server/betterterrain/biome/layer/SporadicLayer.java b/minecraft_server/betterterrain/biome/layer/SporadicLayer.java deleted file mode 100644 index 7c99f75..0000000 --- a/minecraft_server/betterterrain/biome/layer/SporadicLayer.java +++ /dev/null @@ -1,43 +0,0 @@ -package betterterrain.biome.layer; - -import betterterrain.BTAVersion; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; - -public class SporadicLayer extends GenLayer -{ - private WorldConfigurationInfo generatorInfo; - - public SporadicLayer(long baseSeed, GenLayer parent, WorldConfigurationInfo generatorInfo) { - super(baseSeed); - this.parent = parent; - this.generatorInfo = generatorInfo; - } - - /** - * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall - * amounts, or biomeList[] indices based on the particular GenLayer subclass. - */ - public int[] getInts(int xOffset, int zOffset, int xSize, int zSize) { - int[] parentInts = this.parent.getInts(xOffset - 1, zOffset - 1, xSize + 2, zSize + 2); - int[] cache = IntCache.getIntCache(xSize * zSize); - - for (int i = 0; i < zSize; ++i) { - for (int k = 0; k < xSize; ++k) { - this.initChunkSeed((long)(k + xOffset), (long)(i + zOffset)); - int currentBiome = parentInts[k + 1 + (i + 1) * (xSize + 2)]; - - if (BiomeConfiguration.getSporadicVariantForBiomes(currentBiome, generatorInfo, this) != currentBiome && this.nextInt(BiomeConfiguration.getSporadicChanceForBiomes(currentBiome, generatorInfo, this)) == 0 && generatorInfo.getBTAVersion().isVersionAtLeast(BTAVersion.V1_3_0)) { - cache[k + i * xSize] = BiomeConfiguration.getSporadicVariantForBiomes(currentBiome, generatorInfo, this); - } - else { - cache[k + i * xSize] = currentBiome; - } - } - } - - return cache; - } -} diff --git a/minecraft_server/betterterrain/block/BTABlockClay.java b/minecraft_server/betterterrain/block/BTABlockClay.java deleted file mode 100644 index be6cba0..0000000 --- a/minecraft_server/betterterrain/block/BTABlockClay.java +++ /dev/null @@ -1,78 +0,0 @@ -package betterterrain.block; - -import java.util.List; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.CreativeTabs; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.FCBlockClay; -import net.minecraft.src.IBlockAccess; -import net.minecraft.src.Icon; -import net.minecraft.src.ItemStack; -import net.minecraft.src.World; - -public class BTABlockClay extends FCBlockClay { - public BTABlockClay(int id) { - super(id); - } - - /** - * Drops the block items with a specified chance of dropping the specified items - */ - public void dropBlockAsItemWithChance(World var1, int var2, int var3, int var4, int var5, float var6, int var7) - { - if (!var1.isRemote) - { - this.dropBlockAsItem_do(var1, var2, var3, var4, new ItemStack(this.idDropped(var5, var1.rand, var7), 1, this.damageDropped(var5))); - - if (var5 == 1) { - this.DropItemsIndividualy(var1, var2, var3, var4, FCBetterThanWolves.fcItemPileSand.itemID, 6, 0, var6); - } - else if (var5 == 2 && DecoIntegration.isDecoInstalled()) { - this.DropItemsIndividualy(var1, var2, var3, var4, DecoIntegration.pileRedSand.itemID, 6, 0, var6); - } - else { - this.DropItemsIndividualy(var1, var2, var3, var4, FCBetterThanWolves.fcItemPileDirt.itemID, 6, 0, var6); - } - } - } - - public boolean DropComponentItemsOnBadBreak(World var1, int var2, int var3, int var4, int var5, float var6) - { - this.DropItemsIndividualy(var1, var2, var3, var4, FCBetterThanWolves.fcItemPileClay.itemID, 1, 0, var6); - - if (var5 == 1) { - this.DropItemsIndividualy(var1, var2, var3, var4, FCBetterThanWolves.fcItemPileSand.itemID, 4, 0, var6); - } - else if (var5 == 2 && DecoIntegration.isDecoInstalled()) { - this.DropItemsIndividualy(var1, var2, var3, var4, DecoIntegration.pileRedSand.itemID, 4, 0, var6); - } - else { - this.DropItemsIndividualy(var1, var2, var3, var4, FCBetterThanWolves.fcItemPileDirt.itemID, 4, 0, var6); - } - return true; - } - - public float GetMovementModifier(World var1, int var2, int var3, int var4) - { - int meta = var1.getBlockMetadata(var2, var3, var4); - - return (meta == 1 || meta == 2) ? 0.8F : 1.0F; - } - - public boolean CanReedsGrowOnBlock(World var1, int var2, int var3, int var4) - { - return var1.getBlockMetadata(var2, var3, var4) == 3; - } - - public boolean CanSaplingsGrowOnBlock(World var1, int var2, int var3, int var4) - { - return var1.getBlockMetadata(var2, var3, var4) == 3; - } - - public boolean CanWildVegetationGrowOnBlock(World var1, int var2, int var3, int var4) - { - return var1.getBlockMetadata(var2, var3, var4) == 3; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/block/BTABlockSoulSand.java b/minecraft_server/betterterrain/block/BTABlockSoulSand.java deleted file mode 100644 index fb622d5..0000000 --- a/minecraft_server/betterterrain/block/BTABlockSoulSand.java +++ /dev/null @@ -1,9 +0,0 @@ -package betterterrain.block; - -import net.minecraft.src.FCBlockSoulSand; - -public class BTABlockSoulSand extends FCBlockSoulSand { - public BTABlockSoulSand(int id) { - super(id); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/feature/plant/DecoFlowerGen.java b/minecraft_server/betterterrain/feature/plant/DecoFlowerGen.java deleted file mode 100644 index 337c065..0000000 --- a/minecraft_server/betterterrain/feature/plant/DecoFlowerGen.java +++ /dev/null @@ -1,73 +0,0 @@ -package betterterrain.feature.plant; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class DecoFlowerGen extends WorldGenerator -{ - /** The ID of the plant block used in this plant generator. */ - private int plantBlockId; - private int plantMetadata; - - public DecoFlowerGen() - { - plantBlockId = -1; - plantMetadata = -1; - } - - public DecoFlowerGen(int blockID) - { - this.plantBlockId = blockID; - plantMetadata = 0; - } - - public DecoFlowerGen(int blockID, int metadata) - { - this.plantBlockId = blockID; - plantMetadata = metadata; - } - - public boolean generate(World par1World, Random rand, int par3, int par4, int par5) - { - int plantID = plantBlockId; - - if (plantBlockId == -1) { - int i = rand.nextInt(23); - - if (i < 16) { - plantID = DecoIntegration.flower.blockID; - plantMetadata = i; - } - else if (i < 18) { - plantID = DecoIntegration.flower2.blockID; - plantMetadata = i - 16; - } - else { - plantID = DecoIntegration.tulip.blockID; - plantMetadata = i - 18; - } - } - - for (int var6 = 0; var6 < 64; ++var6) - { - int var7 = par3 + rand.nextInt(8) - rand.nextInt(8); - int var8 = par4 + rand.nextInt(4) - rand.nextInt(4); - int var9 = par5 + rand.nextInt(8) - rand.nextInt(8); - - if (par1World.isAirBlock(var7, var8, var9) && (!par1World.provider.hasNoSky || var8 < 127) && Block.blocksList[plantID].CanBlockStayDuringGenerate(par1World, var7, var8, var9)) - { - par1World.setBlock(var7, var8, var9, plantID, this.plantMetadata, 2); - - if (par1World.getBiomeGenForCoords(var7, var9).getEnableSnow() && par1World.isAirBlock(var7, var8 + 1, var9) && par1World.canBlockSeeTheSky(var7, var8, var9)) { - par1World.setBlock(var7, var8 + 1, var9, Block.snow.blockID); - } - } - } - - return true; - } -} diff --git a/minecraft_server/betterterrain/feature/plant/MelonGen.java b/minecraft_server/betterterrain/feature/plant/MelonGen.java deleted file mode 100644 index a45cd17..0000000 --- a/minecraft_server/betterterrain/feature/plant/MelonGen.java +++ /dev/null @@ -1,48 +0,0 @@ -package betterterrain.feature.plant; - -import java.util.ArrayList; -import java.util.Random; - -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class MelonGen extends WorldGenerator { - private static ArrayList validBiomeList = new ArrayList(); - - public static boolean isBiomeValid(BiomeGenBase biome) { - return validBiomeList.contains(biome); - } - - public static void addBiomeToGenerator(BiomeGenBase biome) { - validBiomeList.add(biome); - } - - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - boolean var6 = isBiomeValid(par1World.getBiomeGenForCoords(par3, par5)); - int var7 = 0; - - for (int var9 = 0; var9 < 64; ++var9) - { - int var10 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8); - int var11 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4); - int var12 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8); - - if (par1World.isAirBlock(var10, var11, var12) && par1World.getBlockId(var10, var11 - 1, var12) == Block.grass.blockID && Block.pumpkin.canPlaceBlockAt(par1World, var10, var11, var12)) - { - int var13 = par2Random.nextInt(4); - - if (var6 && var7 < 3) - { - par1World.setBlock(var10, var11, var12, Block.melon.blockID, var13, 2); - - ++var7; - } - } - } - - return true; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/feature/plant/MyceliumGen.java b/minecraft_server/betterterrain/feature/plant/MyceliumGen.java deleted file mode 100644 index d94d6f8..0000000 --- a/minecraft_server/betterterrain/feature/plant/MyceliumGen.java +++ /dev/null @@ -1,90 +0,0 @@ -package betterterrain.feature.plant; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.MathHelper; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class MyceliumGen extends WorldGenerator -{ - /** The block ID of the ore to be placed using this generator. */ - private int minableBlockId; - - /** The block ID of the ore to be placed using this generator. */ - private int replaceBlockId; - - /** The number of blocks to generate. */ - private int numberOfBlocks; - - public MyceliumGen(int par1, int par2) - { - minableBlockId = par1; - numberOfBlocks = par2; - this.replaceBlockId = Block.grass.blockID; - } - - public MyceliumGen(int par1, int par2, int replaceBlockId) - { - minableBlockId = par1; - numberOfBlocks = par2; - this.replaceBlockId = replaceBlockId; - } - - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - float var6 = par2Random.nextFloat() * (float)Math.PI; - double var7 = par3 + 8 + MathHelper.sin(var6) * numberOfBlocks / 8.0F; - double var9 = par3 + 8 - MathHelper.sin(var6) * numberOfBlocks / 8.0F; - double var11 = par5 + 8 + MathHelper.cos(var6) * numberOfBlocks / 8.0F; - double var13 = par5 + 8 - MathHelper.cos(var6) * numberOfBlocks / 8.0F; - double var15 = par4 + par2Random.nextInt(3) - 2; - double var17 = par4 + par2Random.nextInt(3) - 2; - - for (int var19 = 0; var19 <= numberOfBlocks; ++var19) - { - double var20 = var7 + (var9 - var7) * var19 / numberOfBlocks; - double var22 = var15 + (var17 - var15) * var19 / numberOfBlocks; - double var24 = var11 + (var13 - var11) * var19 / numberOfBlocks; - double var26 = par2Random.nextDouble() * numberOfBlocks / 16.0D; - double var28 = (MathHelper.sin(var19 * (float)Math.PI / numberOfBlocks) + 1.0F) * var26 + 1.0D; - double var30 = (MathHelper.sin(var19 * (float)Math.PI / numberOfBlocks) + 1.0F) * var26 + 1.0D; - int var32 = MathHelper.floor_double(var20 - var28 / 2.0D); - int var33 = MathHelper.floor_double(var22 - var30 / 2.0D); - int var34 = MathHelper.floor_double(var24 - var28 / 2.0D); - int var35 = MathHelper.floor_double(var20 + var28 / 2.0D); - int var36 = MathHelper.floor_double(var22 + var30 / 2.0D); - int var37 = MathHelper.floor_double(var24 + var28 / 2.0D); - - for (int var38 = var32; var38 <= var35; ++var38) - { - double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D); - - if (var39 * var39 < 1.0D) - { - for (int var41 = var33; var41 <= var36; ++var41) - { - double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D); - - if (var39 * var39 + var42 * var42 < 1.0D) - { - for (int var44 = var34; var44 <= var37; ++var44) - { - double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D); - - if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && par1World.getBlockId(var38, var41, var44) == replaceBlockId) - { - par1World.setBlock(var38, var41, var44, minableBlockId, 0, 2); - } - } - } - } - } - } - } - - return true; - } -} diff --git a/minecraft_server/betterterrain/feature/terrain/BasaltPillarGen.java b/minecraft_server/betterterrain/feature/terrain/BasaltPillarGen.java deleted file mode 100644 index 4bc2487..0000000 --- a/minecraft_server/betterterrain/feature/terrain/BasaltPillarGen.java +++ /dev/null @@ -1,50 +0,0 @@ -package betterterrain.feature.terrain; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class BasaltPillarGen extends WorldGenerator { - - public BasaltPillarGen() { - - } - - @Override - public boolean generate(World world, Random rand, int x, int y, int z) { - int radius = 4; - int id = DecoIntegration.isDecoInstalled() ? DecoIntegration.basalt.blockID : Block.stone.blockID; - - int j = y; - - while (world.getBlockId(x, j, z) == 0) { - world.setBlock(x, j, z, id); - - j++; - } - - j = y - 1; - - while (world.getBlockId(x, j, z) == 0) { - world.setBlock(x, j, z, id); - - j--; - } - - j++; - - for (int i = -radius; i <= radius; i++) { - for (int k = -radius; k <= radius; k++) { - if (i * i + k * k <= radius * radius && world.getBlockId(x + i, j, z + k) == 0 && world.getBlockId(x + i, j - 1, z + k) != 0) { - world.setBlock(x + i, j, z + k, id); - } - } - } - - return true; - } - -} diff --git a/minecraft_server/betterterrain/feature/terrain/GlowstoneGen.java b/minecraft_server/betterterrain/feature/terrain/GlowstoneGen.java deleted file mode 100644 index 5f6a606..0000000 --- a/minecraft_server/betterterrain/feature/terrain/GlowstoneGen.java +++ /dev/null @@ -1,55 +0,0 @@ -package betterterrain.feature.terrain; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.FCUtilsBlockPos; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class GlowstoneGen extends WorldGenerator -{ - public boolean generate(World world, Random rand, int x, int y, int z) { - if (!world.isAirBlock(x, y, z)) { - return false; - } - else if (!canGlowsotneGrowFromBlock(world.getBlockId(x, y + 1, z))) { - return false; - } - else { - world.setBlock(x, y, z, Block.glowStone.blockID, 0, 2); - - for (int iter = 0; iter < 1500; ++iter) { - int i = x + rand.nextInt(8) - rand.nextInt(8); - int j = y - rand.nextInt(12); - int k = z + rand.nextInt(8) - rand.nextInt(8); - - if (world.getBlockId(i, j, k) == 0) { - int adjacentGlowstoneCount = 0; - - for (int dir = 0; dir < 6; ++dir) { - int adjacentID = 0; - - FCUtilsBlockPos pos = new FCUtilsBlockPos(i, j, k, dir); - adjacentID = world.getBlockId(pos.i, pos.j, pos.k); - - if (adjacentID == Block.glowStone.blockID) { - adjacentGlowstoneCount++; - } - } - - if (adjacentGlowstoneCount == 1) { - world.setBlock(i, j, k, Block.glowStone.blockID, 0, 2); - } - } - } - - return true; - } - } - - private boolean canGlowsotneGrowFromBlock(int blockID) { - return blockID == Block.netherrack.blockID || (DecoIntegration.isDecoInstalled() && blockID == DecoIntegration.basalt.blockID || blockID == Block.blockNetherQuartz.blockID); - } -} diff --git a/minecraft_server/betterterrain/feature/terrain/NetherLavaGen.java b/minecraft_server/betterterrain/feature/terrain/NetherLavaGen.java deleted file mode 100644 index ffc6531..0000000 --- a/minecraft_server/betterterrain/feature/terrain/NetherLavaGen.java +++ /dev/null @@ -1,84 +0,0 @@ -package betterterrain.feature.terrain; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class NetherLavaGen extends WorldGenerator { - private boolean isOpenToAir; - - public NetherLavaGen(boolean isOpenToAir) { - this.isOpenToAir = isOpenToAir; - } - - public boolean generate(World world, Random rand, int x, int y, int z) - { - if (!this.isBlockValidForReplacement(world.getBlockId(x, y + 1, z))) { - return false; - } - else if (world.getBlockId(x, y, z) != 0 && !this.isBlockValidForReplacement(world.getBlockId(x, y, z))) { - return false; - } - else { - int solidBlockCount = 0; - - if (world.getBlockId(x - 1, y, z) != 0) { - solidBlockCount++; - } - - if (world.getBlockId(x + 1, y, z) != 0) { - solidBlockCount++; - } - - if (world.getBlockId(x, y, z - 1) != 0) { - solidBlockCount++; - } - - if (world.getBlockId(x, y, z + 1) != 0) { - solidBlockCount++; - } - - if (world.getBlockId(x, y - 1, z) != 0) { - solidBlockCount++; - } - - int airCount = 0; - - if (world.isAirBlock(x - 1, y, z)) { - airCount++; - } - - if (world.isAirBlock(x + 1, y, z)) { - airCount++; - } - - if (world.isAirBlock(x, y, z - 1)) { - airCount++; - } - - if (world.isAirBlock(x, y, z + 1)) { - airCount++; - } - - if (world.isAirBlock(x, y - 1, z)) { - airCount++; - } - - if (!this.isOpenToAir && solidBlockCount == 4 && airCount == 1 || solidBlockCount == 5) { - world.setBlock(x, y, z, Block.lavaMoving.blockID, 0, 2); - world.scheduledUpdatesAreImmediate = true; - Block.blocksList[Block.lavaMoving.blockID].updateTick(world, x, y, z, rand); - world.scheduledUpdatesAreImmediate = false; - } - - return true; - } - } - - private boolean isBlockValidForReplacement(int blockID) { - return blockID == Block.netherrack.blockID || (DecoIntegration.isDecoInstalled() && blockID == DecoIntegration.basalt.blockID) || blockID == Block.blockNetherQuartz.blockID; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/feature/terrain/OasisGen.java b/minecraft_server/betterterrain/feature/terrain/OasisGen.java deleted file mode 100644 index dac5e5c..0000000 --- a/minecraft_server/betterterrain/feature/terrain/OasisGen.java +++ /dev/null @@ -1,64 +0,0 @@ -package betterterrain.feature.terrain; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.Material; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class OasisGen extends WorldGenerator -{ - /** Stores ID for WorldGenSand */ - private int sandID; - - /** The maximum radius used when generating a patch of blocks. */ - private int radius; - - public OasisGen(int par1, int par2) - { - sandID = par2; - radius = par1; - } - - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - if (par1World.getBlockMaterial(par3, par4, par5) != Material.water) - return false; - else - { - int var6 = par2Random.nextInt(radius - 2) + 2; - byte var7 = 2; - - for (int var8 = par3 - var6; var8 <= par3 + var6; ++var8) - { - for (int var9 = par5 - var6; var9 <= par5 + var6; ++var9) - { - int var10 = var8 - par3; - int var11 = var9 - par5; - - if (var10 * var10 + var11 * var11 <= var6 * var6) - { - for (int var12 = par4 - var7; var12 <= par4 + var7; ++var12) - { - int var13 = par1World.getBlockId(var8, var12, var9); - - if (var13 == Block.sand.blockID) - { - if (sandID == Block.grass.blockID && par1World.getBlockId(var8, var12 + 1, var9) != 0) { - par1World.setBlock(var8, var12, var9, Block.dirt.blockID); - } - else { - par1World.setBlock(var8, var12, var9, sandID); - } - } - } - } - } - } - - return true; - } - } -} diff --git a/minecraft_server/betterterrain/feature/terrain/ShieldGen.java b/minecraft_server/betterterrain/feature/terrain/ShieldGen.java deleted file mode 100644 index 839b6a5..0000000 --- a/minecraft_server/betterterrain/feature/terrain/ShieldGen.java +++ /dev/null @@ -1,92 +0,0 @@ -package betterterrain.feature.terrain; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.MathHelper; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class ShieldGen extends WorldGenerator -{ - /** The block ID of the ore to be placed using this generator. */ - private int minableBlockId; - private int meta; - - /** The number of blocks to generate. */ - private int numberOfBlocks; - - private int replaceID; - - public ShieldGen(int par1, int par2) - { - minableBlockId = par1; - numberOfBlocks = par2; - this.meta = 0; - this.replaceID = Block.grass.blockID; - } - - public ShieldGen(int id, int meta, int numBlocks, int replaceID) - { - minableBlockId = id; - numberOfBlocks = numBlocks; - this.meta = meta; - this.replaceID = replaceID; - } - - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - float var6 = par2Random.nextFloat() * (float)Math.PI; - double var7 = par3 + 8 + MathHelper.sin(var6) * numberOfBlocks / 8.0F; - double var9 = par3 + 8 - MathHelper.sin(var6) * numberOfBlocks / 8.0F; - double var11 = par5 + 8 + MathHelper.cos(var6) * numberOfBlocks / 8.0F; - double var13 = par5 + 8 - MathHelper.cos(var6) * numberOfBlocks / 8.0F; - double var15 = par4 + par2Random.nextInt(3) - 2; - double var17 = par4 + par2Random.nextInt(3) - 2; - - for (int var19 = 0; var19 <= numberOfBlocks; ++var19) - { - double var20 = var7 + (var9 - var7) * var19 / numberOfBlocks; - double var22 = var15 + (var17 - var15) * var19 / numberOfBlocks; - double var24 = var11 + (var13 - var11) * var19 / numberOfBlocks; - double var26 = par2Random.nextDouble() * numberOfBlocks / 16.0D; - double var28 = (MathHelper.sin(var19 * (float)Math.PI / numberOfBlocks) + 1.0F) * var26 + 1.0D; - double var30 = (MathHelper.sin(var19 * (float)Math.PI / numberOfBlocks) + 1.0F) * var26 + 1.0D; - int var32 = MathHelper.floor_double(var20 - var28 / 2.0D); - int var33 = MathHelper.floor_double(var22 - var30 / 2.0D); - int var34 = MathHelper.floor_double(var24 - var28 / 2.0D); - int var35 = MathHelper.floor_double(var20 + var28 / 2.0D); - int var36 = MathHelper.floor_double(var22 + var30 / 2.0D); - int var37 = MathHelper.floor_double(var24 + var28 / 2.0D); - - for (int var38 = var32; var38 <= var35; ++var38) - { - double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D); - - if (var39 * var39 < 1.0D) - { - for (int var41 = var33; var41 <= var36; ++var41) - { - double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D); - - if (var39 * var39 + var42 * var42 < 1.0D) - { - for (int var44 = var34; var44 <= var37; ++var44) - { - double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D); - - if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && par1World.getBlockId(var38, var41, var44) == this.replaceID || (this.replaceID == Block.grass.blockID && par1World.getBlockId(var38, var41, var44) == Block.dirt.blockID)) - { - par1World.setBlockAndMetadata(var38, var41, var44, this.minableBlockId, this.meta); - } - } - } - } - } - } - } - - return true; - } -} diff --git a/minecraft_server/betterterrain/feature/terrain/SkyClayGen.java b/minecraft_server/betterterrain/feature/terrain/SkyClayGen.java deleted file mode 100644 index e906a75..0000000 --- a/minecraft_server/betterterrain/feature/terrain/SkyClayGen.java +++ /dev/null @@ -1,60 +0,0 @@ -package betterterrain.feature.terrain; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class SkyClayGen extends WorldGenerator { - /** The block ID for clay. */ - private int clayBlockId; - - /** The number of blocks to generate. */ - private int numberOfBlocks; - - public SkyClayGen(int par1) - { - this.clayBlockId = Block.blockClay.blockID; - this.numberOfBlocks = par1; - } - - public boolean generate(World world, Random rand, int x, int y, int z) - { - if (world.getBlockId(x, y - 1, z) == Block.grass.blockID) - { - int radius = rand.nextInt(this.numberOfBlocks - 2) + 2; - byte heightCheck = 1; - - for (int i = x - radius; i <= x + radius; ++i) - { - for (int k = z - radius; k <= z + radius; ++k) - { - int localX = i - x; - int localZ = k - z; - - if (localX * localX + localZ * localZ <= radius * radius) - { - for (int j = y - heightCheck; j <= y + heightCheck; ++j) - { - int var13 = world.getBlockId(i, j, k); - - if (var13 == Block.dirt.blockID || var13 == Block.blockClay.blockID) - { - world.setBlock(i, j, k, this.clayBlockId, 0, 2); - } - else if (var13 == Block.grass.blockID) - { - world.setBlock(i, j, k, this.clayBlockId, 3, 2); - } - } - } - } - } - - return true; - } - - return false; - } -} diff --git a/minecraft_server/betterterrain/feature/terrain/SteppeGen.java b/minecraft_server/betterterrain/feature/terrain/SteppeGen.java deleted file mode 100644 index 3b06ddc..0000000 --- a/minecraft_server/betterterrain/feature/terrain/SteppeGen.java +++ /dev/null @@ -1,46 +0,0 @@ -package betterterrain.feature.terrain; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class SteppeGen extends WorldGenerator -{ - /** Stores ID for WorldGenTallGrass */ - private int tallGrassID; - private int tallGrassMetadata; - - public SteppeGen(int par1, int par2) - { - tallGrassID = par1; - tallGrassMetadata = par2; - } - - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - int var11; - - for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4) - { - ; - } - - for (int var7 = 0; var7 < 128; ++var7) - { - int var8 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8); - int var9 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4); - int var10 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8); - - if (par1World.isAirBlock(var8, var9, var10) && par1World.getBlockId(var8, var9 - 1, var10) == Block.grass.blockID) - { - par1World.setBlock(var8, var9 - 1, var10, Block.sand.blockID); - par1World.setBlock(var8, var9, var10, 0); - } - } - - return true; - } -} diff --git a/minecraft_server/betterterrain/feature/tree/LogGen.java b/minecraft_server/betterterrain/feature/tree/LogGen.java deleted file mode 100644 index 39b6c0b..0000000 --- a/minecraft_server/betterterrain/feature/tree/LogGen.java +++ /dev/null @@ -1,110 +0,0 @@ -package betterterrain.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class LogGen extends WorldGenerator -{ - /* - @Override - public boolean generate(World var1, Random var2, int var3, int var4, int var5) - { - while (var1.isAirBlock(var3, var4, var5) && var4 > 2) - { - --var4; - } - - int var6 = var1.getBlockId(var3, var4, var5); - int var61 = var1.getBlockId(var3 - 1, var4, var5); - int var62 = var1.getBlockId(var3 + 1, var4, var5); - int var63 = var1.getBlockId(var3 - 2, var4, var5); - int var64 = var1.getBlockId(var3 + 2, var4, var5); - - if (var6 == Block.grass.blockID) - { - if (var61 == Block.grass.blockID) - { - if (var62 == Block.grass.blockID) - { - if (var63 == Block.grass.blockID) - { - if (var64 == Block.grass.blockID) - { - for (int var7 = -2; var7 <= 2; ++var7) - { - for (int var8 = -2; var8 <= 2; ++var8) - { - if (!var1.isAirBlock(var3, var4 + 1, var5 + var8) && !var1.isAirBlock(var3 - 1, var4 + 1, var5 + var8) && !var1.isAirBlock(var3 + 1, var4 + 1, var5 + var8)) - return false; - } - } - - var1.setBlock(var3, var4 + 1, var5, Block.wood.blockID, 4, 2); - var1.setBlock(var3 - 1, var4 + 1, var5, Block.wood.blockID, 4, 2); - var1.setBlock(var3 + 1, var4 + 1, var5, Block.wood.blockID, 4, 2); - return true; - } else - return false; - } else - return false; - } else - return false; - } else - return false; - } else - return false; - } - */ - - @Override - public boolean generate(World world, Random rand, int x, int y, int z) { - boolean isEW = rand.nextBoolean(); - - while (world.isAirBlock(x, y, z) && y > 2) - { - y--; - } - - if (isEW) { - for (int i = -2; i <= 2; i++) { - if (world.getBlockId(x + i, y, z) != Block.grass.blockID) - return false; - } - - for (int i = -1; i <= 1; i++) { - world.setBlock(x + i, y + 1, z, Block.wood.blockID, 4, 2); - } - - if (rand.nextBoolean()) { - world.setBlock(x - 2, y + 1, z, Block.wood.blockID, 12, 2); - } - else { - world.setBlock(x + 2, y + 1, z, Block.wood.blockID, 12, 2); - } - - return true; - } - else { - for (int i = -2; i <= 2; i++) { - if (world.getBlockId(x, y, z + i) != Block.grass.blockID) - return false; - } - - for (int i = -1; i <= 1; i++) { - world.setBlock(x, y + 1, z + i, Block.wood.blockID, 8, 2); - } - - if (rand.nextBoolean()) { - world.setBlock(x, y + 1, z - 2, Block.wood.blockID, 12, 2); - } - else { - world.setBlock(x, y + 1, z + 2, Block.wood.blockID, 12, 2); - } - - return true; - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/feature/tree/PineTreeGen.java b/minecraft_server/betterterrain/feature/tree/PineTreeGen.java deleted file mode 100644 index 4bbfe00..0000000 --- a/minecraft_server/betterterrain/feature/tree/PineTreeGen.java +++ /dev/null @@ -1,182 +0,0 @@ -package betterterrain.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class PineTreeGen extends WorldGenerator -{ - /** The metadata value of the wood to use in tree generation. */ - private final int metaWood; - - /** The metadata value of the leaves to use in tree generation. */ - private final int metaLeaves; - - public PineTreeGen(boolean par1) { - this(par1, 0, 0); - } - - public PineTreeGen(boolean par1, int metaWood, int metaLeaves) { - super(par1); - this.metaWood = metaWood; - this.metaLeaves = metaLeaves; - } - - @Override - public boolean generate(World var1, Random var2, int var3, int var4, int var5) { - while (var1.isAirBlock(var3, var4, var5) && var4 > 2) - { - --var4; - } - - int var6 = var1.getBlockId(var3, var4, var5); - - if (var6 != Block.grass.blockID && var6 != Block.stone.blockID) - return false; - else - { - for (int var7 = -2; var7 <= 2; ++var7) - { - for (int var8 = -2; var8 <= 2; ++var8) - { - if (var1.isAirBlock(var3 + var7, var4 - 1, var5 + var8) && var1.isAirBlock(var3 + var7, var4 - 2, var5 + var8) && !var1.isAirBlock(var3 + var7, var4, var5 + var8)) - return false; - } - } - - int var99 = var2.nextInt(2); - - if (var99 == 0) - { - var1.setBlock(var3, var4, var5, Block.dirt.blockID); - var1.setBlockAndMetadata(var3, var4 + 1, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 2, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 3, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 4, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 5, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 6, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 7, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 8, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 9, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 10, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 11, var5, Block.wood.blockID, metaWood); - var1.setBlockMetadataWithClient(var3, var4 + 1, var5, metaWood | 12); // place stump - - var1.setBlockAndMetadata(var3 + 1, var4 + 6, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 6, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 6, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 6, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 6, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 6, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 6, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 6, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 6, var5 - 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 2, var4 + 6, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 2, var4 + 6, var5 - 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 6, var5 + 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 2, var4 + 6, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 2, var4 + 6, var5 + 2, Block.leaves.blockID, metaLeaves); - - var1.setBlockAndMetadata(var3 + 1, var4 + 8, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 8, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 8, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 8, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 8, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 8, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 8, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 8, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 8, var5 - 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 2, var4 + 8, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 2, var4 + 8, var5 - 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 8, var5 + 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 2, var4 + 8, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 2, var4 + 8, var5 + 2, Block.leaves.blockID, metaLeaves); - - var1.setBlockAndMetadata(var3 + 1, var4 + 10, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 10, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 10, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 10, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 10, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 10, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 10, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 10, var5 - 1, Block.leaves.blockID, metaLeaves); - - var1.setBlockAndMetadata(var3 + 1, var4 + 11, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 11, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 11, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 11, var5 - 1, Block.leaves.blockID, metaLeaves); - - var1.setBlockAndMetadata(var3, var4 + 12, var5, Block.leaves.blockID, metaLeaves); - } - - if (var99 == 1) - { - var1.setBlock(var3, var4, var5, Block.dirt.blockID); - var1.setBlockAndMetadata(var3, var4 + 1, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 2, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 3, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 4, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 5, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 6, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 7, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 8, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 9, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 10, var5, Block.wood.blockID, metaWood); - var1.setBlockAndMetadata(var3, var4 + 11, var5, Block.wood.blockID, metaWood); - var1.setBlockMetadataWithClient(var3, var4 + 1, var5, metaWood | 12); // place stump - - var1.setBlockAndMetadata(var3 + 1, var4 + 6, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 6, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 6, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 6, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 6, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 6, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 6, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 6, var5 - 1, Block.leaves.blockID, metaLeaves); - - var1.setBlockAndMetadata(var3 + 1, var4 + 6, var5 - 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 2, var4 + 6, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 2, var4 + 6, var5 - 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 6, var5 + 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 2, var4 + 6, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 2, var4 + 6, var5 + 2, Block.leaves.blockID, metaLeaves); - - var1.setBlockAndMetadata(var3 + 1, var4 + 8, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 8, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 8, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 8, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 8, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 8, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 8, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 8, var5 - 1, Block.leaves.blockID, metaLeaves); - - var1.setBlockAndMetadata(var3 - 1, var4 + 8, var5 - 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 2, var4 + 8, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 2, var4 + 8, var5 - 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 8, var5 + 2, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 2, var4 + 8, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 2, var4 + 8, var5 + 2, Block.leaves.blockID, metaLeaves); - - var1.setBlockAndMetadata(var3 + 1, var4 + 10, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 10, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 10, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 10, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 10, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 + 1, var4 + 10, var5 - 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 10, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 10, var5 - 1, Block.leaves.blockID, metaLeaves); - - var1.setBlockAndMetadata(var3 + 1, var4 + 11, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3 - 1, var4 + 11, var5, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 11, var5 + 1, Block.leaves.blockID, metaLeaves); - var1.setBlockAndMetadata(var3, var4 + 11, var5 - 1, Block.leaves.blockID, metaLeaves); - - var1.setBlockAndMetadata(var3, var4 + 12, var5, Block.leaves.blockID, metaLeaves); - } - - return true; - } - } -} diff --git a/minecraft_server/betterterrain/feature/tree/SmallShrubGen.java b/minecraft_server/betterterrain/feature/tree/SmallShrubGen.java deleted file mode 100644 index 7d08869..0000000 --- a/minecraft_server/betterterrain/feature/tree/SmallShrubGen.java +++ /dev/null @@ -1,38 +0,0 @@ -package betterterrain.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class SmallShrubGen extends WorldGenerator { - private int woodMeta; - private int leafMeta; - - public SmallShrubGen() { - this(0, 0); - } - - public SmallShrubGen(int woodMeta, int leafMeta) { - this.woodMeta = woodMeta; - this.leafMeta = leafMeta; - } - - @Override - public boolean generate(World world, Random rand, int x, int y, int z) { - if (world.getBlockId(x, y - 1, z) != Block.grass.blockID) - return false; - - world.setBlockAndMetadata(x, y, z, Block.wood.blockID, woodMeta); - world.setBlockAndMetadata(x, y + 1, z, Block.wood.blockID, woodMeta); - - world.setBlockAndMetadata(x + 1, y + 1, z, Block.leaves.blockID, leafMeta); - world.setBlockAndMetadata(x, y + 1, z + 1, Block.leaves.blockID, leafMeta); - world.setBlockAndMetadata(x - 1, y + 1, z, Block.leaves.blockID, leafMeta); - world.setBlockAndMetadata(x, y + 1, z - 1, Block.leaves.blockID, leafMeta); - world.setBlockAndMetadata(x, y + 2, z, Block.leaves.blockID, leafMeta); - - return true; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/feature/tree/TaigaGen6.java b/minecraft_server/betterterrain/feature/tree/TaigaGen6.java deleted file mode 100644 index dd6627d..0000000 --- a/minecraft_server/betterterrain/feature/tree/TaigaGen6.java +++ /dev/null @@ -1,138 +0,0 @@ -package betterterrain.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class TaigaGen6 extends WorldGenerator -{ - public TaigaGen6(boolean par1) - { - super(par1); - } - - @Override - public boolean generate(World par1World, Random par2Random, int x, int y, int z) - { - int var6 = par2Random.nextInt(9) + 13; - int var7 = 4 + par2Random.nextInt(4); - int var8 = var6 - var7; - int var9 = 2; - boolean var10 = true; - - if (y >= 1 && y + var6 + 1 <= 256) - { - int var11; - int var13; - int var15; - int var21; - - for (var11 = y; var11 <= y + 1 + var6 && var10; ++var11) - { - boolean var12 = true; - - if (var11 - y < var7) - { - var21 = 0; - } - else - { - var21 = var9; - } - - for (var13 = x - var21; var13 <= x + var21 && var10; ++var13) - { - for (int var14 = z - var21; var14 <= z + var21 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = par1World.getBlockId(var13, var11, var14); - - if (var15 != 0 && var15 != Block.leaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - return false; - else - { - var11 = par1World.getBlockId(x, y - 1, z); - - if ((var11 == Block.grass.blockID || var11 == Block.dirt.blockID || (DecoIntegration.isDecoInstalled() && (var11 == DecoIntegration.coarseDirt.blockID || var11 == DecoIntegration.podzol.blockID))) && y < 256 - var6 - 1) - { - this.setBlock(par1World, x, y - 1, z, Block.dirt.blockID); - var21 = par2Random.nextInt(2); - var13 = 1; - byte var22 = 0; - int var17; - int var16; - - for (var15 = 0; var15 <= var8; ++var15) - { - var16 = y + var6 - var15; - - for (var17 = x - var21; var17 <= x + var21; ++var17) - { - int var18 = var17 - x; - - for (int var19 = z - var21; var19 <= z + var21; ++var19) - { - int var20 = var19 - z; - - if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var17, var16, var19)]) - { - this.setBlockAndMetadata(par1World, var17, var16, var19, Block.leaves.blockID, 1); - } - } - } - - if (var21 >= var13) - { - var21 = var22; - var22 = 1; - ++var13; - - if (var13 > var9) - { - var13 = var9; - } - } - else - { - ++var21; - } - } - - var15 = par2Random.nextInt(3); - - for (var16 = 0; var16 < var6 - var15; ++var16) - { - var17 = par1World.getBlockId(x, y + var16, z); - - if (var17 == 0 || var17 == Block.leaves.blockID) - { - this.setBlockAndMetadata(par1World, x, y + var16, z, Block.wood.blockID, 1); - } - } - par1World.setBlockMetadataWithClient(x, y, z, 1 | 12); // place stump - - return true; - } else - return false; - } - } else - return false; - } -} diff --git a/minecraft_server/betterterrain/feature/tree/TaigaGen7.java b/minecraft_server/betterterrain/feature/tree/TaigaGen7.java deleted file mode 100644 index 63dff87..0000000 --- a/minecraft_server/betterterrain/feature/tree/TaigaGen7.java +++ /dev/null @@ -1,139 +0,0 @@ -package betterterrain.feature.tree; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class TaigaGen7 extends WorldGenerator -{ - public TaigaGen7(boolean var1) - { - super(var1); - } - - @Override - public boolean generate(World var1, Random var2, int x, int y, int z) - { - int var6 = var2.nextInt(10) + 10; - int var7 = 2; - int var8 = var6 - var7; - int var9 = 2 + var2.nextInt(2); - boolean var10 = true; - - if (y >= 1 && y + var6 + 1 <= 256) - { - int var11; - int var13; - int var15; - int var21; - - for (var11 = y; var11 <= y + 1 + var6 && var10; ++var11) - { - boolean var12 = true; - - if (var11 - y < var7) - { - var21 = 0; - } - else - { - var21 = var9; - } - - for (var13 = x - var21; var13 <= x + var21 && var10; ++var13) - { - for (int var14 = z - var21; var14 <= z + var21 && var10; ++var14) - { - if (var11 >= 0 && var11 < 256) - { - var15 = var1.getBlockId(var13, var11, var14); - - if (var15 != 0 && var15 != Block.leaves.blockID) - { - var10 = false; - } - } - else - { - var10 = false; - } - } - } - } - - if (!var10) - return false; - else - { - var11 = var1.getBlockId(x, y - 1, z); - - if ((var11 == Block.grass.blockID || var11 == Block.dirt.blockID || (DecoIntegration.isDecoInstalled() && (var11 == DecoIntegration.coarseDirt.blockID || var11 == DecoIntegration.podzol.blockID))) && y < 256 - var6 - 1) - { - var1.setBlock(x, y - 1, z, Block.dirt.blockID); - var21 = var2.nextInt(2); - var13 = 1; - boolean var22 = false; - int var17; - int var16; - - for (var15 = 0; var15 <= var8; ++var15) - { - var16 = y + var6 - var15; - - for (var17 = x - var21; var17 <= x + var21; ++var17) - { - int var18 = var17 - x; - - for (int var19 = z - var21; var19 <= z + var21; ++var19) - { - int var20 = var19 - z; - - if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && !Block.opaqueCubeLookup[var1.getBlockId(var17, var16, var19)]) - { - this.setBlockAndMetadata(var1, var17, var16, var19, Block.leaves.blockID, 1); - } - } - } - - if (var21 >= var13) - { - var21 = var22 ? 1 : 0; - var22 = true; - ++var13; - - if (var13 > var9) - { - var13 = var9; - } - } - else - { - ++var21; - } - } - - var15 = var2.nextInt(3); - - for (var16 = 0; var16 < var6 - var15; ++var16) - { - var17 = var1.getBlockId(x, y + var16, z); - - if (var17 == 0 || var17 == Block.leaves.blockID) - { - this.setBlockAndMetadata(var1, x, y + var16, z, Block.wood.blockID, 1); - } - } - - var1.setBlockMetadataWithClient(x, y, z, 1 | 12); // place stump - - return true; - } else - return false; - } - } else - return false; - } -} diff --git a/minecraft_server/betterterrain/feature/tree/TallSwampTreeGen.java b/minecraft_server/betterterrain/feature/tree/TallSwampTreeGen.java deleted file mode 100644 index 88fffbe..0000000 --- a/minecraft_server/betterterrain/feature/tree/TallSwampTreeGen.java +++ /dev/null @@ -1,180 +0,0 @@ -package betterterrain.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.Material; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class TallSwampTreeGen extends WorldGenerator -{ - @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) - { - int var6; - - for (var6 = par2Random.nextInt(6) + 8; par1World.getBlockMaterial(par3, par4 - 1, par5) == Material.water; --par4) - { - ; - } - - boolean var7 = true; - - if (par4 >= 1 && par4 + var6 + 1 <= 128) - { - int var8; - int var10; - int var11; - int var12; - - for (var8 = par4; var8 <= par4 + 1 + var6; ++var8) - { - byte var9 = 1; - - if (var8 == par4) - { - var9 = 0; - } - - if (var8 >= par4 + 1 + var6 - 2) - { - var9 = 3; - } - - for (var10 = par3 - var9; var10 <= par3 + var9 && var7; ++var10) - { - for (var11 = par5 - var9; var11 <= par5 + var9 && var7; ++var11) - { - if (var8 >= 0 && var8 < 128) - { - var12 = par1World.getBlockId(var10, var8, var11); - - if (var12 != 0 && var12 != Block.leaves.blockID) - { - if (var12 != Block.waterStill.blockID && var12 != Block.waterMoving.blockID) - { - var7 = false; - } - else if (var8 > par4) - { - var7 = false; - } - } - } - else - { - var7 = false; - } - } - } - } - - if (!var7) - return false; - else - { - var8 = par1World.getBlockId(par3, par4 - 1, par5); - - if ((var8 == Block.grass.blockID || var8 == Block.dirt.blockID) && par4 < 128 - var6 - 1) - { - this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID); - int var13; - int var16; - - for (var16 = par4 - 3 + var6; var16 <= par4 + var6; ++var16) - { - var10 = var16 - (par4 + var6); - var11 = 2 - var10 / 2; - - for (var12 = par3 - var11; var12 <= par3 + var11; ++var12) - { - var13 = var12 - par3; - - for (int var14 = par5 - var11; var14 <= par5 + var11; ++var14) - { - int var15 = var14 - par5; - - if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var12, var16, var14)]) - { - this.setBlock(par1World, var12, var16, var14, Block.leaves.blockID); - } - } - } - } - - for (var16 = 0; var16 < var6; ++var16) - { - var10 = par1World.getBlockId(par3, par4 + var16, par5); - - if (var10 == 0 || var10 == Block.leaves.blockID || var10 == Block.waterMoving.blockID || var10 == Block.waterStill.blockID) - { - this.setBlock(par1World, par3, par4 + var16, par5, Block.wood.blockID); - } - } - - par1World.setBlockMetadataWithClient(par3, par4, par5, 0 | 12); // place stump - - for (var16 = par4 - 3 + var6; var16 <= par4 + var6; ++var16) - { - var10 = var16 - (par4 + var6); - var11 = 2 - var10 / 2; - - for (var12 = par3 - var11; var12 <= par3 + var11; ++var12) - { - for (var13 = par5 - var11; var13 <= par5 + var11; ++var13) - { - if (par1World.getBlockId(var12, var16, var13) == Block.leaves.blockID) - { - if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12 - 1, var16, var13) == 0) - { - this.generateVines(par1World, var12 - 1, var16, var13, 8); - } - - if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12 + 1, var16, var13) == 0) - { - this.generateVines(par1World, var12 + 1, var16, var13, 2); - } - - if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12, var16, var13 - 1) == 0) - { - this.generateVines(par1World, var12, var16, var13 - 1, 1); - } - - if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12, var16, var13 + 1) == 0) - { - this.generateVines(par1World, var12, var16, var13 + 1, 4); - } - } - } - } - } - - return true; - } else - return false; - } - } else - return false; - } - - /** - * Generates vines at the given position until it hits a block. - */ - private void generateVines(World par1World, int par2, int par3, int par4, int par5) - { - this.setBlockAndMetadata(par1World, par2, par3, par4, Block.vine.blockID, par5); - int var6 = 8; - - while (true) - { - --par3; - - if (par1World.getBlockId(par2, par3, par4) != 0 || var6 <= 0) - return; - - this.setBlockAndMetadata(par1World, par2, par3, par4, Block.vine.blockID, par5); - --var6; - } - } -} diff --git a/minecraft_server/betterterrain/feature/tree/TemperateBirchGen.java b/minecraft_server/betterterrain/feature/tree/TemperateBirchGen.java deleted file mode 100644 index 91ed4c1..0000000 --- a/minecraft_server/betterterrain/feature/tree/TemperateBirchGen.java +++ /dev/null @@ -1,69 +0,0 @@ -package betterterrain.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class TemperateBirchGen extends WorldGenerator { - public final int minHeight = 7; - - @Override - public boolean generate(World world, Random rand, int x, int y, int z) { - if (world.getBlockId(x, y - 1, z) != Block.grass.blockID) - return false; - - int treeHeight = minHeight + rand.nextInt(3); - - for (int i = 0; i < treeHeight; i++) { - world.setBlockAndMetadata(x, y + i, z, Block.wood.blockID, 2); - } - world.setBlockAndMetadata(x, y, z, Block.wood.blockID, 2 | 12); //places stump - - int y2 = y + treeHeight - 1; - //Level 1 - setBlockAndMetadata(world, x, y2 + 2, z, Block.leaves.blockID, 2); - //Level 2 - setBlockAndMetadata(world, x, y2 + 1, z, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x + 1, y2 + 1, z, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x, y2 + 1, z + 1, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x - 1, y2 + 1, z, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x, y2 + 1, z - 1, Block.leaves.blockID, 2); - //Level 3 - setBlockAndMetadata(world, x + 1, y2, z, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x, y2, z + 1, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x - 1, y2, z, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x, y2, z - 1, Block.leaves.blockID, 2); - //Level 4-6 - for (int i = 1; i < 4; i++) { - setBlockAndMetadata(world, x + 1, y2 - i, z, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x + 2, y2 - i, z, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x + 1, y2 - i, z + 1, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x, y2 - i, z + 1, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x, y2 - i, z + 2, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x - 1, y2 - i, z + 1, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x - 1, y2 - i, z, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x - 2, y2 - i, z, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x - 1, y2 - i, z - 1, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x, y2 - i, z - 1, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x, y2 - i, z - 2, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x + 1, y2 - i, z - 1, Block.leaves.blockID, 2); - } - //Level 7 - setBlockAndMetadata(world, x + 1, y2 - 4, z, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x, y2 - 4, z + 1, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x - 1, y2 - 4, z, Block.leaves.blockID, 2); - setBlockAndMetadata(world, x, y2 - 4, z - 1, Block.leaves.blockID, 2); - - return true; - } - - public void setBlockAndMetadata(World world, int x, int y, int z, int blockId, int meta) { - int idReplace = world.getBlockId(x, y, z); - - if (idReplace == 0 || Block.blocksList[idReplace].blockMaterial.isReplaceable() || idReplace == Block.leaves.blockID) { - world.setBlockAndMetadata(x, y, z, blockId, meta); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/feature/tree/TinyShrubGen.java b/minecraft_server/betterterrain/feature/tree/TinyShrubGen.java deleted file mode 100644 index 8f866cf..0000000 --- a/minecraft_server/betterterrain/feature/tree/TinyShrubGen.java +++ /dev/null @@ -1,20 +0,0 @@ -package betterterrain.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class TinyShrubGen extends WorldGenerator { - @Override - public boolean generate(World world, Random rand, int x, int y, int z) { - if (world.getBlockId(x, y - 1, z) != Block.grass.blockID) - return false; - - world.setBlock(x, y - 1, z, Block.wood.blockID); - world.setBlock(x, y, z, Block.leaves.blockID); - - return true; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/feature/tree/WillowGen.java b/minecraft_server/betterterrain/feature/tree/WillowGen.java deleted file mode 100644 index 341c447..0000000 --- a/minecraft_server/betterterrain/feature/tree/WillowGen.java +++ /dev/null @@ -1,253 +0,0 @@ -package betterterrain.feature.tree; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class WillowGen extends WorldGenerator { - @Override - public boolean generate(World world, Random rand, int x, int y, int z) { - int height = rand.nextInt(3) + 10; - - if (world.getBlockId(x, y - 1, z) != Block.grass.blockID) - return false; - - for (int j = y; j <= y + height; j++) { - int offset = j > y + height - 7 ? 3 : 0; - - for (int i = x - offset; i <= x + 1 + offset; i++) { - for (int k = z - offset; k <= z + 1 + offset; k++) { - if (!world.isAirBlock(i, j, k)) { - return false; - } - } - } - } - - world.setBlockAndMetadata(x, y, z, Block.wood.blockID, 12); - world.setBlockAndMetadata(x + 1, y, z, Block.wood.blockID, 12); - world.setBlockAndMetadata(x + 1, y, z + 1, Block.wood.blockID, 12); - world.setBlockAndMetadata(x, y, z + 1, Block.wood.blockID, 12); - - this.setBlockAndMetadataIfEmpty(world, x - 1, y, z + 0, Block.wood.blockID, 12); - this.setBlockAndMetadataIfEmpty(world, x - 1, y, z + 1, Block.wood.blockID, 12); - this.setBlockAndMetadataIfEmpty(world, x + 0, y, z - 1, Block.wood.blockID, 12); - this.setBlockAndMetadataIfEmpty(world, x + 1, y, z - 1, Block.wood.blockID, 12); - this.setBlockAndMetadataIfEmpty(world, x + 2, y, z + 0, Block.wood.blockID, 12); - this.setBlockAndMetadataIfEmpty(world, x + 2, y, z + 1, Block.wood.blockID, 12); - this.setBlockAndMetadataIfEmpty(world, x + 0, y, z + 2, Block.wood.blockID, 12); - this.setBlockAndMetadataIfEmpty(world, x + 1, y, z + 2, Block.wood.blockID, 12); - - world.setBlockAndMetadata(x, y - 1, z, Block.dirt.blockID, 0); - world.setBlockAndMetadata(x + 1, y - 1, z, Block.dirt.blockID, 0); - world.setBlockAndMetadata(x + 1, y - 1, z + 1, Block.dirt.blockID, 0); - world.setBlockAndMetadata(x, y - 1, z + 1, Block.dirt.blockID, 0); - - this.setBlockAndMetadataIfEmpty(world, x - 1, y - 1, z + 0, Block.dirt.blockID, 0); - this.setBlockAndMetadataIfEmpty(world, x - 1, y - 1, z + 1, Block.dirt.blockID, 0); - this.setBlockAndMetadataIfEmpty(world, x + 0, y - 1, z - 1, Block.dirt.blockID, 0); - this.setBlockAndMetadataIfEmpty(world, x + 1, y - 1, z - 1, Block.dirt.blockID, 0); - this.setBlockAndMetadataIfEmpty(world, x + 2, y - 1, z + 0, Block.dirt.blockID, 0); - this.setBlockAndMetadataIfEmpty(world, x + 2, y - 1, z + 1, Block.dirt.blockID, 0); - this.setBlockAndMetadataIfEmpty(world, x + 0, y - 1, z + 2, Block.dirt.blockID, 0); - this.setBlockAndMetadataIfEmpty(world, x + 1, y - 1, z + 2, Block.dirt.blockID, 0); - - for (int j = y + 1; j <= y + height - 4; j++) { - world.setBlock(x, j, z, Block.wood.blockID); - world.setBlock(x + 1, j, z, Block.wood.blockID); - world.setBlock(x + 1, j, z + 1, Block.wood.blockID); - world.setBlock(x, j, z + 1, Block.wood.blockID); - } - - world.setBlock(x - 1, y + height - 3, z, Block.wood.blockID); - world.setBlock(x - 1, y + height - 2, z, Block.wood.blockID); - world.setBlock(x - 2, y + height - 1, z, Block.wood.blockID); - world.setBlock(x - 2, y + height - 0, z, Block.wood.blockID); - - world.setBlock(x + 1, y + height - 3, z - 1, Block.wood.blockID); - world.setBlock(x + 1, y + height - 2, z - 1, Block.wood.blockID); - world.setBlock(x + 1, y + height - 1, z - 2, Block.wood.blockID); - world.setBlock(x + 1, y + height - 0, z - 2, Block.wood.blockID); - - world.setBlock(x + 2, y + height - 3, z + 1, Block.wood.blockID); - world.setBlock(x + 2, y + height - 2, z + 1, Block.wood.blockID); - world.setBlock(x + 3, y + height - 1, z + 1, Block.wood.blockID); - world.setBlock(x + 3, y + height - 0, z + 1, Block.wood.blockID); - - world.setBlock(x, y + height - 3, z + 2, Block.wood.blockID); - world.setBlock(x, y + height - 2, z + 2, Block.wood.blockID); - world.setBlock(x, y + height - 1, z + 3, Block.wood.blockID); - world.setBlock(x, y + height - 0, z + 3, Block.wood.blockID); - - this.generateMainLeaves(world, rand, x, y + height, z); - - int branchHeight; - int branchSide; - - //Branch 1 (x, z - 1) - branchHeight = y + height - (5 + rand.nextInt(3)); - this.setBlockAndMetadata(world, x, branchHeight, z - 1, Block.wood.blockID, 8); - branchHeight += rand.nextInt(2); - branchSide = rand.nextInt(2); - this.setBlockAndMetadata(world, x - branchSide, branchHeight, z - 2, Block.wood.blockID, 8); - branchSide += rand.nextInt(2); - this.setBlockAndMetadata(world, x - branchSide, branchHeight + 1, z - 3, Block.wood.blockID, 0); - this.generateSmallLeaves(world, rand, x - branchSide, branchHeight + 1, z - 3); - - //Branch 2 (x - 1, z + 1) - branchHeight = y + height - (5 + rand.nextInt(3)); - this.setBlockAndMetadata(world, x - 1, branchHeight, z + 1, Block.wood.blockID, 4); - branchHeight += rand.nextInt(2); - branchSide = rand.nextInt(2) + 1; - this.setBlockAndMetadata(world, x - 2, branchHeight, z + branchSide, Block.wood.blockID, 4); - branchSide += rand.nextInt(2); - this.setBlockAndMetadata(world, x - 3, branchHeight + 1, z + branchSide, Block.wood.blockID, 0); - this.generateSmallLeaves(world, rand, x - 3, branchHeight + 1, z + branchSide); - - //Branch 3 (x + 1, z + 2) - branchHeight = y + height - (5 + rand.nextInt(3)); - this.setBlockAndMetadata(world, x + 1, branchHeight, z + 2, Block.wood.blockID, 8); - branchHeight += rand.nextInt(2); - branchSide = rand.nextInt(2) + 1; - this.setBlockAndMetadata(world, x + branchSide, branchHeight, z + 3, Block.wood.blockID, 8); - branchSide += rand.nextInt(2); - this.setBlockAndMetadata(world, x + branchSide, branchHeight + 1, z + 4, Block.wood.blockID, 0); - this.generateSmallLeaves(world, rand, x + branchSide, branchHeight + 1, z + 4); - - //Branch 4 (z, x + 2) - branchHeight = y + height - (5 + rand.nextInt(3)); - this.setBlockAndMetadata(world, x + 2, branchHeight, z, Block.wood.blockID, 4); - branchHeight += rand.nextInt(2); - branchSide = rand.nextInt(2); - this.setBlockAndMetadata(world, x + 3, branchHeight, z - branchSide, Block.wood.blockID, 4); - branchSide += rand.nextInt(2); - this.setBlockAndMetadata(world, x + 4, branchHeight + 1, z - branchSide, Block.wood.blockID, 0); - this.generateSmallLeaves(world, rand, x + 4, branchHeight + 1, z - branchSide); - - return true; - } - - public void setBlockAndMetadataIfEmpty(World world, int x, int y, int z, int id, int meta) { - if (world.isAirBlock(x, y, z)) - world.setBlockAndMetadata(x, y, z, id, meta); - } - - private boolean isLeafOnCorner(int x, int z, int minX, int minZ, int maxX, int maxZ, boolean bigCorner) { - if (x == minX && (z == minZ || (z == minZ + 1 && bigCorner))) - return true; - if (z == minZ && x == minX + 1 && bigCorner) - return true; - - if (x == minX && (z == maxZ || (z == maxZ - 1 && bigCorner))) - return true; - if (z == maxZ && x == minX + 1 && bigCorner) - return true; - - if (x == maxX && (z == minZ || (z == minZ + 1 && bigCorner))) - return true; - if (z == minZ && x == maxX - 1 && bigCorner) - return true; - - if (x == maxX && (z == maxZ || (z == maxZ - 1 && bigCorner))) - return true; - if (z == maxZ && x == maxX - 1 && bigCorner) - return true; - - return false; - } - - private void generateMainLeaves(World world, Random rand, int x, int y, int z) { - for (int i = x - 4; i <= x + 5; i++) { - for (int k = z - 4; k <= z + 5; k++) { - if (!this.isLeafOnCorner(i, k, x - 4, z - 4, x + 5, z + 5, true)) { - this.setBlockAndMetadataIfEmpty(world, i, y, k, Block.leaves.blockID, 8); - } - } - } - - for (int i = x - 3; i <= x + 4; i++) { - for (int k = z - 3; k <= z + 4; k++) { - if (!this.isLeafOnCorner(i, k, x - 3, z - 3, x + 4, z + 4, true)) { - this.setBlockAndMetadataIfEmpty(world, i, y + 1, k, Block.leaves.blockID, 8); - } - } - } - - for (int i = x - 2; i <= x + 3; i++) { - for (int k = z - 2; k <= z + 3; k++) { - if (!this.isLeafOnCorner(i, k, x - 2, z - 2, x + 3, z + 3, true)) { - this.setBlockAndMetadataIfEmpty(world, i, y + 2, k, Block.leaves.blockID, 8); - } - } - } - - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 5, y + j, z - 2, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x + 5, y + j, z - 1, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 5, y + j, z + 0, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x + 5, y + j, z + 1, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 5, y + j, z + 2, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x + 5, y + j, z + 3, Block.leaves.blockID, 12); - - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 4, y + j, z + 4, Block.leaves.blockID, 12); - - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x + 3, y + j, z + 5, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 2, y + j, z + 5, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x + 1, y + j, z + 5, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 0, y + j, z + 5, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x - 1, y + j, z + 5, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x - 2, y + j, z + 5, Block.leaves.blockID, 12); - - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x - 3, y + j, z + 4, Block.leaves.blockID, 12); - - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x - 4, y + j, z + 3, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x - 4, y + j, z + 2, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x - 4, y + j, z + 1, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x - 4, y + j, z + 0, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x - 4, y + j, z - 1, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x - 4, y + j, z - 2, Block.leaves.blockID, 12); - - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x - 3, y + j, z - 3, Block.leaves.blockID, 12); - - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x - 2, y + j, z - 4, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x - 1, y + j, z - 4, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x + 0, y + j, z - 4, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 1, y + j, z - 4, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x + 2, y + j, z - 4, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 3, y + j, z - 4, Block.leaves.blockID, 12); - - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 4, y + j, z - 3, Block.leaves.blockID, 12); - } - - private void generateSmallLeaves(World world, Random rand, int x, int y, int z) { - for (int i = x - 2; i <= x + 2; i++) { - for (int k = z - 2; k <= z + 2; k++) { - if (!this.isLeafOnCorner(i, k, x - 2, z - 2, x + 2, z + 2, false)) { - this.setBlockAndMetadataIfEmpty(world, i, y, k, Block.leaves.blockID, 8); - } - } - } - - for (int i = x - 1; i <= x + 1; i++) { - for (int k = z - 1; k <= z + 1; k++) { - if (!this.isLeafOnCorner(i, k, x - 1, z - 1, x + 1, z + 1, false)) { - this.setBlockAndMetadataIfEmpty(world, i, y + 1, k, Block.leaves.blockID, 8); - } - } - } - - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 2, y + j, z - 1, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x + 2, y + j, z + 0, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 2, y + j, z + 1, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x + 1, y + j, z + 2, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 0, y + j, z + 2, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x - 1, y + j, z + 2, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x - 2, y + j, z + 1, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x - 2, y + j, z + 0, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x - 2, y + j, z - 1, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x - 1, y + j, z - 2, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2); j--) this.setBlockAndMetadataIfEmpty(world, x + 0, y + j, z - 2, Block.leaves.blockID, 12); - for (int j = 0; j >= -rand.nextInt(2) - 2; j--) this.setBlockAndMetadataIfEmpty(world, x + 1, y + j, z - 2, Block.leaves.blockID, 12); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/item/BTAItemBloodMossSpores.java b/minecraft_server/betterterrain/item/BTAItemBloodMossSpores.java deleted file mode 100644 index b76144c..0000000 --- a/minecraft_server/betterterrain/item/BTAItemBloodMossSpores.java +++ /dev/null @@ -1,97 +0,0 @@ -package betterterrain.item; - -import java.util.List; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.Climate; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.BiomeGenHell; -import net.minecraft.src.Block; -import net.minecraft.src.DamageSource; -import net.minecraft.src.Entity; -import net.minecraft.src.EntityPlayer; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.FCEntityPigZombie; -import net.minecraft.src.FCItemBloodMossSpores; -import net.minecraft.src.FCUtilsBlockPos; -import net.minecraft.src.ItemStack; -import net.minecraft.src.World; -import net.minecraft.src.WorldChunkManager; - -public class BTAItemBloodMossSpores extends FCItemBloodMossSpores { - public BTAItemBloodMossSpores(int id) { - super(id); - } - - /** - * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return - * True if something happen and false if it don't. This is for ITEMS, not BLOCKS - */ - public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7, float var8, float var9, float var10) - { - if (var2 != null && !var2.canPlayerEdit(var4, var5, var6, var7, var1)) - { - return false; - } - else if (var1.stackSize == 0) - { - return false; - } - else - { - FCUtilsBlockPos var11 = new FCUtilsBlockPos(var4, var5, var6); - var11.AddFacingAsOffset(var7); - WorldChunkManager var12 = var3.getWorldChunkManager(); - - if (var12 != null) - { - BiomeGenBase var13 = var12.getBiomeGenAt(var4, var6); - - if (var13 instanceof BiomeGenHell || (var13 instanceof BTABiome && ((BTABiome) var13).climate == Climate.HELL)) - { - int var14 = FCBetterThanWolves.fcBlockBloodMoss.blockID; - byte var15 = 0; - - if (var3.canPlaceEntityOnSide(var14, var11.i, var11.j, var11.k, false, var7, var2, var1)) - { - if (!var3.isRemote) - { - int var17 = Block.blocksList[var14].onBlockPlaced(var3, var11.i, var11.j, var11.k, var7, var8, var9, var10, var15); - var17 = Block.blocksList[var14].PreBlockPlacedBy(var3, var11.i, var11.j, var11.k, var17, var2); - - if (var3.setBlockAndMetadataWithNotify(var11.i, var11.j, var11.k, var14, var17)) - { - Block var16 = Block.blocksList[var14]; - - if (var3.getBlockId(var11.i, var11.j, var11.k) == var14) - { - Block.blocksList[var14].onBlockPlacedBy(var3, var11.i, var11.j, var11.k, var2, var1); - Block.blocksList[var14].onPostBlockPlaced(var3, var11.i, var11.j, var11.k, var17); - } - - var3.playSoundEffect((double)((float)var11.i + 0.5F), (double)((float)var11.j + 0.5F), (double)((float)var11.k + 0.5F), var16.stepSound.getStepSound(), (var16.stepSound.getVolume() + 1.0F) / 2.0F, var16.stepSound.getPitch() * 0.8F); - this.AngerPigmen(var3, var2); - } - } - - --var1.stackSize; - return true; - } - } - } - - return false; - } - } - - private void AngerPigmen(World var1, EntityPlayer var2) - { - List var3 = var1.getEntitiesWithinAABB(FCEntityPigZombie.class, var2.boundingBox.expand(32.0D, 32.0D, 32.0D)); - - for (int var4 = 0; var4 < var3.size(); ++var4) - { - Entity var5 = (Entity)var3.get(var4); - var5.attackEntityFrom(DamageSource.causePlayerDamage(var2), 0); - } - } -} diff --git a/minecraft_server/betterterrain/item/BTAItemPileSoulSand.java b/minecraft_server/betterterrain/item/BTAItemPileSoulSand.java deleted file mode 100644 index 880acc1..0000000 --- a/minecraft_server/betterterrain/item/BTAItemPileSoulSand.java +++ /dev/null @@ -1,99 +0,0 @@ -// FCMOD - -package betterterrain.item; - -import betterterrain.world.generate.BTAChunkProvider; -import betterterrain.world.generate.NetherChunkProvider; -import betterterrain.world.generate.SkyChunkProvider; -import net.minecraft.src.ChunkProviderHell; -import net.minecraft.src.ChunkProviderServer; -import net.minecraft.src.CreativeTabs; -import net.minecraft.src.EntityList; -import net.minecraft.src.EntityPlayer; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.FCEntitySoulSand; -import net.minecraft.src.FCItemPileSoulSand; -import net.minecraft.src.FCSpawnLocation; -import net.minecraft.src.FCSpawnLocationList; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.ItemStack; -import net.minecraft.src.StructureStart; -import net.minecraft.src.World; - -public class BTAItemPileSoulSand extends FCItemPileSoulSand -{ - public BTAItemPileSoulSand(int itemID) { - super(itemID); - } - - @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - if (!world.isRemote) { - boolean hasTarget = false; - - double targetXPos = player.posX; - double targetZPos = player.posZ; - - if (world.provider.dimensionId == 0) { - FCSpawnLocationList spawnList = world.GetSpawnLocationList(); - - FCSpawnLocation closestSpawnLoc = spawnList.GetClosestSpawnLocationForPosition(player.posX, player.posZ); - - if (closestSpawnLoc != null) { - targetXPos = closestSpawnLoc.m_iIPos; - targetZPos = closestSpawnLoc.m_iKPos; - - hasTarget = true; - } - } - else if (world.provider.dimensionId == -1) { - IChunkProvider provider = world.getChunkProvider(); - - if (provider != null && provider instanceof ChunkProviderServer) { - ChunkProviderServer serverProvider = (ChunkProviderServer)provider; - - provider = serverProvider.GetCurrentProvider(); - - if (provider != null) { - StructureStart closestFortress = null; - - if (provider instanceof ChunkProviderHell) { - ChunkProviderHell hellProvider = (ChunkProviderHell) provider; - closestFortress = hellProvider.genNetherBridge.GetClosestStructureWithinRangeSq(player.posX, player.posZ, 90000); // 300 block range - } - else if (provider instanceof BTAChunkProvider) { - BTAChunkProvider btaProvider = (BTAChunkProvider) provider; - - if (btaProvider.isNether()) { - closestFortress = btaProvider.getNetherBridgeGenerator().GetClosestStructureWithinRangeSq(player.posX, player.posZ, 90000); // 300 block range - } - } - - if (closestFortress != null) { - targetXPos = (double)closestFortress.getBoundingBox().getCenterX(); - targetZPos = (double)closestFortress.getBoundingBox().getCenterZ(); - - hasTarget = true; - } - } - } - } - - FCEntitySoulSand sandEntity = (FCEntitySoulSand) EntityList.createEntityOfType(FCEntitySoulSand.class, world, player.posX, player.posY + 2.0D - (double)player.yOffset, player.posZ); - - sandEntity.MoveTowards(targetXPos, targetZPos); - - world.spawnEntityInWorld(sandEntity); - - if (hasTarget) { - world.playAuxSFX(FCBetterThanWolves.m_iGhastMoanSoundAuxFXID, (int) Math.round(sandEntity.posX), (int) Math.round(sandEntity.posY), (int) Math.round(sandEntity.posZ), 0); - } - - if (!player.capabilities.isCreativeMode) { - --stack.stackSize; - } - } - - return stack; - } -} diff --git a/minecraft_server/betterterrain/structure/BTAStructureComponent.java b/minecraft_server/betterterrain/structure/BTAStructureComponent.java deleted file mode 100644 index 26c9288..0000000 --- a/minecraft_server/betterterrain/structure/BTAStructureComponent.java +++ /dev/null @@ -1,589 +0,0 @@ -package betterterrain.structure; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.BlockDirectional; -import net.minecraft.src.BlockDoor; -import net.minecraft.src.BlockFenceGate; -import net.minecraft.src.BlockFlower; -import net.minecraft.src.BlockTrapDoor; -import net.minecraft.src.Direction; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.FCBlockStairs; -import net.minecraft.src.Facing; -import net.minecraft.src.ItemDoor; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureComponent; -import net.minecraft.src.World; - -abstract class BTAStructureComponent extends StructureComponent { - protected BTAStructureComponent(int par1) { - super(par1); - } - - /** - * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int - * maxZ, int placeBlockId, int placeBlockMetadata, int replaceBlockId, int replaceBlockMetadata, boolean - * alwaysreplace) - */ - protected void fillWithMetadataBlocks(World world, StructureBoundingBox structBB, int minY, int minX, int minZ, int maxY, int maxX, int maxZ, int par9, int par10, int par11, int par12, boolean par13) - { - for (int i = minX; i <= maxX; ++i) - { - for (int j = minY; j <= maxY; ++j) - { - for (int k = minZ; k <= maxZ; ++k) - { - if (!par13 || this.getBlockIdAtCurrentPosition(world, j, i, k, structBB) != 0) - { - if (i != minX && i != maxX && j != minY && j != maxY && k != minZ && k != maxZ) - { - this.placeBlockAtCurrentPosition(world, par11, par12, j, i, k, structBB); - } - else - { - this.placeBlockAtCurrentPosition(world, par9, par10, j, i, k, structBB); - } - } - } - } - } - } - - /** - * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int - * maxZ, int placeBlockId, int placeBlockMetadata, int replaceBlockId, int replaceBlockMetadata, boolean - * alwaysreplace) - */ - protected void fillWithMetadataBlocksIfEmpty(World world, StructureBoundingBox structBB, int minY, int minX, int minZ, int maxY, int maxX, int maxZ, int par9, int par10) - { - for (int i = minX; i <= maxX; ++i) - { - for (int j = minY; j <= maxY; ++j) - { - for (int k = minZ; k <= maxZ; ++k) - { - if (this.getBlockIdAtCurrentPosition(world, j, i, k, structBB) == 0 || Block.blocksList[this.getBlockIdAtCurrentPosition(world, j, i, k, structBB)].blockMaterial.isReplaceable() || Block.blocksList[this.getBlockIdAtCurrentPosition(world, j, i, k, structBB)] instanceof BlockFlower) - { - this.placeBlockAtCurrentPosition(world, par9, par10, j, i, k, structBB); - } - } - } - } - } - - /** - * Overwrites air and liquids from selected position downwards, stops at hitting anything else. - */ - protected void fillCurrentPositionBlocksDownwards(World par1World, int par2, int par3, int par4, int par5, int par6, StructureBoundingBox par7StructureBoundingBox) - { - int var8 = this.getXWithOffset(par4, par6); - int var9 = this.getYWithOffset(par5); - int var10 = this.getZWithOffset(par4, par6); - - if (par7StructureBoundingBox.isVecInside(var8, var9, var10)) - { - while ((par1World.isAirBlock(var8, var9, var10) || par1World.getBlockMaterial(var8, var9, var10).isLiquid() || Block.blocksList[par1World.getBlockId(var8, var9, var10)].blockMaterial.isReplaceable() || Block.blocksList[par1World.getBlockId(var8, var9, var10)] instanceof BlockFlower) && var9 > 1) - { - par1World.setBlock(var8, var9, var10, par2, par3, 2); - --var9; - } - } - } - - protected void placeDoorAtCurrentPosition(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, int par7, BlockDoor door) - { - int var8 = this.getXWithOffset(par4, par6); - int var9 = this.getYWithOffset(par5); - int var10 = this.getZWithOffset(par4, par6); - - if (par2StructureBoundingBox.isVecInside(var8, var9, var10)) - { - ItemDoor.placeDoorBlock(par1World, var8, var9, var10, par7, door); - } - } - - protected int getMetadataWithOffset(int blockId, int meta) - { - /*try {*/ - if (blockId == Block.rail.blockID) - { - if (this.coordBaseMode == 1 || this.coordBaseMode == 3) - { - if (meta == 1) - { - return 0; - } - - return 1; - } - } - else if (!(Block.blocksList[blockId] instanceof BlockDoor)) - { - if (!(Block.blocksList[blockId] instanceof FCBlockStairs)) - { - if (blockId == Block.ladder.blockID) - { - if (this.coordBaseMode == 0) - { - if (meta == 2) - { - return 3; - } - - if (meta == 3) - { - return 2; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 2) - { - return 4; - } - - if (meta == 3) - { - return 5; - } - - if (meta == 4) - { - return 2; - } - - if (meta == 5) - { - return 3; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 2) - { - return 5; - } - - if (meta == 3) - { - return 4; - } - - if (meta == 4) - { - return 2; - } - - if (meta == 5) - { - return 3; - } - } - } - else if (blockId == Block.stoneButton.blockID) - { - if (this.coordBaseMode == 0) - { - if (meta == 3) - { - return 4; - } - - if (meta == 4) - { - return 3; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 3) - { - return 1; - } - - if (meta == 4) - { - return 2; - } - - if (meta == 2) - { - return 3; - } - - if (meta == 1) - { - return 4; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 3) - { - return 2; - } - - if (meta == 4) - { - return 1; - } - - if (meta == 2) - { - return 3; - } - - if (meta == 1) - { - return 4; - } - } - } - else if (blockId != Block.tripWireSource.blockID && (Block.blocksList[blockId] == null || !(Block.blocksList[blockId] instanceof BlockDirectional))) - { - if (blockId == Block.pistonBase.blockID || blockId == Block.pistonStickyBase.blockID || blockId == Block.lever.blockID || blockId == Block.dispenser.blockID) - { - if (this.coordBaseMode == 0) - { - if (meta == 2 || meta == 3) - { - return Facing.oppositeSide[meta]; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 2) - { - return 4; - } - - if (meta == 3) - { - return 5; - } - - if (meta == 4) - { - return 2; - } - - if (meta == 5) - { - return 3; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 2) - { - return 5; - } - - if (meta == 3) - { - return 4; - } - - if (meta == 4) - { - return 2; - } - - if (meta == 5) - { - return 3; - } - } - } - } - else if (this.coordBaseMode == 0) - { - if (meta == 0 || meta == 2) - { - return Direction.footInvisibleFaceRemap[meta]; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 2) - { - return 1; - } - - if (meta == 0) - { - return 3; - } - - if (meta == 1) - { - return 2; - } - - if (meta == 3) - { - return 0; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 2) - { - return 3; - } - - if (meta == 0) - { - return 1; - } - - if (meta == 1) - { - return 2; - } - - if (meta == 3) - { - return 0; - } - } - } - else if (this.coordBaseMode == 0) - { - if (meta == 2) - { - return 3; - } - - if (meta == 3) - { - return 2; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 0) - { - return 2; - } - - if (meta == 1) - { - return 3; - } - - if (meta == 2) - { - return 0; - } - - if (meta == 3) - { - return 1; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 0) - { - return 2; - } - - if (meta == 1) - { - return 3; - } - - if (meta == 2) - { - return 1; - } - - if (meta == 3) - { - return 0; - } - } - } - else if (this.coordBaseMode == 0) - { - if (meta == 0) - { - return 2; - } - - if (meta == 2) - { - return 0; - } - } - else - { - if (this.coordBaseMode == 1) - { - return meta + 1 & 3; - } - - if (this.coordBaseMode == 3) - { - return meta + 3 & 3; - } - } - - if (blockId == Block.wood.blockID) {// || (BTADecoIntegration.isDecoInstalled() && (blockId == BTADecoIntegration.barkLogStripped.blockID || blockId == BTADecoIntegration.strippedLog.blockID))) { - if (this.coordBaseMode == 1 || this.coordBaseMode == 3) { - if ((meta & 8) != 0) { - return meta - 4; - } - else { - return meta + 4; - } - } - } - - if (blockId == Block.bed.blockID) { - if (this.coordBaseMode == 1) { - meta += 1; - } - if (this.coordBaseMode == 0) { - meta += 2; - } - if (this.coordBaseMode == 3) { - meta += 3; - } - - return meta % 4; - } - - if (Block.blocksList[blockId] instanceof BlockFenceGate) { - if (this.coordBaseMode == 1 || this.coordBaseMode == 3) { - return meta % 2 + 1; - } - } - - if (Block.blocksList[blockId] instanceof BlockTrapDoor /*|| (BTADecoIntegration.isDecoInstalled() && Class.forName("DecoBlockChair").isInstance(Block.blocksList[blockId]))*/) { - if (this.coordBaseMode == 0) - { - if (meta == 0) - { - return 1; - } - - if (meta == 1) - { - return 0; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 0) - { - return 2; - } - - if (meta == 1) - { - return 3; - } - - if (meta == 2) - { - return 0; - } - - if (meta == 3) - { - return 1; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 0) - { - return 3; - } - - if (meta == 1) - { - return 2; - } - - if (meta == 2) - { - return 0; - } - - if (meta == 3) - { - return 1; - } - } - - if (blockId == FCBetterThanWolves.fcBlockFurnaceBrickIdle.blockID) { - if (this.coordBaseMode == 0) - { - if (meta == 0) - { - return 5; - } - - if (meta == 1) - { - return 4; - } - } - else if (this.coordBaseMode == 1) - { - if (meta == 0) - { - return 2; - } - - if (meta == 1) - { - return 3; - } - - if (meta == 2) - { - return 4; - } - - if (meta == 3) - { - return 5; - } - } - else if (this.coordBaseMode == 3) - { - if (meta == 0) - { - return 3; - } - - if (meta == 1) - { - return 2; - } - - if (meta == 2) - { - return 4; - } - - if (meta == 3) - { - return 5; - } - } - } - } - /*} catch (ClassNotFoundException e) { - e.printStackTrace(); - }*/ - - return meta; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/structure/BTAStructureMineshaftPieces.java b/minecraft_server/betterterrain/structure/BTAStructureMineshaftPieces.java deleted file mode 100644 index 7f3f6cf..0000000 --- a/minecraft_server/betterterrain/structure/BTAStructureMineshaftPieces.java +++ /dev/null @@ -1,89 +0,0 @@ -package betterterrain.structure; - -import java.util.List; -import java.util.Random; - -import betterterrain.structure.component.BTAComponentMineshaftCorridor; -import betterterrain.structure.component.BTAComponentMineshaftCross; -import betterterrain.structure.component.BTAComponentMineshaftStairs; -import net.minecraft.src.Block; -import net.minecraft.src.Item; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureComponent; -import net.minecraft.src.WeightedRandomChestContent; - -public class BTAStructureMineshaftPieces -{ - /** List of contents that can generate in Mineshafts. */ - private static final WeightedRandomChestContent[] mineshaftChestContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.ingotIron.itemID, 0, 1, 5, 10), new WeightedRandomChestContent(Item.ingotGold.itemID, 0, 1, 3, 5), new WeightedRandomChestContent(Item.redstone.itemID, 0, 4, 9, 5), new WeightedRandomChestContent(Item.dyePowder.itemID, 4, 4, 9, 5), new WeightedRandomChestContent(Item.diamond.itemID, 0, 1, 2, 3), new WeightedRandomChestContent(Item.coal.itemID, 0, 3, 8, 10), new WeightedRandomChestContent(Item.bread.itemID, 0, 1, 3, 15), new WeightedRandomChestContent(Item.pickaxeIron.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Block.rail.blockID, 0, 4, 8, 1), new WeightedRandomChestContent(Item.melonSeeds.itemID, 0, 2, 4, 10), new WeightedRandomChestContent(Item.pumpkinSeeds.itemID, 0, 2, 4, 10)}; - - private static StructureComponent getRandomComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) - { - int var7 = par1Random.nextInt(100); - StructureBoundingBox var8; - - if (var7 >= 80) - { - var8 = BTAComponentMineshaftCross.findValidPlacement(par0List, par1Random, par2, par3, par4, par5); - - if (var8 != null) - { - return new BTAComponentMineshaftCross(par6, par1Random, var8, par5); - } - } - else if (var7 >= 70) - { - var8 = BTAComponentMineshaftStairs.findValidPlacement(par0List, par1Random, par2, par3, par4, par5); - - if (var8 != null) - { - return new BTAComponentMineshaftStairs(par6, par1Random, var8, par5); - } - } - else - { - var8 = BTAComponentMineshaftCorridor.findValidPlacement(par0List, par1Random, par2, par3, par4, par5); - - if (var8 != null) - { - return new BTAComponentMineshaftCorridor(par6, par1Random, var8, par5); - } - } - - return null; - } - - private static StructureComponent getNextMineShaftComponent(StructureComponent par0StructureComponent, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) - { - if (par7 > 8) - { - return null; - } - else if (Math.abs(par3 - par0StructureComponent.getBoundingBox().minX) <= 80 && Math.abs(par5 - par0StructureComponent.getBoundingBox().minZ) <= 80) - { - StructureComponent var8 = getRandomComponent(par1List, par2Random, par3, par4, par5, par6, par7 + 1); - - if (var8 != null) - { - par1List.add(var8); - var8.buildComponent(par0StructureComponent, par1List, par2Random); - } - - return var8; - } - else - { - return null; - } - } - - public static StructureComponent getNextComponent(StructureComponent par0StructureComponent, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) - { - return getNextMineShaftComponent(par0StructureComponent, par1List, par2Random, par3, par4, par5, par6, par7); - } - - static WeightedRandomChestContent[] func_78816_a() - { - return mineshaftChestContents; - } -} diff --git a/minecraft_server/betterterrain/structure/BTAStructureMineshaftStart.java b/minecraft_server/betterterrain/structure/BTAStructureMineshaftStart.java deleted file mode 100644 index d9ddd55..0000000 --- a/minecraft_server/betterterrain/structure/BTAStructureMineshaftStart.java +++ /dev/null @@ -1,19 +0,0 @@ -package betterterrain.structure; - -import java.util.Random; - -import net.minecraft.src.ComponentMineshaftRoom; -import net.minecraft.src.StructureStart; -import net.minecraft.src.World; - -public class BTAStructureMineshaftStart extends StructureStart -{ - public BTAStructureMineshaftStart(World par1World, Random par2Random, int par3, int par4) - { - ComponentMineshaftRoom var5 = new ComponentMineshaftRoom(0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2); - this.components.add(var5); - var5.buildComponent(var5, this.components, par2Random); - this.updateBoundingBox(); - this.markAvailableHeight(par1World, par2Random, 10); - } -} diff --git a/minecraft_server/betterterrain/structure/callable/BTACallableChunkPosHash.java b/minecraft_server/betterterrain/structure/callable/BTACallableChunkPosHash.java deleted file mode 100644 index 8f15bff..0000000 --- a/minecraft_server/betterterrain/structure/callable/BTACallableChunkPosHash.java +++ /dev/null @@ -1,32 +0,0 @@ -package betterterrain.structure.callable; - -import java.util.concurrent.Callable; - -import betterterrain.structure.mapgen.BTAMapGenStructure; -import net.minecraft.src.ChunkCoordIntPair; - -public class BTACallableChunkPosHash implements Callable -{ - final int field_85165_a; - - final int field_85163_b; - - final BTAMapGenStructure theMapStructureGenerator; - - public BTACallableChunkPosHash(BTAMapGenStructure par1MapGenStructure, int par2, int par3) - { - this.theMapStructureGenerator = par1MapGenStructure; - this.field_85165_a = par2; - this.field_85163_b = par3; - } - - public String callChunkPositionHash() - { - return String.valueOf(ChunkCoordIntPair.chunkXZ2Int(this.field_85165_a, this.field_85163_b)); - } - - public Object call() - { - return this.callChunkPositionHash(); - } -} diff --git a/minecraft_server/betterterrain/structure/callable/BTACallableIsFeatureChunk.java b/minecraft_server/betterterrain/structure/callable/BTACallableIsFeatureChunk.java deleted file mode 100644 index 489fd2b..0000000 --- a/minecraft_server/betterterrain/structure/callable/BTACallableIsFeatureChunk.java +++ /dev/null @@ -1,31 +0,0 @@ -package betterterrain.structure.callable; - -import java.util.concurrent.Callable; - -import betterterrain.structure.mapgen.BTAMapGenStructure; - -public class BTACallableIsFeatureChunk implements Callable -{ - final int field_85169_a; - - final int field_85167_b; - - final BTAMapGenStructure theMapStructureGenerator; - - public BTACallableIsFeatureChunk(BTAMapGenStructure par1MapGenStructure, int par2, int par3) - { - this.theMapStructureGenerator = par1MapGenStructure; - this.field_85169_a = par2; - this.field_85167_b = par3; - } - - public String func_85166_a() - { - return this.theMapStructureGenerator.canSpawnStructureAtCoords(this.field_85169_a, this.field_85167_b) ? "True" : "False"; - } - - public Object call() - { - return this.func_85166_a(); - } -} diff --git a/minecraft_server/betterterrain/structure/callable/BTACallableStructureType.java b/minecraft_server/betterterrain/structure/callable/BTACallableStructureType.java deleted file mode 100644 index ca8887a..0000000 --- a/minecraft_server/betterterrain/structure/callable/BTACallableStructureType.java +++ /dev/null @@ -1,25 +0,0 @@ -package betterterrain.structure.callable; - -import java.util.concurrent.Callable; - -import betterterrain.structure.mapgen.BTAMapGenStructure; - -public class BTACallableStructureType implements Callable -{ - final BTAMapGenStructure theMapStructureGenerator; - - public BTACallableStructureType(BTAMapGenStructure par1MapGenStructure) - { - this.theMapStructureGenerator = par1MapGenStructure; - } - - public String callStructureType() - { - return this.theMapStructureGenerator.getClass().getCanonicalName(); - } - - public Object call() - { - return this.callStructureType(); - } -} diff --git a/minecraft_server/betterterrain/structure/component/BTAComponentMineshaftCorridor.java b/minecraft_server/betterterrain/structure/component/BTAComponentMineshaftCorridor.java deleted file mode 100644 index eb9cc31..0000000 --- a/minecraft_server/betterterrain/structure/component/BTAComponentMineshaftCorridor.java +++ /dev/null @@ -1,435 +0,0 @@ -package betterterrain.structure.component; - -import java.util.List; -import java.util.Random; - -import betterterrain.structure.BTAStructureMineshaftPieces; -import net.minecraft.src.Block; -import net.minecraft.src.EntityMinecartChest; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.Item; -import net.minecraft.src.ItemStack; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureComponent; -import net.minecraft.src.StructureMineshaftPieces; -import net.minecraft.src.TileEntityMobSpawner; -import net.minecraft.src.WeightedRandomChestContent; -import net.minecraft.src.World; - -public class BTAComponentMineshaftCorridor extends StructureComponent -{ - private final boolean hasRails; - private final boolean hasSpiders; - private boolean spawnerPlaced; - - /** - * A count of the different sections of this mine. The space between ceiling supports. - */ - private int sectionCount; - - public BTAComponentMineshaftCorridor(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) - { - super(par1); - this.coordBaseMode = par4; - this.boundingBox = par3StructureBoundingBox; - this.hasRails = par2Random.nextInt(3) == 0; - this.hasSpiders = !this.hasRails && par2Random.nextInt(23) == 0; - - if (this.coordBaseMode != 2 && this.coordBaseMode != 0) - { - this.sectionCount = par3StructureBoundingBox.getXSize() / 5; - } - else - { - this.sectionCount = par3StructureBoundingBox.getZSize() / 5; - } - } - - public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5) - { - StructureBoundingBox var6 = new StructureBoundingBox(par2, par3, par4, par2, par3 + 2, par4); - int var7; - - for (var7 = par1Random.nextInt(3) + 2; var7 > 0; --var7) - { - int var8 = var7 * 5; - - switch (par5) - { - case 0: - var6.maxX = par2 + 2; - var6.maxZ = par4 + (var8 - 1); - break; - - case 1: - var6.minX = par2 - (var8 - 1); - var6.maxZ = par4 + 2; - break; - - case 2: - var6.maxX = par2 + 2; - var6.minZ = par4 - (var8 - 1); - break; - - case 3: - var6.maxX = par2 + (var8 - 1); - var6.maxZ = par4 + 2; - } - - if (StructureComponent.findIntersecting(par0List, var6) == null) - { - break; - } - } - - return var7 > 0 ? var6 : null; - } - - /** - * Initiates construction of the Structure Component picked, at the current Location of StructGen - */ - public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) - { - int var4 = this.getComponentType(); - int var5 = par3Random.nextInt(4); - - switch (this.coordBaseMode) - { - case 0: - if (var5 <= 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ + 1, this.coordBaseMode, var4); - } - else if (var5 == 2) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ - 3, 1, var4); - } - else - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ - 3, 3, var4); - } - - break; - - case 1: - if (var5 <= 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, this.coordBaseMode, var4); - } - else if (var5 == 2) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ - 1, 2, var4); - } - else - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ + 1, 0, var4); - } - - break; - - case 2: - if (var5 <= 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ - 1, this.coordBaseMode, var4); - } - else if (var5 == 2) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, 1, var4); - } - else - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, 3, var4); - } - - break; - - case 3: - if (var5 <= 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, this.coordBaseMode, var4); - } - else if (var5 == 2) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX - 3, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ - 1, 2, var4); - } - else - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX - 3, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ + 1, 0, var4); - } - } - - if (var4 < 8) - { - int var6; - int var7; - - if (this.coordBaseMode != 2 && this.coordBaseMode != 0) - { - for (var6 = this.boundingBox.minX + 3; var6 + 3 <= this.boundingBox.maxX; var6 += 5) - { - var7 = par3Random.nextInt(5); - - if (var7 == 0) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, var6, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4 + 1); - } - else if (var7 == 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, var6, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4 + 1); - } - } - } - else - { - for (var6 = this.boundingBox.minZ + 3; var6 + 3 <= this.boundingBox.maxZ; var6 += 5) - { - var7 = par3Random.nextInt(5); - - if (var7 == 0) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, var6, 1, var4 + 1); - } - else if (var7 == 1) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, var6, 3, var4 + 1); - } - } - } - } - } - - /** - * Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests. - */ - protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8) - { - int var9 = this.getXWithOffset(par4, par6); - int var10 = this.getYWithOffset(par5); - int var11 = this.getZWithOffset(par4, par6); - - if (par2StructureBoundingBox.isVecInside(var9, var10, var11) && par1World.getBlockId(var9, var10, var11) == 0) - { - par1World.setBlock(var9, var10, var11, Block.rail.blockID, this.getMetadataWithOffset(Block.rail.blockID, par3Random.nextBoolean() ? 1 : 0), 2); - EntityMinecartChest var12 = new EntityMinecartChest(par1World, (double)((float)var9 + 0.5F), (double)((float)var10 + 0.5F), (double)((float)var11 + 0.5F)); - WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, var12, par8); - this.FilterChestMinecartContents(var12); - par1World.spawnEntityInWorld(var12); - return true; - } - else - { - return false; - } - } - - /** - * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at - * the end, it adds Fences... - */ - public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) - { - if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox) || this.isStructureBoundingBoxEmpty(par1World, par3StructureBoundingBox)) - { - return false; - } - else - { - int var4 = this.sectionCount * 5 - 1; - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 1, var4, 0, 0, false); - this.randomlyFillWithBlocks(par1World, par3StructureBoundingBox, par2Random, 0.8F, 0, 2, 0, 2, 2, var4, 0, 0, false); - - if (this.hasSpiders) - { - this.randomlyFillWithBlocks(par1World, par3StructureBoundingBox, par2Random, 0.6F, 0, 0, 0, 2, 1, var4, FCBetterThanWolves.fcBlockWeb.blockID, 0, false); - } - - int var5; - int var6; - int var7; - - for (var5 = 0; var5 < this.sectionCount; ++var5) - { - var6 = 2 + var5 * 5; - - boolean supportShaft = false; - - if (this.getBlockIdAtCurrentPosition(par1World, 0, 3, var6, par3StructureBoundingBox) != 0 || - this.getBlockIdAtCurrentPosition(par1World, 1, 3, var6, par3StructureBoundingBox) != 0 || - this.getBlockIdAtCurrentPosition(par1World, 2, 3, var6, par3StructureBoundingBox) != 0) - supportShaft = true; - - if (supportShaft) { - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 0, var6, 0, 1, var6, Block.wood.blockID, 0, 0, 0, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 0, var6, 2, 1, var6, Block.wood.blockID, 0, 0, 0, false); - int var8 = this.getMetadataWithOffset(Block.wood.blockID, 4); - - if (par2Random.nextInt(4) == 0) - { - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 2, var6, 0, 2, var6, Block.wood.blockID, var8, 0, 0, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 2, var6, 2, 2, var6, Block.wood.blockID, var8, 0, 0, false); - } - else - { - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 2, var6, 2, 2, var6, Block.wood.blockID, var8, 0, 0, false); - } - } - else if (var5 % 2 == 0){ - - } - - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.1F, 0, 2, var6 - 1, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.1F, 2, 2, var6 - 1, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.1F, 0, 2, var6 + 1, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.1F, 2, 2, var6 + 1, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 0, 2, var6 - 2, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 2, 2, var6 - 2, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 0, 2, var6 + 2, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 2, 2, var6 + 2, FCBetterThanWolves.fcBlockWeb.blockID, 0); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, var6 - 1, FCBetterThanWolves.fcBlockTorchFiniteUnlit.blockID, 8); - this.randomlyPlaceBlockIfNeighbor(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, var6 + 1, FCBetterThanWolves.fcBlockTorchFiniteUnlit.blockID, 8); - - if (par2Random.nextInt(100) == 0) - { - this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, var6 - 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); - } - - if (par2Random.nextInt(100) == 0) - { - this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, var6 + 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); - } - - if (this.hasSpiders && !this.spawnerPlaced) - { - var7 = this.getYWithOffset(0); - int var9 = var6 - 1 + par2Random.nextInt(3); - int var10 = this.getXWithOffset(1, var9); - var9 = this.getZWithOffset(1, var9); - - if (par3StructureBoundingBox.isVecInside(var10, var7, var9)) - { - this.spawnerPlaced = true; - par1World.setBlock(var10, var7, var9, Block.mobSpawner.blockID, 0, 2); - TileEntityMobSpawner var11 = (TileEntityMobSpawner)par1World.getBlockTileEntity(var10, var7, var9); - - if (var11 != null) - { - var11.func_98049_a().setMobID("CaveSpider"); - } - } - } - } - - for (var5 = 0; var5 <= 2; ++var5) - { - for (var6 = 0; var6 <= var4; ++var6) - { - var7 = this.getBlockIdAtCurrentPosition(par1World, var5, -1, var6, par3StructureBoundingBox); - - if (var7 == 0) - { - this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, var5, -1, var6, par3StructureBoundingBox); - } - } - } - - if (this.hasRails) - { - for (var5 = 0; var5 <= var4; ++var5) - { - var6 = this.getBlockIdAtCurrentPosition(par1World, 1, -1, var5, par3StructureBoundingBox); - - if (var6 > 0 && Block.opaqueCubeLookup[var6]) - { - this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.7F, 1, 0, var5, Block.rail.blockID, this.getMetadataWithOffset(Block.rail.blockID, 0)); - } - } - } - - return true; - } - } - - private void FilterChestMinecartContents(EntityMinecartChest var1) - { - for (int var2 = 0; var2 < var1.getSizeInventory(); ++var2) - { - ItemStack var3 = var1.getStackInSlot(var2); - - if (var3 != null) - { - int var4 = var3.itemID; - - if (var4 == Item.ingotIron.itemID) - { - if (var1.posY > 36.0D) - { - var1.setInventorySlotContents(var2, (ItemStack)null); - } - else - { - var3.stackSize = 1; - } - } - else if (var4 == Item.diamond.itemID) - { - if (var1.posY > 24.0D) - { - var1.setInventorySlotContents(var2, (ItemStack)null); - } - else - { - var3.stackSize = 1; - } - } - else if (var4 == Item.pickaxeIron.itemID) - { - var1.setInventorySlotContents(var2, (ItemStack)null); - } - else if (var4 == Item.redstone.itemID) - { - if (var1.posY > 24.0D) - { - var1.setInventorySlotContents(var2, (ItemStack)null); - } - } - else if (var4 == Item.pumpkinSeeds.itemID) - { - var1.setInventorySlotContents(var2, (ItemStack)null); - } - } - } - } - - /** - * Returns the direction-shifted metadata for blocks that require orientation, e.g. doors, stairs, ladders. - * Parameters: block ID, original metadata - */ - protected int getMetadataWithOffset(int var1, int var2) - { - if (var1 != Block.wood.blockID) - { - return super.getMetadataWithOffset(var1, var2); - } - else - { - if (this.coordBaseMode == 1 || this.coordBaseMode == 3) - { - int var3 = var2 & 3; - int var4 = var2 & 12; - - if (var4 == 4) - { - var4 = 8; - } - else if (var4 == 8) - { - var4 = 4; - } - - var2 = var3 | var4; - } - - return var2; - } - } -} diff --git a/minecraft_server/betterterrain/structure/component/BTAComponentMineshaftCross.java b/minecraft_server/betterterrain/structure/component/BTAComponentMineshaftCross.java deleted file mode 100644 index 788255e..0000000 --- a/minecraft_server/betterterrain/structure/component/BTAComponentMineshaftCross.java +++ /dev/null @@ -1,167 +0,0 @@ -package betterterrain.structure.component; - -import java.util.List; -import java.util.Random; - -import betterterrain.structure.BTAStructureMineshaftPieces; -import net.minecraft.src.Block; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureComponent; -import net.minecraft.src.World; - -public class BTAComponentMineshaftCross extends StructureComponent -{ - private final int corridorDirection; - private final boolean isMultipleFloors; - - public BTAComponentMineshaftCross(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) - { - super(par1); - this.corridorDirection = par4; - this.boundingBox = par3StructureBoundingBox; - this.isMultipleFloors = par3StructureBoundingBox.getYSize() > 3; - } - - public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5) - { - StructureBoundingBox var6 = new StructureBoundingBox(par2, par3, par4, par2, par3 + 2, par4); - - if (par1Random.nextInt(4) == 0) - { - var6.maxY += 4; - } - - switch (par5) - { - case 0: - var6.minX = par2 - 1; - var6.maxX = par2 + 3; - var6.maxZ = par4 + 4; - break; - - case 1: - var6.minX = par2 - 4; - var6.minZ = par4 - 1; - var6.maxZ = par4 + 3; - break; - - case 2: - var6.minX = par2 - 1; - var6.maxX = par2 + 3; - var6.minZ = par4 - 4; - break; - - case 3: - var6.maxX = par2 + 4; - var6.minZ = par4 - 1; - var6.maxZ = par4 + 3; - } - - return StructureComponent.findIntersecting(par0List, var6) != null ? null : var6; - } - - /** - * Initiates construction of the Structure Component picked, at the current Location of StructGen - */ - public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) - { - int var4 = this.getComponentType(); - - switch (this.corridorDirection) - { - case 0: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 1, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 3, var4); - break; - - case 1: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 1, var4); - break; - - case 2: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 1, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 3, var4); - break; - - case 3: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 3, var4); - } - - if (this.isMultipleFloors) - { - if (par3Random.nextBoolean()) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ - 1, 2, var4); - } - - if (par3Random.nextBoolean()) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ + 1, 1, var4); - } - - if (par3Random.nextBoolean()) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ + 1, 3, var4); - } - - if (par3Random.nextBoolean()) - { - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.maxZ + 1, 0, var4); - } - } - } - - /** - * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at - * the end, it adds Fences... - */ - public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) - { - if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox) || this.isStructureBoundingBoxEmpty(par1World, par3StructureBoundingBox)) - { - return false; - } - else - { - if (this.isMultipleFloors) - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.minY + 3 - 1, this.boundingBox.maxZ, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.minY + 3 - 1, this.boundingBox.maxZ - 1, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.maxY - 2, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.maxY - 2, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ - 1, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY + 3, this.boundingBox.minZ + 1, this.boundingBox.maxX - 1, this.boundingBox.minY + 3, this.boundingBox.maxZ - 1, 0, 0, false); - } - else - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ - 1, 0, 0, false); - } - - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.minX + 1, this.boundingBox.maxY, this.boundingBox.minZ + 1, Block.planks.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 1, this.boundingBox.minX + 1, this.boundingBox.maxY, this.boundingBox.maxZ - 1, Block.planks.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.maxX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.minZ + 1, Block.planks.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.maxX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 1, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ - 1, Block.planks.blockID, 0, false); - - for (int var4 = this.boundingBox.minX; var4 <= this.boundingBox.maxX; ++var4) - { - for (int var5 = this.boundingBox.minZ; var5 <= this.boundingBox.maxZ; ++var5) - { - int var6 = this.getBlockIdAtCurrentPosition(par1World, var4, this.boundingBox.minY - 1, var5, par3StructureBoundingBox); - - if (var6 == 0) - { - this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, var4, this.boundingBox.minY - 1, var5, par3StructureBoundingBox); - } - } - } - - return true; - } - } -} diff --git a/minecraft_server/betterterrain/structure/component/BTAComponentMineshaftStairs.java b/minecraft_server/betterterrain/structure/component/BTAComponentMineshaftStairs.java deleted file mode 100644 index c52b7ec..0000000 --- a/minecraft_server/betterterrain/structure/component/BTAComponentMineshaftStairs.java +++ /dev/null @@ -1,101 +0,0 @@ -package betterterrain.structure.component; - -import java.util.List; -import java.util.Random; - -import betterterrain.structure.BTAStructureMineshaftPieces; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureComponent; -import net.minecraft.src.World; - -public class BTAComponentMineshaftStairs extends StructureComponent -{ - public BTAComponentMineshaftStairs(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) - { - super(par1); - this.coordBaseMode = par4; - this.boundingBox = par3StructureBoundingBox; - } - - /** - * Trys to find a valid place to put this component. - */ - public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5) - { - StructureBoundingBox var6 = new StructureBoundingBox(par2, par3 - 5, par4, par2, par3 + 2, par4); - - switch (par5) - { - case 0: - var6.maxX = par2 + 2; - var6.maxZ = par4 + 8; - break; - - case 1: - var6.minX = par2 - 8; - var6.maxZ = par4 + 2; - break; - - case 2: - var6.maxX = par2 + 2; - var6.minZ = par4 - 8; - break; - - case 3: - var6.maxX = par2 + 8; - var6.maxZ = par4 + 2; - } - - return StructureComponent.findIntersecting(par0List, var6) != null ? null : var6; - } - - /** - * Initiates construction of the Structure Component picked, at the current Location of StructGen - */ - public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) - { - int var4 = this.getComponentType(); - - switch (this.coordBaseMode) - { - case 0: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); - break; - - case 1: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, 1, var4); - break; - - case 2: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); - break; - - case 3: - BTAStructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, 3, var4); - } - } - - /** - * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at - * the end, it adds Fences... - */ - public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) - { - if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) - { - return false; - } - else - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 2, 7, 1, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 7, 2, 2, 8, 0, 0, false); - - for (int var4 = 0; var4 < 5; ++var4) - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5 - var4 - (var4 < 4 ? 1 : 0), 2 + var4, 2, 7 - var4, 2 + var4, 0, 0, false); - } - - return true; - } - } -} diff --git a/minecraft_server/betterterrain/structure/component/BTAComponentScatteredFeatureRedDesertPyramid.java b/minecraft_server/betterterrain/structure/component/BTAComponentScatteredFeatureRedDesertPyramid.java deleted file mode 100644 index c5cecdc..0000000 --- a/minecraft_server/betterterrain/structure/component/BTAComponentScatteredFeatureRedDesertPyramid.java +++ /dev/null @@ -1,263 +0,0 @@ -package betterterrain.structure.component; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import net.minecraft.src.Block; -import net.minecraft.src.ComponentScatteredFeature; -import net.minecraft.src.Direction; -import net.minecraft.src.FCBetterThanWolves; -import net.minecraft.src.FCUtilsHardcoreSpawn; -import net.minecraft.src.Item; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.WeightedRandomChestContent; -import net.minecraft.src.World; - -public class BTAComponentScatteredFeatureRedDesertPyramid extends ComponentScatteredFeature -{ - private boolean[] field_74940_h = new boolean[4]; - private static final WeightedRandomChestContent[] m_LootListArray = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.helmetGold.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.plateGold.itemID, 0, 1, 1, 2), new WeightedRandomChestContent(Item.legsGold.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.bootsGold.itemID, 0, 1, 1, 2), new WeightedRandomChestContent(Item.swordGold.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.emerald.itemID, 0, 1, 5, 15), new WeightedRandomChestContent(Item.bone.itemID, 0, 4, 6, 20), new WeightedRandomChestContent(Item.rottenFlesh.itemID, 0, 3, 7, 11), new WeightedRandomChestContent(Item.skull.itemID, 0, 1, 1, 5)}; - private static final WeightedRandomChestContent[] m_LootedLootListArray = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.bone.itemID, 0, 4, 6, 20), new WeightedRandomChestContent(Item.rottenFlesh.itemID, 0, 3, 7, 11), new WeightedRandomChestContent(Item.skull.itemID, 0, 1, 1, 5)}; - - public BTAComponentScatteredFeatureRedDesertPyramid(Random par1Random, int par2, int par3) - { - super(par1Random, par2, 64, par3, 21, 15, 21); - } - - /** - * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at - * the end, it adds Fences... - */ - public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) - { - boolean var4 = FCUtilsHardcoreSpawn.IsInLootedTempleRadius(par1World, par3StructureBoundingBox.getCenterX(), par3StructureBoundingBox.getCenterZ()); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, -4, 0, this.scatteredFeatureSizeX - 1, 0, this.scatteredFeatureSizeZ - 1, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - int var5; - - for (var5 = 1; var5 <= 9; ++var5) - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, var5, var5, var5, this.scatteredFeatureSizeX - 1 - var5, var5, this.scatteredFeatureSizeZ - 1 - var5, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, var5 + 1, var5, var5 + 1, this.scatteredFeatureSizeX - 2 - var5, var5, this.scatteredFeatureSizeZ - 2 - var5, 0, 0, false); - } - - int var6; - - for (var5 = 0; var5 < this.scatteredFeatureSizeX; ++var5) - { - for (var6 = 0; var6 < this.scatteredFeatureSizeZ; ++var6) - { - this.fillCurrentPositionBlocksDownwards(par1World, DecoIntegration.redSandStone.blockID, 0, var5, -5, var6, par3StructureBoundingBox); - } - } - - var5 = this.getMetadataWithOffset(DecoIntegration.redSandStoneStairs.blockID, 3); - var6 = this.getMetadataWithOffset(DecoIntegration.redSandStoneStairs.blockID, 2); - int var7 = this.getMetadataWithOffset(DecoIntegration.redSandStoneStairs.blockID, 0); - int var8 = this.getMetadataWithOffset(DecoIntegration.redSandStoneStairs.blockID, 1); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 9, 4, DecoIntegration.redSandStone.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 10, 1, 3, 10, 3, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, 2, 10, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var6, 2, 10, 4, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var7, 0, 10, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var8, 4, 10, 2, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 5, 0, 0, this.scatteredFeatureSizeX - 1, 9, 4, DecoIntegration.redSandStone.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 4, 10, 1, this.scatteredFeatureSizeX - 2, 10, 3, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, this.scatteredFeatureSizeX - 3, 10, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var6, this.scatteredFeatureSizeX - 3, 10, 4, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var7, this.scatteredFeatureSizeX - 5, 10, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var8, this.scatteredFeatureSizeX - 1, 10, 2, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 0, 0, 12, 4, 4, DecoIntegration.redSandStone.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 1, 0, 11, 3, 4, 0, 0, false); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 9, 1, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 9, 2, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 9, 3, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 10, 3, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 11, 3, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 11, 2, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 11, 1, 1, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 8, 3, 3, DecoIntegration.redSandStone.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 2, 8, 2, 2, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 1, 1, 16, 3, 3, DecoIntegration.redSandStone.blockID, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 1, 2, 16, 2, 2, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 4, 5, this.scatteredFeatureSizeX - 6, 4, this.scatteredFeatureSizeZ - 6, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 4, 9, 11, 4, 11, 0, 0, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, 1, 8, 8, 3, 8, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 12, 1, 8, 12, 3, 8, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, 1, 12, 8, 3, 12, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 12, 1, 12, 12, 3, 12, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 5, 4, 4, 11, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 5, 1, 5, this.scatteredFeatureSizeX - 2, 4, 11, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 7, 9, 6, 7, 11, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 7, 7, 9, this.scatteredFeatureSizeX - 7, 7, 11, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 5, 5, 9, 5, 7, 11, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 6, 5, 9, this.scatteredFeatureSizeX - 6, 7, 11, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 5, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 6, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 6, 6, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, this.scatteredFeatureSizeX - 6, 5, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, this.scatteredFeatureSizeX - 6, 6, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, this.scatteredFeatureSizeX - 7, 6, 10, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 4, 4, 2, 6, 4, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 3, 4, 4, this.scatteredFeatureSizeX - 3, 6, 4, 0, 0, false); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, 2, 4, 5, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, 2, 3, 4, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, this.scatteredFeatureSizeX - 3, 4, 5, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var5, this.scatteredFeatureSizeX - 3, 3, 4, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 3, 2, 2, 3, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 3, 1, 3, this.scatteredFeatureSizeX - 2, 2, 3, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, 0, 1, 1, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, 0, this.scatteredFeatureSizeX - 2, 1, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 1, 1, 2, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 1, this.scatteredFeatureSizeX - 2, 2, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var8, 2, 1, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStoneStairs.blockID, var7, this.scatteredFeatureSizeX - 3, 1, 2, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 5, 4, 3, 18, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 5, 3, 5, this.scatteredFeatureSizeX - 5, 3, 17, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 1, 5, 4, 2, 16, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 6, 1, 5, this.scatteredFeatureSizeX - 5, 2, 16, 0, 0, false); - int var9; - - for (var9 = 5; var9 <= 17; var9 += 2) - { - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 4, 1, var9, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 4, 2, var9, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, this.scatteredFeatureSizeX - 5, 1, var9, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, this.scatteredFeatureSizeX - 5, 2, var9, par3StructureBoundingBox); - } - - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 10, 0, 7, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 10, 0, 8, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 9, 0, 9, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 11, 0, 9, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 8, 0, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 12, 0, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 7, 0, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 13, 0, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 9, 0, 11, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 11, 0, 11, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 10, 0, 12, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 10, 0, 13, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 10, 0, 10, par3StructureBoundingBox); - - for (var9 = 0; var9 <= this.scatteredFeatureSizeX - 1; var9 += this.scatteredFeatureSizeX - 1) - { - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 2, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 2, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 2, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 3, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 3, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 3, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 4, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, var9, 4, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 4, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 5, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 5, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 5, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 6, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, var9, 6, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 6, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 7, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 7, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 7, 3, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 8, 1, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 8, 2, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 8, 3, par3StructureBoundingBox); - } - - for (var9 = 2; var9 <= this.scatteredFeatureSizeX - 3; var9 += this.scatteredFeatureSizeX - 3 - 2) - { - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 - 1, 2, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 2, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 + 1, 2, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 - 1, 3, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 3, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 + 1, 3, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 - 1, 4, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, var9, 4, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 + 1, 4, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 - 1, 5, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 5, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 + 1, 5, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 - 1, 6, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, var9, 6, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 + 1, 6, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 - 1, 7, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9, 7, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, var9 + 1, 7, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 - 1, 8, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9, 8, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, var9 + 1, 8, 0, par3StructureBoundingBox); - } - - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, 4, 0, 12, 6, 0, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 8, 6, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, 6, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 9, 5, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 10, 5, 0, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, Block.obsidian.blockID, 0, 11, 5, 0, par3StructureBoundingBox); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, -14, 8, 12, -11, 12, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, -10, 8, 12, -10, 12, DecoIntegration.redSandStone.blockID, 1, DecoIntegration.redSandStone.blockID, 1, false); - this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, -9, 8, 12, -9, 12, DecoIntegration.redSandStone.blockID, 2, DecoIntegration.redSandStone.blockID, 2, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, -8, 8, 12, -1, 12, DecoIntegration.redSandStone.blockID, DecoIntegration.redSandStone.blockID, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, -11, 9, 11, -1, 11, 0, 0, false); - this.placeBlockAtCurrentPosition(par1World, Block.pressurePlatePlanks.blockID, 0, 10, -11, 10, par3StructureBoundingBox); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, -13, 9, 11, -13, 11, Block.tnt.blockID, 0, false); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 8, -11, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 8, -10, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 7, -10, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 7, -11, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, -11, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, -10, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 13, -10, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 13, -11, 10, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -11, 8, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -10, 8, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 10, -10, 7, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 10, -11, 7, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -11, 12, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -10, 12, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 1, 10, -10, 13, par3StructureBoundingBox); - this.placeBlockAtCurrentPosition(par1World, DecoIntegration.redSandStone.blockID, 2, 10, -11, 13, par3StructureBoundingBox); - int var10; - int var11; - - for (var9 = 0; var9 < 4; ++var9) - { - if (!this.field_74940_h[var9]) - { - var10 = Direction.offsetX[var9] * 2; - var11 = Direction.offsetZ[var9] * 2; - WeightedRandomChestContent[] var12 = m_LootListArray; - int var13 = 2 + par2Random.nextInt(5); - - if (var4) - { - var12 = m_LootedLootListArray; - var13 /= 2; - } - - WeightedRandomChestContent[] var14 = WeightedRandomChestContent.func_92080_a(var12, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}); - this.field_74940_h[var9] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + var10, -11, 10 + var11, var14, var13); - } - } - - if (var4) - { - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 0, 9, 10, 0, 10, 0, 0, false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, -13, 9, 11, -11, 11, 0, 0, false); - var10 = this.getMetadataWithOffset(Block.ladder.blockID, 5); - var11 = FCBetterThanWolves.fcBlockLadder.SetFacing(0, var10); - - for (int var15 = -13; var15 <= 0; ++var15) - { - this.placeBlockAtCurrentPosition(par1World, FCBetterThanWolves.fcBlockLadder.blockID, var11, 9, var15, 9, par3StructureBoundingBox); - } - } - else - { - this.placeBlockAtCurrentPosition(par1World, Block.enchantmentTable.blockID, 0, 10, 1, 10, par3StructureBoundingBox); - } - - return true; - } -} diff --git a/minecraft_server/betterterrain/structure/mapgen/BTAMapGenBase.java b/minecraft_server/betterterrain/structure/mapgen/BTAMapGenBase.java deleted file mode 100644 index de27335..0000000 --- a/minecraft_server/betterterrain/structure/mapgen/BTAMapGenBase.java +++ /dev/null @@ -1,57 +0,0 @@ -package betterterrain.structure.mapgen; - -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.MapGenBase; -import net.minecraft.src.World; - -public class BTAMapGenBase extends MapGenBase { - public void generate(IChunkProvider par1IChunkProvider, World par2World, int par3, int par4, int[] blockArray) - { - int var6 = this.range; - this.worldObj = par2World; - this.rand.setSeed(par2World.getSeed()); - long var7 = this.rand.nextLong(); - long var9 = this.rand.nextLong(); - - for (int var11 = par3 - var6; var11 <= par3 + var6; ++var11) - { - for (int var12 = par4 - var6; var12 <= par4 + var6; ++var12) - { - long var13 = (long)var11 * var7; - long var15 = (long)var12 * var9; - this.rand.setSeed(var13 ^ var15 ^ par2World.getSeed()); - this.recursiveGenerate(par2World, var11, var12, par3, par4, blockArray); - } - } - } - - /** - * Recursively called by generate() (generate) and optionally by itself. - */ - protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, int[] blockArray) {} - - public void generate(IChunkProvider chunkProvider, World world, int x, int z, int[][][] blockArray) - { - int range = this.range; - this.worldObj = world; - this.rand.setSeed(world.getSeed()); - long seedBase1 = this.rand.nextLong(); - long seedBase2 = this.rand.nextLong(); - - for (int i = x - range; i <= x + range; ++i) - { - for (int k = z - range; k <= z + range; ++k) - { - long seed1 = (long)i * seedBase1; - long seed2 = (long)k * seedBase2; - this.rand.setSeed(seed1 ^ seed2 ^ world.getSeed()); - this.recursiveGenerate(world, i, k, x, z, blockArray); - } - } - } - - /** - * Recursively called by generate() (generate) and optionally by itself. - */ - protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, int[][][] blockArray) {} -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/structure/mapgen/BTAMapGenCavesHell.java b/minecraft_server/betterterrain/structure/mapgen/BTAMapGenCavesHell.java deleted file mode 100644 index 3558d9b..0000000 --- a/minecraft_server/betterterrain/structure/mapgen/BTAMapGenCavesHell.java +++ /dev/null @@ -1,232 +0,0 @@ -package betterterrain.structure.mapgen; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.MathHelper; -import net.minecraft.src.World; - -public class BTAMapGenCavesHell extends BTAMapGenBase -{ - /** - * Generates a larger initial cave node than usual. Called 25% of the time. - */ - protected void generateLargeCaveNode(long par1, int par3, int par4, int[] par5ArrayOfByte, double par6, double par8, double par10) - { - this.generateCaveNode(par1, par3, par4, par5ArrayOfByte, par6, par8, par10, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); - } - - /** - * Generates a node in the current cave system recursion tree. - */ - protected void generateCaveNode(long par1, int par3, int par4, int[] par5ArrayOfByte, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17) - { - double var19 = (double)(par3 * 16 + 8); - double var21 = (double)(par4 * 16 + 8); - float var23 = 0.0F; - float var24 = 0.0F; - Random var25 = new Random(par1); - - if (par16 <= 0) - { - int var26 = this.range * 16 - 16; - par16 = var26 - var25.nextInt(var26 / 4); - } - - boolean var53 = false; - - if (par15 == -1) - { - par15 = par16 / 2; - var53 = true; - } - - int var27 = var25.nextInt(par16 / 2) + par16 / 4; - - for (boolean var28 = var25.nextInt(6) == 0; par15 < par16; ++par15) - { - double var29 = 1.5D + (double)(MathHelper.sin((float)par15 * (float)Math.PI / (float)par16) * par12 * 1.0F); - double var31 = var29 * par17; - float var33 = MathHelper.cos(par14); - float var34 = MathHelper.sin(par14); - par6 += (double)(MathHelper.cos(par13) * var33); - par8 += (double)var34; - par10 += (double)(MathHelper.sin(par13) * var33); - - if (var28) - { - par14 *= 0.92F; - } - else - { - par14 *= 0.7F; - } - - par14 += var24 * 0.1F; - par13 += var23 * 0.1F; - var24 *= 0.9F; - var23 *= 0.75F; - var24 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 2.0F; - var23 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 4.0F; - - if (!var53 && par15 == var27 && par12 > 1.0F) - { - this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 - ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); - this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 + ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); - return; - } - - if (var53 || var25.nextInt(4) != 0) - { - double var35 = par6 - var19; - double var37 = par10 - var21; - double var39 = (double)(par16 - par15); - double var41 = (double)(par12 + 2.0F + 16.0F); - - if (var35 * var35 + var37 * var37 - var39 * var39 > var41 * var41) - { - return; - } - - if (par6 >= var19 - 16.0D - var29 * 2.0D && par10 >= var21 - 16.0D - var29 * 2.0D && par6 <= var19 + 16.0D + var29 * 2.0D && par10 <= var21 + 16.0D + var29 * 2.0D) - { - int var54 = MathHelper.floor_double(par6 - var29) - par3 * 16 - 1; - int var36 = MathHelper.floor_double(par6 + var29) - par3 * 16 + 1; - int var55 = MathHelper.floor_double(par8 - var31) - 1; - int var38 = MathHelper.floor_double(par8 + var31) + 1; - int var56 = MathHelper.floor_double(par10 - var29) - par4 * 16 - 1; - int var40 = MathHelper.floor_double(par10 + var29) - par4 * 16 + 1; - - if (var54 < 0) - { - var54 = 0; - } - - if (var36 > 16) - { - var36 = 16; - } - - if (var55 < 1) - { - var55 = 1; - } - - if (var38 > 120) - { - var38 = 120; - } - - if (var56 < 0) - { - var56 = 0; - } - - if (var40 > 16) - { - var40 = 16; - } - - boolean var57 = false; - int var42; - int var45; - - for (var42 = var54; !var57 && var42 < var36; ++var42) - { - for (int var43 = var56; !var57 && var43 < var40; ++var43) - { - for (int var44 = var38 + 1; !var57 && var44 >= var55 - 1; --var44) - { - var45 = (var42 * 16 + var43) * 128 + var44; - - if (var44 >= 0 && var44 < 128) - { - if (par5ArrayOfByte[var45] == Block.lavaMoving.blockID || par5ArrayOfByte[var45] == Block.lavaStill.blockID) - { - var57 = true; - } - - if (var44 != var55 - 1 && var42 != var54 && var42 != var36 - 1 && var43 != var56 && var43 != var40 - 1) - { - var44 = var55; - } - } - } - } - } - - if (!var57) - { - for (var42 = var54; var42 < var36; ++var42) - { - double var58 = ((double)(var42 + par3 * 16) + 0.5D - par6) / var29; - - for (var45 = var56; var45 < var40; ++var45) - { - double var46 = ((double)(var45 + par4 * 16) + 0.5D - par10) / var29; - int var48 = (var42 * 16 + var45) * 128 + var38; - - for (int var49 = var38 - 1; var49 >= var55; --var49) - { - double var50 = ((double)var49 + 0.5D - par8) / var31; - - if (var50 > -0.7D && var58 * var58 + var50 * var50 + var46 * var46 < 1.0D) - { - int var52 = par5ArrayOfByte[var48]; - - if (var52 == Block.netherrack.blockID || var52 == Block.dirt.blockID || var52 == Block.grass.blockID) - { - par5ArrayOfByte[var48] = 0; - } - } - - --var48; - } - } - } - - if (var53) - { - break; - } - } - } - } - } - } - - /** - * Recursively called by generate() (generate) and optionally by itself. - */ - protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, int[] par6ArrayOfByte) - { - int var7 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(10) + 1) + 1); - - if (this.rand.nextInt(5) != 0) - { - var7 = 0; - } - - for (int var8 = 0; var8 < var7; ++var8) - { - double var9 = (double)(par2 * 16 + this.rand.nextInt(16)); - double var11 = (double)this.rand.nextInt(128); - double var13 = (double)(par3 * 16 + this.rand.nextInt(16)); - int var15 = 1; - - if (this.rand.nextInt(4) == 0) - { - this.generateLargeCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13); - var15 += this.rand.nextInt(4); - } - - for (int var16 = 0; var16 < var15; ++var16) - { - float var17 = this.rand.nextFloat() * (float)Math.PI * 2.0F; - float var18 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; - float var19 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat(); - this.generateCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13, var19 * 2.0F, var17, var18, 0, 0, 0.5D); - } - } - } -} diff --git a/minecraft_server/betterterrain/structure/mapgen/BTAMapGenMineshaft.java b/minecraft_server/betterterrain/structure/mapgen/BTAMapGenMineshaft.java deleted file mode 100644 index 58ef80c..0000000 --- a/minecraft_server/betterterrain/structure/mapgen/BTAMapGenMineshaft.java +++ /dev/null @@ -1,41 +0,0 @@ -package betterterrain.structure.mapgen; - -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - -import net.minecraft.src.MathHelper; -import net.minecraft.src.StructureMineshaftStart; -import net.minecraft.src.StructureStart; - -public class BTAMapGenMineshaft extends BTAMapGenStructure -{ - private double field_82673_e = 0.01D; - - public BTAMapGenMineshaft() {} - - public BTAMapGenMineshaft(Map par1Map) - { - Iterator var2 = par1Map.entrySet().iterator(); - - while (var2.hasNext()) - { - Entry var3 = (Entry)var2.next(); - - if (((String)var3.getKey()).equals("chance")) - { - this.field_82673_e = MathHelper.parseDoubleWithDefault((String)var3.getValue(), this.field_82673_e); - } - } - } - - public boolean canSpawnStructureAtCoords(int par1, int par2) - { - return this.rand.nextDouble() < this.field_82673_e && this.rand.nextInt(80) < Math.max(Math.abs(par1), Math.abs(par2)); - } - - protected StructureStart getStructureStart(int par1, int par2) - { - return new StructureMineshaftStart(this.worldObj, this.rand, par1, par2); - } -} diff --git a/minecraft_server/betterterrain/structure/mapgen/BTAMapGenStructure.java b/minecraft_server/betterterrain/structure/mapgen/BTAMapGenStructure.java deleted file mode 100644 index 4a67b76..0000000 --- a/minecraft_server/betterterrain/structure/mapgen/BTAMapGenStructure.java +++ /dev/null @@ -1,205 +0,0 @@ -package betterterrain.structure.mapgen; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import betterterrain.structure.callable.BTACallableChunkPosHash; -import betterterrain.structure.callable.BTACallableIsFeatureChunk; -import betterterrain.structure.callable.BTACallableStructureType; -import net.minecraft.src.ChunkCoordIntPair; -import net.minecraft.src.ChunkPosition; -import net.minecraft.src.CrashReport; -import net.minecraft.src.CrashReportCategory; -import net.minecraft.src.ReportedException; -import net.minecraft.src.StructureBoundingBox; -import net.minecraft.src.StructureComponent; -import net.minecraft.src.StructureStart; -import net.minecraft.src.World; - -public abstract class BTAMapGenStructure extends BTAMapGenBase -{ - /** - * Used to store a list of all structures that have been recursively generated. Used so that during recursive - * generation, the structure generator can avoid generating structures that intersect ones that have already been - * placed. - */ - protected Map structureMap = new HashMap(); - - /** - * Recursively called by generate() (generate) and optionally by itself. - */ - @Override - protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, int[] blockArray) - { - if (!this.structureMap.containsKey(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par2, par3)))) - { - this.rand.nextInt(); - - try - { - if (this.canSpawnStructureAtCoords(par2, par3)) - { - StructureStart var7 = this.getStructureStart(par2, par3); - this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par2, par3)), var7); - } - } - catch (Throwable var10) - { - CrashReport var8 = CrashReport.makeCrashReport(var10, "Exception preparing structure feature"); - CrashReportCategory var9 = var8.makeCategory("Feature being prepared"); - var9.addCrashSectionCallable("Is feature chunk", new BTACallableIsFeatureChunk(this, par2, par3)); - var9.addCrashSection("Chunk location", String.format("%d,%d", new Object[] {Integer.valueOf(par2), Integer.valueOf(par3)})); - var9.addCrashSectionCallable("Chunk pos hash", new BTACallableChunkPosHash(this, par2, par3)); - var9.addCrashSectionCallable("Structure type", new BTACallableStructureType(this)); - throw new ReportedException(var8); - } - } - } - - /** - * Generates structures in specified chunk next to existing structures. Does *not* generate StructureStarts. - */ - public boolean generateStructuresInChunk(World par1World, Random par2Random, int par3, int par4) - { - int var5 = (par3 << 4) + 8; - int var6 = (par4 << 4) + 8; - boolean var7 = false; - Iterator var8 = this.structureMap.values().iterator(); - - while (var8.hasNext()) - { - StructureStart var9 = (StructureStart)var8.next(); - - if (var9.isSizeableStructure() && var9.getBoundingBox().intersectsWith(var5, var6, var5 + 15, var6 + 15)) - { - var9.generateStructure(par1World, par2Random, new StructureBoundingBox(var5, var6, var5 + 15, var6 + 15)); - var7 = true; - } - } - - return var7; - } - - /** - * Returns true if the structure generator has generated a structure located at the given position tuple. - */ - public boolean hasStructureAt(int par1, int par2, int par3) - { - Iterator var4 = this.structureMap.values().iterator(); - - while (var4.hasNext()) - { - StructureStart var5 = (StructureStart)var4.next(); - - if (var5.isSizeableStructure() && var5.getBoundingBox().intersectsWith(par1, par3, par1, par3)) - { - Iterator var6 = var5.getComponents().iterator(); - - while (var6.hasNext()) - { - StructureComponent var7 = (StructureComponent)var6.next(); - - if (var7.getBoundingBox().isVecInside(par1, par2, par3)) - { - return true; - } - } - } - } - - return false; - } - - public ChunkPosition getNearestInstance(World par1World, int par2, int par3, int par4) - { - this.worldObj = par1World; - this.rand.setSeed(par1World.getSeed()); - long var5 = this.rand.nextLong(); - long var7 = this.rand.nextLong(); - long var9 = (long)(par2 >> 4) * var5; - long var11 = (long)(par4 >> 4) * var7; - this.rand.setSeed(var9 ^ var11 ^ par1World.getSeed()); - this.recursiveGenerate(par1World, par2 >> 4, par4 >> 4, 0, 0, (byte[])null); - double var13 = Double.MAX_VALUE; - ChunkPosition var15 = null; - Iterator var16 = this.structureMap.values().iterator(); - ChunkPosition var19; - int var20; - int var21; - int var22; - double var23; - - while (var16.hasNext()) - { - StructureStart var17 = (StructureStart)var16.next(); - - if (var17.isSizeableStructure()) - { - StructureComponent var18 = (StructureComponent)var17.getComponents().get(0); - var19 = var18.getCenter(); - var20 = var19.x - par2; - var21 = var19.y - par3; - var22 = var19.z - par4; - var23 = (double)(var20 + var20 * var21 * var21 + var22 * var22); - - if (var23 < var13) - { - var13 = var23; - var15 = var19; - } - } - } - - if (var15 != null) - { - return var15; - } - else - { - List var25 = this.getCoordList(); - - if (var25 != null) - { - ChunkPosition var26 = null; - Iterator var27 = var25.iterator(); - - while (var27.hasNext()) - { - var19 = (ChunkPosition)var27.next(); - var20 = var19.x - par2; - var21 = var19.y - par3; - var22 = var19.z - par4; - var23 = (double)(var20 + var20 * var21 * var21 + var22 * var22); - - if (var23 < var13) - { - var13 = var23; - var26 = var19; - } - } - - return var26; - } - else - { - return null; - } - } - } - - /** - * Returns a list of other locations at which the structure generation has been run, or null if not relevant to this - * structure generator. - */ - protected List getCoordList() - { - return null; - } - - public abstract boolean canSpawnStructureAtCoords(int var1, int var2); - - protected abstract StructureStart getStructureStart(int var1, int var2); -} diff --git a/minecraft_server/betterterrain/world/BTAChunk.java b/minecraft_server/betterterrain/world/BTAChunk.java deleted file mode 100644 index 93ba2a7..0000000 --- a/minecraft_server/betterterrain/world/BTAChunk.java +++ /dev/null @@ -1,123 +0,0 @@ -package betterterrain.world; - -import java.lang.reflect.Field; -import java.util.Map; - -import net.minecraft.src.Chunk; -import net.minecraft.src.ExtendedBlockStorage; -import net.minecraft.src.World; - -public class BTAChunk extends Chunk { - public BTAChunk(World par1World, int[] blockArray, int par3, int par4) { - super(par1World, par3, par4); - int var5 = blockArray.length / 256; - - for (int var6 = 0; var6 < 16; ++var6) - { - for (int var7 = 0; var7 < 16; ++var7) - { - for (int var8 = 0; var8 < var5; ++var8) - { - int var9 = blockArray[var6 << 11 | var7 << 7 | var8]; - - if (var9 != 0) - { - int var10 = var8 >> 4; - - if (getBlockStorageArray()[var10] == null) - { - getBlockStorageArray()[var10] = new ExtendedBlockStorage(var10 << 4, !par1World.provider.hasNoSky); - } - - getBlockStorageArray()[var10].setExtBlockID(var6, var8 & 15, var7, var9); - } - } - } - } - } - public BTAChunk(World par1World, int[] blockArray, int[] metaArray, int par3, int par4) { - super(par1World, par3, par4); - int var5 = blockArray.length / 256; - - for (int i = 0; i < 16; ++i) - { - for (int k = 0; k < 16; ++k) - { - for (int j = 0; j < var5; ++j) - { - int blockID = blockArray[i << 11 | k << 7 | j]; - int meta = metaArray[i << 11 | k << 7 | j]; - - if (blockID != 0) - { - int var10 = j >> 4; - - if (getBlockStorageArray()[var10] == null) - { - getBlockStorageArray()[var10] = new ExtendedBlockStorage(var10 << 4, !par1World.provider.hasNoSky); - } - - getBlockStorageArray()[var10].setExtBlockID(i, j & 15, k, blockID); - getBlockStorageArray()[var10].setExtBlockMetadata(i, j & 15, k, meta); - } - } - } - } - } - - public BTAChunk(World world, int[][][] blockArray, int chunkX, int chunkZ) { - super(world, chunkX, chunkZ); - - for (int i = 0; i < 16; ++i) - { - for (int k = 0; k < 16; ++k) - { - for (int j = 0; j < 256; ++j) - { - int blockID = blockArray[i][k][j]; - - if (blockID != 0) - { - int extIndex = j >> 4; - - if (getBlockStorageArray()[extIndex] == null) - { - getBlockStorageArray()[extIndex] = new ExtendedBlockStorage(extIndex << 4, !world.provider.hasNoSky); - } - - getBlockStorageArray()[extIndex].setExtBlockID(i, j & 15, k, blockID); - } - } - } - } - } - - public BTAChunk(World world, int[][][] blockArray, int[][][] metaArray, int chunkX, int chunkZ) { - super(world, chunkX, chunkZ); - - for (int i = 0; i < 16; ++i) - { - for (int k = 0; k < 16; ++k) - { - for (int j = 0; j < 256; ++j) - { - int blockID = blockArray[i][k][j]; - int meta = metaArray[i][k][j]; - - if (blockID != 0) - { - int extIndex = j >> 4; - - if (getBlockStorageArray()[extIndex] == null) - { - getBlockStorageArray()[extIndex] = new ExtendedBlockStorage(extIndex << 4, !world.provider.hasNoSky); - } - - getBlockStorageArray()[extIndex].setExtBlockID(i, j & 15, k, blockID); - getBlockStorageArray()[extIndex].setExtBlockMetadata(i, j & 15, k, meta); - } - } - } - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/BTAWorldChunkManager.java b/minecraft_server/betterterrain/world/BTAWorldChunkManager.java deleted file mode 100644 index 0431cdc..0000000 --- a/minecraft_server/betterterrain/world/BTAWorldChunkManager.java +++ /dev/null @@ -1,297 +0,0 @@ -package betterterrain.world; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.biome.layer.BTALayer; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.BiomeCache; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.ChunkPosition; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; -import net.minecraft.src.World; -import net.minecraft.src.WorldChunkManager; - -public class BTAWorldChunkManager extends WorldChunkManager { - private GenLayer genBiomes; - - /** A GenLayer containing the indices into BiomeGenBase.biomeList[] */ - private GenLayer biomeIndexLayer; - - /** The BiomeCache object for this world. */ - private BiomeCache biomeCache; - - /** A list of biomes that the player can spawn in. */ - private List biomesToSpawnIn; - - private World world; - - public BTAWorldChunkManager(WorldConfigurationInfo generatorInfo) { - this.biomeCache = new BiomeCache(this); - this.biomesToSpawnIn = new ArrayList(); - - for (BTABiome b : BiomeConfiguration.getBiomeList()) { - if (b.isSpawnable()) { - biomesToSpawnIn.add(b); - } - } - } - - public BTAWorldChunkManager(World world, WorldConfigurationInfo generatorInfo) { - this(generatorInfo); - this.world = world; - GenLayer[] layers = BTALayer.initializeAllBiomeGenerators(world.getSeed(), world.getWorldInfo().getTerrainType(), generatorInfo); - this.genBiomes = layers[0]; - this.biomeIndexLayer = layers[1]; - } - - /** - * Gets the list of valid biomes for the player to spawn in. - */ - public List getBiomesToSpawnIn() - { - return this.biomesToSpawnIn; - } - - /** - * Returns the BiomeGenBase related to the x, z position on the world. - */ - public BiomeGenBase getBiomeGenAt(int par1, int par2) - { - return this.biomeCache.getBiomeGenAt(par1, par2); - } - - /** - * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length. - */ - public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) - { - IntCache.resetIntCache(); - - if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) - { - par1ArrayOfFloat = new float[par4 * par5]; - } - - int[] var6 = this.biomeIndexLayer.getInts(par2, par3, par4, par5); - - for (int var7 = 0; var7 < par4 * par5; ++var7) - { - float var8 = (float)BiomeGenBase.biomeList[var6[var7]].getIntRainfall() / 65536.0F; - - if (var8 > 1.0F) - { - var8 = 1.0F; - } - - par1ArrayOfFloat[var7] = var8; - } - - return par1ArrayOfFloat; - } - - /** - * Return an adjusted version of a given temperature based on the y height - */ - public float getTemperatureAtHeight(float par1, int par2) - { - return par1; - } - - /** - * Returns a list of temperatures to use for the specified blocks. Args: listToReuse, x, y, width, length - */ - public float[] getTemperatures(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) - { - IntCache.resetIntCache(); - - if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) - { - par1ArrayOfFloat = new float[par4 * par5]; - } - - int[] var6 = this.biomeIndexLayer.getInts(par2, par3, par4, par5); - - for (int var7 = 0; var7 < par4 * par5; ++var7) - { - float var8 = (float)BiomeGenBase.biomeList[var6[var7]].getIntTemperature() / 65536.0F; - - if (var8 > 1.0F) - { - var8 = 1.0F; - } - - par1ArrayOfFloat[var7] = var8; - } - - return par1ArrayOfFloat; - } - - /** - * Returns an array of biomes for the location input. - */ - public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) - { - IntCache.resetIntCache(); - - if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) - { - par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; - } - - int[] var6 = this.genBiomes.getInts(par2, par3, par4, par5); - - for (int var7 = 0; var7 < par4 * par5; ++var7) - { - par1ArrayOfBiomeGenBase[var7] = BiomeGenBase.biomeList[var6[var7]]; - } - - return par1ArrayOfBiomeGenBase; - } - - /** - * Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the - * WorldChunkManager Args: oldBiomeList, x, z, width, depth - */ - public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) - { - return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true); - } - - /** - * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false, - * don't check biomeCache to avoid infinite loop in BiomeCacheBlock) - */ - public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6) - { - IntCache.resetIntCache(); - - if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) - { - par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; - } - - if (par6 && par4 == 16 && par5 == 16 && (par2 & 15) == 0 && (par3 & 15) == 0) - { - BiomeGenBase[] var9 = this.biomeCache.getCachedBiomes(par2, par3); - System.arraycopy(var9, 0, par1ArrayOfBiomeGenBase, 0, par4 * par5); - return par1ArrayOfBiomeGenBase; - } - else - { - int[] var7 = this.biomeIndexLayer.getInts(par2, par3, par4, par5); - - for (int var8 = 0; var8 < par4 * par5; ++var8) - { - par1ArrayOfBiomeGenBase[var8] = BiomeGenBase.biomeList[var7[var8]]; - } - - return par1ArrayOfBiomeGenBase; - } - } - - /** - * checks given Chunk's Biomes against List of allowed ones - */ - public boolean areBiomesViable(int par1, int par2, int par3, List par4List) - { - IntCache.resetIntCache(); - int var5 = par1 - par3 >> 2; - int var6 = par2 - par3 >> 2; - int var7 = par1 + par3 >> 2; - int var8 = par2 + par3 >> 2; - int var9 = var7 - var5 + 1; - int var10 = var8 - var6 + 1; - int[] var11 = this.genBiomes.getInts(var5, var6, var9, var10); - - for (int var12 = 0; var12 < var9 * var10; ++var12) - { - BiomeGenBase var13 = BiomeGenBase.biomeList[var11[var12]]; - - if (!par4List.contains(var13)) - { - return false; - } - } - - return true; - } - - /** - * Finds a valid position within a range, that is in one of the listed biomes. Searches {par1,par2} +-par3 blocks. - * Strongly favors positive y positions. - */ - public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random) - { - IntCache.resetIntCache(); - int var6 = par1 - par3 >> 2; - int var7 = par2 - par3 >> 2; - int var8 = par1 + par3 >> 2; - int var9 = par2 + par3 >> 2; - int var10 = var8 - var6 + 1; - int var11 = var9 - var7 + 1; - int[] var12 = this.genBiomes.getInts(var6, var7, var10, var11); - ChunkPosition var13 = null; - int var14 = 0; - - for (int var15 = 0; var15 < var10 * var11; ++var15) - { - int var16 = var6 + var15 % var10 << 2; - int var17 = var7 + var15 / var10 << 2; - BiomeGenBase var18 = BiomeGenBase.biomeList[var12[var15]]; - - if (par4List.contains(var18) && (var13 == null || par5Random.nextInt(var14 + 1) == 0)) - { - var13 = new ChunkPosition(var16, 0, var17); - ++var14; - } - } - - return var13; - } - - /** - * Finds a valid position within a range, that is in one of the listed biomes. Searches {par1,par2} +-par3 blocks. - * Strongly favors positive y positions. - */ - public ChunkPosition findBiomePositionForStronghold(int par1, int par2, int par3, Random par5Random) - { - IntCache.resetIntCache(); - int var6 = par1 - par3 >> 2; - int var7 = par2 - par3 >> 2; - int var8 = par1 + par3 >> 2; - int var9 = par2 + par3 >> 2; - int var10 = var8 - var6 + 1; - int var11 = var9 - var7 + 1; - int[] var12 = this.genBiomes.getInts(var6, var7, var10, var11); - ChunkPosition var13 = null; - int var14 = 0; - - for (int var15 = 0; var15 < var10 * var11; ++var15) - { - int var16 = var6 + var15 % var10 << 2; - int var17 = var7 + var15 / var10 << 2; - BiomeGenBase var18 = BiomeGenBase.biomeList[var12[var15]]; - - if (BiomeConfiguration.canBiomeSpawnStronghold(var18) && (var13 == null || par5Random.nextInt(var14 + 1) == 0)) - { - var13 = new ChunkPosition(var16, 0, var17); - ++var14; - } - } - - return var13; - } - - /** - * Calls the WorldChunkManager's biomeCache.cleanupCache() - */ - public void cleanupCache() - { - this.biomeCache.cleanupCache(); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/BetaChunkManager.java b/minecraft_server/betterterrain/world/BetaChunkManager.java deleted file mode 100644 index ca67360..0000000 --- a/minecraft_server/betterterrain/world/BetaChunkManager.java +++ /dev/null @@ -1,300 +0,0 @@ -package betterterrain.world; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.biome.layer.BTALayer; -import betterterrain.world.config.WorldConfigurationInfo; -import net.minecraft.src.BiomeCache; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.ChunkPosition; -import net.minecraft.src.GenLayer; -import net.minecraft.src.IntCache; -import net.minecraft.src.World; -import net.minecraft.src.WorldType; - -public class BetaChunkManager extends BTAWorldChunkManager { - private GenLayer genBiomes; - - /** A GenLayer containing the indices into BiomeGenBase.biomeList[] */ - private GenLayer biomeIndexLayer; - - /** The BiomeCache object for this world. */ - private BiomeCache biomeCache; - - /** A list of biomes that the player can spawn in. */ - private List biomesToSpawnIn; - - public BetaChunkManager(WorldConfigurationInfo generatorInfo) { - super(generatorInfo); - this.biomeCache = new BiomeCache(this); - this.biomesToSpawnIn = new ArrayList(); - - for (BTABiome b : BiomeConfiguration.getBiomeList()) { - if (b.isSpawnable()) { - biomesToSpawnIn.add(b); - } - } - } - - public BetaChunkManager(long seed, WorldType worldType, WorldConfigurationInfo generatorInfo) { - this(generatorInfo); - generatorInfo.setOceanSize(1); - GenLayer[] layers = BTALayer.initializeAllBiomeGenerators(seed, worldType, generatorInfo); - this.genBiomes = layers[0]; - this.biomeIndexLayer = layers[1]; - } - - public BetaChunkManager(World par1World, WorldConfigurationInfo generatorInfo) { - this(par1World.getSeed(), par1World.getWorldInfo().getTerrainType(), generatorInfo); - } - - /** - * Gets the list of valid biomes for the player to spawn in. - */ - public List getBiomesToSpawnIn() - { - return this.biomesToSpawnIn; - } - - /** - * Returns the BiomeGenBase related to the x, z position on the world. - */ - public BiomeGenBase getBiomeGenAt(int par1, int par2) - { - return this.biomeCache.getBiomeGenAt(par1, par2); - } - - /** - * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length. - */ - public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) - { - IntCache.resetIntCache(); - - if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) - { - par1ArrayOfFloat = new float[par4 * par5]; - } - - int[] var6 = this.biomeIndexLayer.getInts(par2, par3, par4, par5); - - for (int var7 = 0; var7 < par4 * par5; ++var7) - { - float var8 = (float)BiomeGenBase.biomeList[var6[var7]].getIntRainfall() / 65536.0F; - - if (var8 > 1.0F) - { - var8 = 1.0F; - } - - par1ArrayOfFloat[var7] = var8; - } - - return par1ArrayOfFloat; - } - - /** - * Return an adjusted version of a given temperature based on the y height - */ - public float getTemperatureAtHeight(float par1, int par2) - { - return par1; - } - - /** - * Returns a list of temperatures to use for the specified blocks. Args: listToReuse, x, y, width, length - */ - public float[] getTemperatures(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) - { - IntCache.resetIntCache(); - - if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) - { - par1ArrayOfFloat = new float[par4 * par5]; - } - - int[] var6 = this.biomeIndexLayer.getInts(par2, par3, par4, par5); - - for (int var7 = 0; var7 < par4 * par5; ++var7) - { - float var8 = (float)BiomeGenBase.biomeList[var6[var7]].getIntTemperature() / 65536.0F; - - if (var8 > 1.0F) - { - var8 = 1.0F; - } - - par1ArrayOfFloat[var7] = var8; - } - - return par1ArrayOfFloat; - } - - /** - * Returns an array of biomes for the location input. - */ - public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) - { - IntCache.resetIntCache(); - - if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) - { - par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; - } - - int[] var6 = this.genBiomes.getInts(par2, par3, par4, par5); - - for (int var7 = 0; var7 < par4 * par5; ++var7) - { - par1ArrayOfBiomeGenBase[var7] = BiomeGenBase.biomeList[var6[var7]]; - } - - return par1ArrayOfBiomeGenBase; - } - - /** - * Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the - * WorldChunkManager Args: oldBiomeList, x, z, width, depth - */ - public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) - { - return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true); - } - - /** - * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false, - * don't check biomeCache to avoid infinite loop in BiomeCacheBlock) - */ - public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6) - { - IntCache.resetIntCache(); - - if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) - { - par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; - } - - if (par6 && par4 == 16 && par5 == 16 && (par2 & 15) == 0 && (par3 & 15) == 0) - { - BiomeGenBase[] var9 = this.biomeCache.getCachedBiomes(par2, par3); - System.arraycopy(var9, 0, par1ArrayOfBiomeGenBase, 0, par4 * par5); - return par1ArrayOfBiomeGenBase; - } - else - { - int[] var7 = this.biomeIndexLayer.getInts(par2, par3, par4, par5); - - for (int var8 = 0; var8 < par4 * par5; ++var8) - { - par1ArrayOfBiomeGenBase[var8] = BiomeGenBase.biomeList[var7[var8]]; - } - - return par1ArrayOfBiomeGenBase; - } - } - - /** - * checks given Chunk's Biomes against List of allowed ones - */ - public boolean areBiomesViable(int par1, int par2, int par3, List par4List) - { - IntCache.resetIntCache(); - int var5 = par1 - par3 >> 2; - int var6 = par2 - par3 >> 2; - int var7 = par1 + par3 >> 2; - int var8 = par2 + par3 >> 2; - int var9 = var7 - var5 + 1; - int var10 = var8 - var6 + 1; - int[] var11 = this.genBiomes.getInts(var5, var6, var9, var10); - - for (int var12 = 0; var12 < var9 * var10; ++var12) - { - BiomeGenBase var13 = BiomeGenBase.biomeList[var11[var12]]; - - if (!par4List.contains(var13)) - { - return false; - } - } - - return true; - } - - /** - * Finds a valid position within a range, that is in one of the listed biomes. Searches {par1,par2} +-par3 blocks. - * Strongly favors positive y positions. - */ - public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random) - { - IntCache.resetIntCache(); - int var6 = par1 - par3 >> 2; - int var7 = par2 - par3 >> 2; - int var8 = par1 + par3 >> 2; - int var9 = par2 + par3 >> 2; - int var10 = var8 - var6 + 1; - int var11 = var9 - var7 + 1; - int[] var12 = this.genBiomes.getInts(var6, var7, var10, var11); - ChunkPosition var13 = null; - int var14 = 0; - - for (int var15 = 0; var15 < var10 * var11; ++var15) - { - int var16 = var6 + var15 % var10 << 2; - int var17 = var7 + var15 / var10 << 2; - BiomeGenBase var18 = BiomeGenBase.biomeList[var12[var15]]; - - if (par4List.contains(var18) && (var13 == null || par5Random.nextInt(var14 + 1) == 0)) - { - var13 = new ChunkPosition(var16, 0, var17); - ++var14; - } - } - - return var13; - } - - /** - * Finds a valid position within a range, that is in one of the listed biomes. Searches {par1,par2} +-par3 blocks. - * Strongly favors positive y positions. - */ - public ChunkPosition findBiomePositionForStronghold(int par1, int par2, int par3, Random par5Random) - { - IntCache.resetIntCache(); - int var6 = par1 - par3 >> 2; - int var7 = par2 - par3 >> 2; - int var8 = par1 + par3 >> 2; - int var9 = par2 + par3 >> 2; - int var10 = var8 - var6 + 1; - int var11 = var9 - var7 + 1; - int[] var12 = this.genBiomes.getInts(var6, var7, var10, var11); - ChunkPosition var13 = null; - int var14 = 0; - - for (int var15 = 0; var15 < var10 * var11; ++var15) - { - int var16 = var6 + var15 % var10 << 2; - int var17 = var7 + var15 / var10 << 2; - BiomeGenBase var18 = BiomeGenBase.biomeList[var12[var15]]; - - if (BiomeConfiguration.canBiomeSpawnStronghold(var18) && (var13 == null || par5Random.nextInt(var14 + 1) == 0)) - { - var13 = new ChunkPosition(var16, 0, var17); - ++var14; - } - } - - return var13; - } - - /** - * Calls the WorldChunkManager's biomeCache.cleanupCache() - */ - public void cleanupCache() - { - this.biomeCache.cleanupCache(); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/NetherWorldChunkManager.java b/minecraft_server/betterterrain/world/NetherWorldChunkManager.java deleted file mode 100644 index 3345292..0000000 --- a/minecraft_server/betterterrain/world/NetherWorldChunkManager.java +++ /dev/null @@ -1,9 +0,0 @@ -package betterterrain.world; - -public class NetherWorldChunkManager { - - public NetherWorldChunkManager() { - - } - -} diff --git a/minecraft_server/betterterrain/world/config/WorldConfigurationInfoLegacy.java b/minecraft_server/betterterrain/world/config/WorldConfigurationInfoLegacy.java deleted file mode 100644 index 6a87570..0000000 --- a/minecraft_server/betterterrain/world/config/WorldConfigurationInfoLegacy.java +++ /dev/null @@ -1,293 +0,0 @@ -package betterterrain.world.config; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import betterterrain.BTAVersion; -import betterterrain.BTAMod; -import betterterrain.biome.BTABiome; -import betterterrain.biome.BiomeConfiguration; -import betterterrain.biome.BiomeInfo; -import betterterrain.world.generate.TerrainGenerator; -import net.minecraft.src.BiomeGenBase; - -public class WorldConfigurationInfoLegacy { - private ArrayList biomeInfoList = new ArrayList(); - private ArrayList biomesForGeneration = new ArrayList(); - - private BTAVersion btaVersion = BTAVersion.V1_1_3; - private int oceanSize = 10; - private boolean generatePerlinBeaches = false; - private boolean climatized = false; - private int biomeSize = 2; - private TerrainGenerator generator = TerrainGenerator.CLASSIC; - - /** - * Generates default configuration for worlds generated in BTA in 1.1.3 or earlier - */ - public static WorldConfigurationInfo createDefaultConfigurationLegacy(boolean isDeco) { - WorldConfigurationInfo info = new WorldConfigurationInfo(); - - info.setBTAVersion(BTAVersion.V1_1_3); - info.setOceanSize(10); - info.setGeneratePerlinBeaches(false); - info.setClimatized(false); - info.setBiomeSize(2); - info.setGenerator(TerrainGenerator.CLASSIC); - - info.generateBiomeInfoListFromBiomes(BiomeConfiguration.getBiomeList(), true, true); - - if (!isDeco) { - for (BiomeInfo b : info.getBiomeInfoList()) { - if (b.isDecoOnly()) { - b.setEnabled(false); - } - } - } - - info.setBiomesForGenerationFromInfo(info.getBiomeInfoList()); - - return info; - } - - public static WorldConfigurationInfo createInfoFromLegacy(WorldConfigurationInfoLegacy legacyInfo) { - WorldConfigurationInfo info = new WorldConfigurationInfo(); - - info.setBTAVersion(legacyInfo.btaVersion); - info.setOceanSize(legacyInfo.oceanSize); - info.setGeneratePerlinBeaches(legacyInfo.generatePerlinBeaches); - info.setClimatized(legacyInfo.climatized); - info.setBiomeSize(legacyInfo.biomeSize); - info.setGenerator(legacyInfo.generator); - info.setBiomesForGenerationFromInfo(legacyInfo.getBiomeInfoList()); - - return info; - } - - public static WorldConfigurationInfo createInfoFromString(String infoString) { - WorldConfigurationInfoLegacy legacyInfo = new WorldConfigurationInfoLegacy(); - legacyInfo.setInfoFromString(infoString); - - WorldConfigurationInfo info = createInfoFromLegacy(legacyInfo); - return info; - } - - private void setInfoFromString(String infoString) { - if (!infoString.contains(":")) { - this.setInfoFromStringLegacy(infoString); - } - else { - //Ignores whitespace - infoString = infoString.replace(" ", ""); - - String[] infoSplit = infoString.split(";"); - - for (String option : infoSplit) { - String[] optionSplit = option.split(":"); - - if (optionSplit[0].equalsIgnoreCase("Version")) { - this.btaVersion = BTAVersion.fromString(optionSplit[1]); - } - else if (optionSplit[0].equalsIgnoreCase("Biomes")){ - String[] biomeSplit = optionSplit[1].split(","); - - this.biomeInfoList.clear(); - - for (String s : biomeSplit) { - String[] biomeInfoSplit = s.split("="); - - BiomeInfo biomeInfo = BiomeConfiguration.getBiomeInfoMap().get(Integer.parseInt(biomeInfoSplit[0])); - biomeInfo.setEnabled(Boolean.parseBoolean(biomeInfoSplit[1])); - - this.biomeInfoList.add(biomeInfo); - } - - this.setBiomesForGenerationFromInfo(this.biomeInfoList); - } - else if (optionSplit[0].equalsIgnoreCase("OceanSize")) { - this.oceanSize = Integer.parseInt(optionSplit[1]); - } - else if (optionSplit[0].equalsIgnoreCase("Shorelines")) { - this.generatePerlinBeaches = Boolean.parseBoolean(optionSplit[1]); - } - else if (optionSplit[0].equalsIgnoreCase("BiomeSize")) { - this.biomeSize = Integer.parseInt(optionSplit[1]); - } - else if (optionSplit[0].equalsIgnoreCase("Climates")) { - this.climatized = Boolean.parseBoolean(optionSplit[1]); - } - else if (optionSplit[0].equalsIgnoreCase("Generator")) { - this.generator = TerrainGenerator.fromId(Integer.parseInt(optionSplit[1])); - } - else if (!optionSplit[0].equalsIgnoreCase("Nether")) { - throw new IllegalArgumentException("Invalid format for generator options"); - } - } - } - } - - /** - * Reads info string from BTA version 1.2.0 - */ - private void setInfoFromStringLegacy(String infoString) { - String[] infoSplit = infoString.split("; "); - String[] biomeSplit = infoSplit[0].split(" "); - - for (String s : biomeSplit) { - String[] biomeInfoSplit = s.split("="); - - BiomeInfo biomeInfo = BiomeConfiguration.getBiomeInfoMap().get(Integer.parseInt(biomeInfoSplit[0])); - biomeInfo.setEnabled(Boolean.parseBoolean(biomeInfoSplit[1])); - - this.biomeInfoList.add(biomeInfo); - } - - for (int i = 1; i < infoSplit.length; i++) { - if (i == 1) { - //Done this way for backwards compatibility with older standard - if (infoSplit[i].equals("true")) { - this.btaVersion = BTAVersion.V1_1_3; - } - else if (infoSplit[i].equals("false")) { - this.btaVersion = BTAVersion.V1_2_0; - } - else { - this.btaVersion = BTAVersion.fromString(infoSplit[i]); - } - } - if (i == 2) this.oceanSize = Integer.parseInt(infoSplit[i]); - if (i == 3) this.generatePerlinBeaches = Boolean.parseBoolean(infoSplit[i]); - } - - this.climatized = false; - this.biomeSize = 2; - - this.setBiomesForGenerationFromInfo(this.biomeInfoList); - } - - public String toString() { - String out = "Version:"; - out += this.btaVersion.toString() + ";"; - - out += "Biomes:"; - for (BiomeInfo b : this.biomeInfoList) { - out += b.toString() + ","; - } - out += ";"; - - out += "OceanSize:" + oceanSize + ";"; - out += "Shorelines:" + generatePerlinBeaches + ";"; - out += "BiomeSize:" + biomeSize + ";"; - out += "Climates:" + climatized + ";"; - out += "Generator:" + generator.id + ";"; - - return out; - } - - public void generateBiomeInfoListFromBiomes(ArrayList biomeList, boolean allowDeco, boolean legacyCompatibility) { - for (BTABiome b : biomeList) { - boolean addBiome = false; - - if (b.isDecoOnly()) { - if (allowDeco) { - addBiome = true; - } - } - else if (b.isLegacyCompatible() || !legacyCompatibility) { - addBiome = true; - } - - if (addBiome) { - this.biomeInfoList.add(BiomeConfiguration.getBiomeInfoMap().get(b.biomeID).copy().setEnabled(true)); - } - } - } - - public ArrayList getBiomeInfoList() { - return biomeInfoList; - } - - public void setBiomeInfoList(ArrayList biomeInfoList) { - this.biomeInfoList = biomeInfoList; - } - - public ArrayList getBiomesForGeneration() { - return biomesForGeneration; - } - - public WorldConfigurationInfoLegacy setBiomesForGeneration(ArrayList biomesForGeneration) { - this.biomesForGeneration = biomesForGeneration; - return this; - } - - public WorldConfigurationInfoLegacy setBiomesForGenerationFromInfo(ArrayList biomeInfoListToUse) { - if (this.biomesForGeneration == null) - this.biomesForGeneration = new ArrayList(); - - for (BiomeInfo b : biomeInfoListToUse) { - if (b.getEnabled()) { - this.biomesForGeneration.add((BTABiome) BiomeGenBase.biomeList[b.getID()]); - } - } - - return this; - } - - public BTAVersion getBTAVersion() { - return btaVersion; - } - - public void setBTAVersion(BTAVersion btaVersion) { - this.btaVersion = btaVersion; - } - - public int getOceanSize() { - return oceanSize; - } - - public WorldConfigurationInfoLegacy setOceanSize(int oceanSize) { - this.oceanSize = oceanSize; - return this; - } - - public boolean generatePerlinBeaches() { - return generatePerlinBeaches; - } - - public WorldConfigurationInfoLegacy setGeneratePerlinBeaches(boolean generateBeaches) { - this.generatePerlinBeaches = generateBeaches; - return this; - } - - public boolean isClimatized() { - return climatized; - } - - public WorldConfigurationInfoLegacy setClimatized(boolean climatized) { - this.climatized = climatized; - return this; - } - - public int getBiomeSize() { - return biomeSize; - } - - public void setBiomeSize(int biomeSize) { - this.biomeSize = biomeSize; - } - - public TerrainGenerator getGenerator() { - return generator; - } - - public WorldConfigurationInfoLegacy setGenerator(TerrainGenerator generator) { - this.generator = generator; - return this; - } - - public static interface Condition { - public boolean satisfiesContraints(WorldConfigurationInfoLegacy info); - } -} diff --git a/minecraft_server/betterterrain/world/generate/BTAChunkProvider.java b/minecraft_server/betterterrain/world/generate/BTAChunkProvider.java deleted file mode 100644 index b5d4e3e..0000000 --- a/minecraft_server/betterterrain/world/generate/BTAChunkProvider.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - */ -package betterterrain.world.generate; - -import java.util.List; - -import betterterrain.structure.mapgen.BTAMapGenNetherBridge; -import net.minecraft.src.EnumCreatureType; -import net.minecraft.src.IChunkProvider; - -/** - * @author Abigail Moore - * - */ -public interface BTAChunkProvider extends IChunkProvider { - List getPossibleCreaturesStructuresOnly(EnumCreatureType creatureType, int x, int y, int z); - - boolean doesStructureExistAtCoords(int x, int y, int z); - - boolean isNether(); - - BTAMapGenNetherBridge getNetherBridgeGenerator(); -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/generate/BetaChunkProvider.java b/minecraft_server/betterterrain/world/generate/BetaChunkProvider.java deleted file mode 100644 index 53dbcb7..0000000 --- a/minecraft_server/betterterrain/world/generate/BetaChunkProvider.java +++ /dev/null @@ -1,746 +0,0 @@ -package betterterrain.world.generate; - -import java.util.List; -import java.util.Random; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.structure.mapgen.BTAMapGenBase; -import betterterrain.structure.mapgen.BTAMapGenCave; -import betterterrain.structure.mapgen.BTAMapGenMineshaft; -import betterterrain.structure.mapgen.BTAMapGenNetherBridge; -import betterterrain.structure.mapgen.BTAMapGenRavine; -import betterterrain.structure.mapgen.BTAMapGenScatteredFeature; -import betterterrain.structure.mapgen.BTAMapGenStronghold; -import betterterrain.structure.mapgen.BTAMapGenVillage; -import betterterrain.world.BTAChunk; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.BetaNoiseOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.BlockSand; -import net.minecraft.src.Chunk; -import net.minecraft.src.ChunkPosition; -import net.minecraft.src.EnumCreatureType; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.IProgressUpdate; -import net.minecraft.src.SpawnerAnimals; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenDungeons; -import net.minecraft.src.WorldGenFlowers; -import net.minecraft.src.WorldGenLakes; -import net.minecraft.src.WorldType; - -public class BetaChunkProvider implements BTAChunkProvider -{ - private Random rand; - private BetaNoiseOctaves blockNoiseGen1; - private BetaNoiseOctaves blockNoiseGen2; - private BetaNoiseOctaves blockModifierNoiseGen; - private BetaNoiseOctaves sandNoiseGen; - private BetaNoiseOctaves stoneNoiseGen; - public BetaNoiseOctaves field_922_a; - public BetaNoiseOctaves field_921_b; - public BetaNoiseOctaves mobSpawnerNoise; - private World worldObj; - private final boolean mapFeaturesEnabled; - private double[] field_4180_q; - private double[] sandNoise = new double[256]; - private double[] gravelNoise = new double[256]; - private double[] stoneNoise = new double[256]; - private BTAMapGenBase mapGenCaves = new BTAMapGenCave(); - private BTAMapGenStronghold strongholdGenerator = new BTAMapGenStronghold(); - public BTAMapGenVillage villageGenerator = new BTAMapGenVillage(); - private BTAMapGenMineshaft mineshaftGenerator = new BTAMapGenMineshaft(); - private BTAMapGenScatteredFeature scatteredFeatureGenerator = new BTAMapGenScatteredFeature(); - private BTAMapGenBase ravineGenerator = new BTAMapGenRavine(); - private BiomeGenBase[] biomesForGeneration; - private int worldtype; - double[] blockModiferNoise; - double[] blockNoise1; - double[] blockNoise2; - double[] field_4182_g; - double[] field_4181_h; - int[][] field_914_i = new int[32][32]; - private Random m_structureRand; - - private WorldConfigurationInfo generatorInfo; - - private long seed; - - public BetaChunkProvider(World var1, long var2, boolean var4, WorldConfigurationInfo generatorInfo) - { - this.worldObj = var1; - this.rand = new Random(var2); - this.m_structureRand = new Random(var2); - this.mapFeaturesEnabled = var4; - this.generatorInfo = generatorInfo; - this.blockNoiseGen1 = new BetaNoiseOctaves(this.rand, 16); - this.blockNoiseGen2 = new BetaNoiseOctaves(this.rand, 16); - this.blockModifierNoiseGen = new BetaNoiseOctaves(this.rand, 8); - this.sandNoiseGen = new BetaNoiseOctaves(this.rand, 4); - this.stoneNoiseGen = new BetaNoiseOctaves(this.rand, 4); - this.field_922_a = new BetaNoiseOctaves(this.rand, 10); - this.field_921_b = new BetaNoiseOctaves(this.rand, 16); - this.mobSpawnerNoise = new BetaNoiseOctaves(this.rand, 8); - this.seed = var2; - - SurfaceBuilder.initForNoiseField(this.seed); - } - - public void generateTerrain(int var1, int var2, int[] var3, BiomeGenBase[] var4) - { - byte var6 = 4; - byte var7 = 64; - int var8 = var6 + 1; - byte var9 = 17; - int var10 = var6 + 1; - this.field_4180_q = this.initializeNoiseField(this.field_4180_q, var1 * var6, 0, var2 * var6, var8, var9, var10); - - for (int var11 = 0; var11 < var6; ++var11) - { - for (int var12 = 0; var12 < var6; ++var12) - { - for (int var13 = 0; var13 < 16; ++var13) - { - double var14 = 0.125D; - double var16 = this.field_4180_q[((var11 + 0) * var10 + var12 + 0) * var9 + var13 + 0]; - double var18 = this.field_4180_q[((var11 + 0) * var10 + var12 + 1) * var9 + var13 + 0]; - double var20 = this.field_4180_q[((var11 + 1) * var10 + var12 + 0) * var9 + var13 + 0]; - double var22 = this.field_4180_q[((var11 + 1) * var10 + var12 + 1) * var9 + var13 + 0]; - double var24 = (this.field_4180_q[((var11 + 0) * var10 + var12 + 0) * var9 + var13 + 1] - var16) * var14; - double var26 = (this.field_4180_q[((var11 + 0) * var10 + var12 + 1) * var9 + var13 + 1] - var18) * var14; - double var28 = (this.field_4180_q[((var11 + 1) * var10 + var12 + 0) * var9 + var13 + 1] - var20) * var14; - double var30 = (this.field_4180_q[((var11 + 1) * var10 + var12 + 1) * var9 + var13 + 1] - var22) * var14; - - for (int var32 = 0; var32 < 8; ++var32) - { - double var33 = 0.25D; - double var35 = var16; - double var37 = var18; - double var39 = (var20 - var16) * var33; - double var41 = (var22 - var18) * var33; - - for (int var43 = 0; var43 < 4; ++var43) - { - int var44 = var43 + var11 * 4 << 11 | 0 + var12 * 4 << 7 | var13 * 8 + var32; - short var45 = 128; - double var46 = 0.25D; - double var48 = var35; - double var50 = (var37 - var35) * var46; - - for (int var52 = 0; var52 < 4; ++var52) - { - //double var53 = var5[(var11 * 4 + var43) * 16 + var12 * 4 + var52]; - int var55 = 0; - - if (var13 * 8 + var32 < var7) - { - //if (var53 < 0.5D && var13 * 8 + var32 >= var7 - 1) - //{ - //var55 = Block.ice.blockID; - //} - //else - //{ - var55 = Block.waterStill.blockID; - //} - } - - if (var48 > 0.0D) - { - var55 = Block.stone.blockID; - } - - var3[var44] = (byte)var55; - var44 += var45; - var48 += var50; - } - - var35 += var39; - var37 += var41; - } - - var16 += var24; - var18 += var26; - var20 += var28; - var22 += var30; - } - } - } - } - } - - public void replaceBlocksForBiome(int var1, int var2, int[] var3, BiomeGenBase[] var4) - { - byte var5 = 64; - double var6 = 0.03125D; - this.sandNoise = this.sandNoiseGen.generateNoiseOctaves(this.sandNoise, (double)(var1 * 16), (double)(var2 * 16), 0.0D, 16, 16, 1, var6, var6, 1.0D); - this.gravelNoise = this.sandNoiseGen.generateNoiseOctaves(this.gravelNoise, (double)(var1 * 16), 109.0134D, (double)(var2 * 16), 16, 1, 16, var6, 1.0D, var6); - this.stoneNoise = this.stoneNoiseGen.generateNoiseOctaves(this.stoneNoise, (double)(var1 * 16), (double)(var2 * 16), 0.0D, 16, 16, 1, var6 * 2.0D, var6 * 2.0D, var6 * 2.0D); - - for (int var8 = 0; var8 < 16; ++var8) - { - for (int var9 = 0; var9 < 16; ++var9) - { - BiomeGenBase var10 = var4[var8 + var9 * 16]; - boolean useSand = this.sandNoise[var9 + var8 * 16] + this.rand.nextDouble() * 0.2D > 0.0D; - boolean useGravel = this.gravelNoise[var9 + var8 * 16] + this.rand.nextDouble() * 0.2D > 3.0D; - int var13 = (int)(this.stoneNoise[var9 + var8 * 16] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); - int var14 = -1; - int var15; - int var16; - - if (var10 instanceof BTABiome) { - var15 = ((BTABiome) var10).topBlockExt; - var16 = ((BTABiome) var10).fillerBlockExt; - } - else { - var15 = var10.topBlock; - var16 = var10.fillerBlock; - } - - for (int var17 = 127; var17 >= 0; --var17) - { - int var18 = (var8 * 16 + var9) * 128 + var17; - - if (var17 <= 0 + this.rand.nextInt(5)) - { - var3[var18] = Block.bedrock.blockID; - } - else - { - int var19 = var3[var18]; - - if (var19 == 0) - { - var14 = -1; - } - else if (var19 == Block.stone.blockID) - { - if (var14 == -1) - { - if (var13 <= 0) - { - var15 = 0; - var16 = Block.stone.blockID; - } - else if (var17 >= var5 - 4 && var17 <= var5 + 1) - { - if (var10 instanceof BTABiome) { - var15 = ((BTABiome) var10).topBlockExt; - var16 = ((BTABiome) var10).fillerBlockExt; - } - else { - var15 = var10.topBlock; - var16 = var10.fillerBlock; - } - - if (useGravel) - { - var15 = 0; - } - - if (useGravel) - { - var16 = (byte)Block.gravel.blockID; - } - - if (useSand) - { - if (var10 == BetterBiomesConfiguration.badlands || var10 == BetterBiomesConfiguration.badlandsPlateau || var10 == BetterBiomesConfiguration.outback) { - var15 = DecoIntegration.redSand.blockID; - var16 = DecoIntegration.redSand.blockID; - } - else { - var15 = Block.sand.blockID; - var16 = Block.sand.blockID; - } - } - } - - if (var17 < var5 && var15 == 0) - { - var15 = (byte)Block.waterStill.blockID; - } - - var14 = var13; - - if (var10.biomeID == BetterBiomesConfiguration.badlandsPlateau.biomeID) - var14 += 10; - - if (var17 >= var5 - 1) - { - var3[var18] = var15; - } - else - { - var3[var18] = var16; - } - } - else if (var14 > 0) - { - --var14; - var3[var18] = var16; - - if (var14 == 0 && var16 == Block.sand.blockID) - { - var14 = this.rand.nextInt(4); - var16 = (byte)Block.sandStone.blockID; - } - else if (DecoIntegration.isDecoInstalled() && var14 == 0 && var16 == DecoIntegration.redSand.blockID) - { - var14 = this.rand.nextInt(4); - var16 = DecoIntegration.redSandStone.blockID; - } - } - } - } - } - } - } - } - - /** - * loads or generates the chunk at the chunk location specified - */ - public Chunk loadChunk(int var1, int var2) - { - return this.provideChunk(var1, var2); - } - - /** - * 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 - */ - public Chunk provideChunk(int chunkX, int chunkZ) - { - this.rand.setSeed((long)chunkX * 341873128712L + (long)chunkZ * 132897987541L); - int[] blockArray = new int[32768]; - int[] metaArray = new int[32768]; - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16); - - this.generateTerrain(chunkX, chunkZ, blockArray, this.biomesForGeneration); - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16); - SurfaceBuilder.replaceSurface(this.rand, this.seed, chunkX, chunkZ, blockArray, metaArray, biomesForGeneration, generatorInfo, this.worldObj.provider.terrainType); - - this.mapGenCaves.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.ravineGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.villageGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.strongholdGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.scatteredFeatureGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - } - - Chunk chunk = new BTAChunk(this.worldObj, blockArray, metaArray, chunkX, chunkZ); - byte[] var6 = chunk.getBiomeArray(); - - for (int var7 = 0; var7 < var6.length; ++var7) - { - var6[var7] = (byte)this.biomesForGeneration[var7].biomeID; - } - - chunk.generateSkylightMap(); - return chunk; - } - - private double[] initializeNoiseField(double[] noiseField, int posX, int posY, int posZ, int sizeX, int sizeY, int sizeZ) - { - if (noiseField == null) - { - noiseField = new double[sizeX * sizeY * sizeZ]; - } - - double octaveScalarXZ = 684.412D; - double octaveScalarY = 684.412D; - this.field_4182_g = this.field_922_a.generateNoiseOctaves(this.field_4182_g, posX, posZ, sizeX, sizeZ, 1.121D, 1.121D, 0.5D); - this.field_4181_h = this.field_921_b.generateNoiseOctaves(this.field_4181_h, posX, posZ, sizeX, sizeZ, 200.0D, 200.0D, 0.5D); - this.blockModiferNoise = this.blockModifierNoiseGen.generateNoiseOctaves(this.blockModiferNoise, (double)posX, (double)posY, (double)posZ, sizeX, sizeY, sizeZ, octaveScalarXZ / 80.0D, octaveScalarY / 160.0D, octaveScalarXZ / 80.0D); - this.blockNoise1 = this.blockNoiseGen1.generateNoiseOctaves(this.blockNoise1, (double)posX, (double)posY, (double)posZ, sizeX, sizeY, sizeZ, octaveScalarXZ, octaveScalarY, octaveScalarXZ); - this.blockNoise2 = this.blockNoiseGen2.generateNoiseOctaves(this.blockNoise2, (double)posX, (double)posY, (double)posZ, sizeX, sizeY, sizeZ, octaveScalarXZ, octaveScalarY, octaveScalarXZ); - int blockNoiseIndex = 0; - int heightmapNoiseIndex = 0; - - for (int i = 0; i < sizeX; ++i) - { - for (int k = 0; k < sizeZ; ++k) - { - double maxHeightVale = (this.field_4182_g[heightmapNoiseIndex] + 256.0D) / 512.0D; - - if (maxHeightVale > 1.0D) - { - maxHeightVale = 1.0D; - } - - double heightmapNoiseModifier = this.field_4181_h[heightmapNoiseIndex] / 8000.0D; - - if (heightmapNoiseModifier < 0.0D) - { - heightmapNoiseModifier = -heightmapNoiseModifier * 0.3D; - } - - heightmapNoiseModifier = heightmapNoiseModifier * 3.0D - 2.0D; - - if (heightmapNoiseModifier < 0.0D) - { - heightmapNoiseModifier /= 2.0D; - - if (heightmapNoiseModifier < -1.0D) - { - heightmapNoiseModifier = -1.0D; - } - - heightmapNoiseModifier /= 1.4D; - heightmapNoiseModifier /= 2.0D; - maxHeightVale = 0.0D; - } - else - { - if (heightmapNoiseModifier > 1.0D) - { - heightmapNoiseModifier = 1.0D; - } - - heightmapNoiseModifier /= 8.0D; - } - - if (maxHeightVale < 0.0D) - { - maxHeightVale = 0.0D; - } - - maxHeightVale += 0.5D; - heightmapNoiseModifier = heightmapNoiseModifier * (double)sizeY / 16.0D; - double minHeightModified = (double)sizeY / 2.0D + heightmapNoiseModifier * 4.0D; - ++heightmapNoiseIndex; - - for (int j = 0; j < sizeY; ++j) - { - double noiseSample = 0.0D; - double heightmapValue = ((double)j - minHeightModified) * 12.0D / maxHeightVale; - - if (heightmapValue < 0.0D) - { - heightmapValue *= 4.0D; - } - - double blockNoiseModiferSample = (this.blockModiferNoise[blockNoiseIndex] / 10.0D + 1.0D) / 2.0D; - - double blockNoiseSample1 = this.blockNoise1[blockNoiseIndex] / 512.0D; - double blockNoiseSample2 = this.blockNoise2[blockNoiseIndex] / 512.0D; - - if (blockNoiseModiferSample < 0.0D) - { - noiseSample = blockNoiseSample1; - } - else if (blockNoiseModiferSample > 1.0D) - { - noiseSample = blockNoiseSample2; - } - else - { - noiseSample = blockNoiseSample1 + (blockNoiseSample2 - blockNoiseSample1) * blockNoiseModiferSample; - } - - noiseSample -= heightmapValue; - - if (j > sizeY - 4) - { - double var44 = (double)((float)(j - (sizeY - 4)) / 3.0F); - noiseSample = noiseSample * (1.0D - var44) + -10.0D * var44; - } - - noiseField[blockNoiseIndex] = noiseSample; - ++blockNoiseIndex; - } - } - } - - return noiseField; - } - - /** - * Checks to see if a chunk exists at x, y - */ - public boolean chunkExists(int var1, int var2) - { - return true; - } - - /** - * Populates chunk with ores etc etc - */ - public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) - { - BlockSand.fallInstantly = true; - int x = par2 * 16; - int z = par3 * 16; - BiomeGenBase b = this.worldObj.getBiomeGenForCoords(x + 16, z + 16); - this.rand.setSeed(this.worldObj.getSeed()); - long var7 = this.rand.nextLong() / 2L * 2L + 1L; - long var9 = this.rand.nextLong() / 2L * 2L + 1L; - long var11 = this.rand.nextLong() / 2L * 2L + 1L; - long var13 = this.rand.nextLong() / 2L * 2L + 1L; - this.rand.setSeed((long)par2 * var7 + (long)par3 * var9 ^ this.worldObj.getSeed()); - boolean var15 = false; - - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); - this.m_structureRand.setSeed((long)par2 * var11 + (long)par3 * var13 ^ this.worldObj.getSeed()); - var15 = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, par2, par3); - this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, par2, par3); - this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, par2, par3); - } - - int var16; - int var17; - int var18; - - if (!var15 && this.rand.nextInt(4) == 0) - { - var16 = x + this.rand.nextInt(16) + 8; - var17 = this.rand.nextInt(128); - var18 = z + this.rand.nextInt(16) + 8; - (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, var16, var17, var18); - } - - if (!var15 && this.rand.nextInt(8) == 0) - { - var16 = x + this.rand.nextInt(16) + 8; - var17 = this.rand.nextInt(this.rand.nextInt(120) + 8); - var18 = z + this.rand.nextInt(16) + 8; - - if (var17 < 63 || this.rand.nextInt(10) == 0) - { - (new WorldGenLakes(Block.lavaStill.blockID)).generate(this.worldObj, this.rand, var16, var17, var18); - } - } - - for (var16 = 0; var16 < 8; ++var16) - { - var17 = x + this.rand.nextInt(16) + 8; - var18 = this.rand.nextInt(128); - int var19 = z + this.rand.nextInt(16) + 8; - - if ((new WorldGenDungeons()).generate(this.worldObj, this.rand, var17, var18, var19)) - { - ; - } - } - - if (b instanceof BTABiome) { - ((BTABiome) b).getSurfaceBuilder().decorateSurface(worldObj, this.rand, (BTABiome) b, x, z, this.generatorInfo); - ((BTABiome) b).decorate(this.worldObj, this.rand, x, z, this.generatorInfo); - } - else { - b.decorate(this.worldObj, this.rand, x, z); - } - SpawnerAnimals.performWorldGenSpawning(this.worldObj, b, x + 8, z + 8, 16, 16, this.rand); - - x += 8; - z += 8; - - for (var16 = 0; var16 < 16; ++var16) - { - for (var17 = 0; var17 < 16; ++var17) - { - var18 = this.worldObj.getPrecipitationHeight(x + var16, z + var17); - - if (this.worldObj.isBlockFreezable(var16 + x, var18 - 1, var17 + z)) - { - this.worldObj.setBlock(var16 + x, var18 - 1, var17 + z, Block.ice.blockID, 0, 2); - } - - if (this.worldObj.canSnowAt(var16 + x, var18, var17 + z)) - { - this.worldObj.setBlock(var16 + x, var18, var17 + z, Block.snow.blockID, 0, 2); - } - } - } - - BlockSand.fallInstantly = false; - this.BTWPostProcessChunk(this.worldObj, x - 8, z - 8); - } - - private void BTWPostProcessChunk(World var1, int var2, int var3) - { - if (var1.provider.dimensionId == 0) - { - this.GenerateStrata(var1, var2, var3); - this.GenerateAdditionalBrownMushrooms(var1, var2, var3); - } - } - - private void GenerateAdditionalBrownMushrooms(World var1, int var2, int var3) - { - if (var1.rand.nextInt(4) == 0) - { - WorldGenFlowers var4 = new WorldGenFlowers(Block.mushroomBrown.blockID); - int var5 = var2 + var1.rand.nextInt(16) + 8; - int var6 = var1.rand.nextInt(25); - int var7 = var3 + var1.rand.nextInt(16) + 8; - var4.generate(var1, var1.rand, var5, var6, var7); - } - } - - private void GenerateStrata(World var1, int var2, int var3) - { - Chunk var4 = var1.getChunkFromChunkCoords(var2 >> 4, var3 >> 4); - - for (int var5 = 0; var5 < 16; ++var5) - { - for (int var6 = 0; var6 < 16; ++var6) - { - int var7 = 0; - int var8; - int var9; - - for (var8 = 24 + var1.rand.nextInt(2); var7 <= var8; ++var7) - { - var9 = var4.getBlockID(var5, var7, var6); - - if (var9 == Block.stone.blockID) - { - var4.setBlockMetadata(var5, var7, var6, 2); - } - } - - for (var8 = 48 + var1.rand.nextInt(2); var7 <= var8; ++var7) - { - var9 = var4.getBlockID(var5, var7, var6); - - if (var9 == Block.stone.blockID) - { - var4.setBlockMetadata(var5, var7, var6, 1); - } - } - } - } - } - - /** - * 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. - */ - public boolean saveChunks(boolean var1, IProgressUpdate var2) - { - return true; - } - - /** - * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. - */ - public boolean unloadQueuedChunks() - { - return false; - } - - public boolean unload100OldestChunks() - { - return false; - } - - /** - * Returns if the IChunkProvider supports saving. - */ - public boolean canSave() - { - return true; - } - - /** - * Converts the instance data to a readable string. - */ - public String makeString() - { - return "RandomLevelSource"; - } - - /** - * Returns a list of creatures of the specified type that can spawn at the given location. - */ - public List getPossibleCreatures(EnumCreatureType creatureType, int x, int y, int z) { - BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(x, z); - - if (biome != null) { - if (creatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(x, y, z)) { - List spawnList = this.scatteredFeatureGenerator.getScatteredFeatureSpawnList(); - - if (spawnList != null) { - return spawnList; - } - else { - return biome.getSpawnableList(creatureType); - } - } - else { - return biome.getSpawnableList(creatureType); - } - } - else { - return null; - } - } - - @Override - public List getPossibleCreaturesStructuresOnly(EnumCreatureType creatureType, int x, int y, int z) { - BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(x, z); - - if (biome != null) { - if (creatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(x, y, z)) { - List spawnList = this.scatteredFeatureGenerator.getScatteredFeatureSpawnList(); - - if (spawnList != null) { - return spawnList; - } - } - } - - return null; - } - - public boolean doesStructureExistAtCoords(int x, int y, int z) { - return this.scatteredFeatureGenerator.hasStructureAt(x, y, z); - } - - /** - * Returns the location of the closest structure of the specified type. If not found returns null. - */ - public ChunkPosition findClosestStructure(World var1, String var2, int var3, int var4, int var5) - { - return "Stronghold".equals(var2) && this.strongholdGenerator != null ? this.strongholdGenerator.getNearestInstance(var1, var3, var4, var5) : null; - } - - public int getLoadedChunkCount() - { - return 0; - } - - public void recreateStructures(int par1, int par2) - { - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generate(this, this.worldObj, par1, par2, (int[])null); - this.villageGenerator.generate(this, this.worldObj, par1, par2, (int[])null); - this.strongholdGenerator.generate(this, this.worldObj, par1, par2, (int[])null); - this.scatteredFeatureGenerator.generate(this, this.worldObj, par1, par2, (int[])null); - } - } - - public void func_104112_b() {} - - @Override - public boolean isNether() { - return false; - } - - @Override - public BTAMapGenNetherBridge getNetherBridgeGenerator() { - return null; - } -} diff --git a/minecraft_server/betterterrain/world/generate/EndChunkProvider.java b/minecraft_server/betterterrain/world/generate/EndChunkProvider.java deleted file mode 100644 index 1e92e39..0000000 --- a/minecraft_server/betterterrain/world/generate/EndChunkProvider.java +++ /dev/null @@ -1,418 +0,0 @@ -package betterterrain.world.generate; - -import java.util.List; -import java.util.Random; - -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.BlockSand; -import net.minecraft.src.Chunk; -import net.minecraft.src.ChunkPosition; -import net.minecraft.src.EnumCreatureType; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.IProgressUpdate; -import net.minecraft.src.MathHelper; -import net.minecraft.src.NoiseGeneratorOctaves; -import net.minecraft.src.World; - -public class EndChunkProvider implements IChunkProvider -{ - private Random endRNG; - private NoiseGeneratorOctaves noiseGen1; - private NoiseGeneratorOctaves noiseGen2; - private NoiseGeneratorOctaves noiseGen3; - public NoiseGeneratorOctaves noiseGen4; - public NoiseGeneratorOctaves noiseGen5; - private World endWorld; - private double[] densities; - - /** The biomes that are used to generate the chunk */ - private BiomeGenBase[] biomesForGeneration; - double[] noiseData1; - double[] noiseData2; - double[] noiseData3; - double[] noiseData4; - double[] noiseData5; - int[][] field_73203_h = new int[32][32]; - - public EndChunkProvider(World par1World, long par2) - { - this.endWorld = par1World; - this.endRNG = new Random(par2); - this.noiseGen1 = new NoiseGeneratorOctaves(this.endRNG, 16); - this.noiseGen2 = new NoiseGeneratorOctaves(this.endRNG, 16); - this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); - this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); - this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); - } - - public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) - { - byte var5 = 2; - int var6 = var5 + 1; - byte var7 = 33; - int var8 = var5 + 1; - this.densities = this.initializeNoiseField(this.densities, par1 * var5, 0, par2 * var5, var6, var7, var8); - - for (int var9 = 0; var9 < var5; ++var9) - { - for (int var10 = 0; var10 < var5; ++var10) - { - for (int var11 = 0; var11 < 32; ++var11) - { - double var12 = 0.25D; - double var14 = this.densities[((var9 + 0) * var8 + var10 + 0) * var7 + var11 + 0]; - double var16 = this.densities[((var9 + 0) * var8 + var10 + 1) * var7 + var11 + 0]; - double var18 = this.densities[((var9 + 1) * var8 + var10 + 0) * var7 + var11 + 0]; - double var20 = this.densities[((var9 + 1) * var8 + var10 + 1) * var7 + var11 + 0]; - double var22 = (this.densities[((var9 + 0) * var8 + var10 + 0) * var7 + var11 + 1] - var14) * var12; - double var24 = (this.densities[((var9 + 0) * var8 + var10 + 1) * var7 + var11 + 1] - var16) * var12; - double var26 = (this.densities[((var9 + 1) * var8 + var10 + 0) * var7 + var11 + 1] - var18) * var12; - double var28 = (this.densities[((var9 + 1) * var8 + var10 + 1) * var7 + var11 + 1] - var20) * var12; - - for (int var30 = 0; var30 < 4; ++var30) - { - double var31 = 0.125D; - double var33 = var14; - double var35 = var16; - double var37 = (var18 - var14) * var31; - double var39 = (var20 - var16) * var31; - - for (int var41 = 0; var41 < 8; ++var41) - { - int var42 = var41 + var9 * 8 << 11 | 0 + var10 * 8 << 7 | var11 * 4 + var30; - short var43 = 128; - double var44 = 0.125D; - double var46 = var33; - double var48 = (var35 - var33) * var44; - - for (int var50 = 0; var50 < 8; ++var50) - { - int var51 = 0; - - if (var46 > -10.0D) - { - var51 = Block.whiteStone.blockID; - } - - par3ArrayOfByte[var42] = (byte)var51; - var42 += var43; - var46 += var48; - } - - var33 += var37; - var35 += var39; - } - - var14 += var22; - var16 += var24; - var18 += var26; - var20 += var28; - } - } - } - } - } - - public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) - { - for (int var5 = 0; var5 < 16; ++var5) - { - for (int var6 = 0; var6 < 16; ++var6) - { - byte var7 = 1; - int var8 = -1; - byte var9 = (byte)Block.whiteStone.blockID; - byte var10 = (byte)Block.whiteStone.blockID; - - for (int var11 = 127; var11 >= 0; --var11) - { - int var12 = (var6 * 16 + var5) * 128 + var11; - byte var13 = par3ArrayOfByte[var12]; - - if (var13 == 0) - { - var8 = -1; - } - else if (var13 == Block.stone.blockID) - { - if (var8 == -1) - { - if (var7 <= 0) - { - var9 = 0; - var10 = (byte)Block.whiteStone.blockID; - } - - var8 = var7; - - if (var11 >= 0) - { - par3ArrayOfByte[var12] = var9; - } - else - { - par3ArrayOfByte[var12] = var10; - } - } - else if (var8 > 0) - { - --var8; - par3ArrayOfByte[var12] = var10; - } - } - } - } - } - } - - /** - * loads or generates the chunk at the chunk location specified - */ - public Chunk loadChunk(int par1, int par2) - { - return this.provideChunk(par1, par2); - } - - /** - * 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 - */ - public Chunk provideChunk(int par1, int par2) - { - this.endRNG.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L); - byte[] var3 = new byte[32768]; - this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16); - this.generateTerrain(par1, par2, var3, this.biomesForGeneration); - this.replaceBlocksForBiome(par1, par2, var3, this.biomesForGeneration); - Chunk var4 = new Chunk(this.endWorld, var3, par1, par2); - byte[] var5 = var4.getBiomeArray(); - - for (int var6 = 0; var6 < var5.length; ++var6) - { - var5[var6] = (byte)this.biomesForGeneration[var6].biomeID; - } - - var4.generateSkylightMap(); - return var4; - } - - /** - * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the - * size. - */ - private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) - { - if (par1ArrayOfDouble == null) - { - par1ArrayOfDouble = new double[par5 * par6 * par7]; - } - - double var8 = 684.412D; - double var10 = 684.412D; - this.noiseData4 = this.noiseGen4.generateNoiseOctaves(this.noiseData4, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D); - this.noiseData5 = this.noiseGen5.generateNoiseOctaves(this.noiseData5, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D); - var8 *= 2.0D; - this.noiseData1 = this.noiseGen3.generateNoiseOctaves(this.noiseData1, par2, par3, par4, par5, par6, par7, var8 / 80.0D, var10 / 160.0D, var8 / 80.0D); - this.noiseData2 = this.noiseGen1.generateNoiseOctaves(this.noiseData2, par2, par3, par4, par5, par6, par7, var8, var10, var8); - this.noiseData3 = this.noiseGen2.generateNoiseOctaves(this.noiseData3, par2, par3, par4, par5, par6, par7, var8, var10, var8); - int var12 = 0; - int var13 = 0; - - for (int var14 = 0; var14 < par5; ++var14) - { - for (int var15 = 0; var15 < par7; ++var15) - { - double var16 = (this.noiseData4[var13] + 256.0D) / 512.0D; - - if (var16 > 1.0D) - { - var16 = 1.0D; - } - - double var18 = this.noiseData5[var13] / 8000.0D; - - if (var18 < 0.0D) - { - var18 = -var18 * 0.3D; - } - - var18 = var18 * 3.0D - 2.0D; - float var20 = (float)(var14 + par2 - 0) / 1.0F; - float var21 = (float)(var15 + par4 - 0) / 1.0F; - float var22 = 150.0F - MathHelper.sqrt_float(var20 * var20 + var21 * var21) * 8.0F; - - if (var22 > 130.0F) - { - var22 = 130.0F; - } - - if (var22 < -150.0F) - { - var22 = -150.0F; - } - - if (var18 > 1.0D) - { - var18 = 1.0D; - } - - var18 /= 8.0D; - var18 = 0.0D; - - if (var16 < 0.0D) - { - var16 = 0.0D; - } - - var16 += 0.5D; - var18 = var18 * (double)par6 / 16.0D; - ++var13; - double var23 = (double)par6 / 2.0D; - - for (int var25 = 0; var25 < par6; ++var25) - { - double var26 = 0.0D; - double var28 = ((double)var25 - var23) * 8.0D / var16; - - if (var28 < 0.0D) - { - var28 *= -1.0D; - } - - double var30 = this.noiseData2[var12] / 512.0D; - double var32 = this.noiseData3[var12] / 512.0D; - double var34 = (this.noiseData1[var12] / 10.0D + 1.0D) / 2.0D; - - if (var34 < 0.0D) - { - var26 = var30; - } - else if (var34 > 1.0D) - { - var26 = var32; - } - else - { - var26 = var30 + (var32 - var30) * var34; - } - - var26 -= 8.0D; - var26 += (double)var22; - byte var36 = 2; - double var37; - - if (var25 > par6 / 2 - var36) - { - var37 = (double)((float)(var25 - (par6 / 2 - var36)) / 64.0F); - - if (var37 < 0.0D) - { - var37 = 0.0D; - } - - if (var37 > 1.0D) - { - var37 = 1.0D; - } - - var26 = var26 * (1.0D - var37) + -1000.0D * var37; - } - - var36 = 8; - - if (var25 < var36) - { - var37 = (double)((float)(var36 - var25) / ((float)var36 - 1.0F)); - var26 = var26 * (1.0D - var37) + -30.0D * var37; - } - - par1ArrayOfDouble[var12] = var26; - ++var12; - } - } - } - - return par1ArrayOfDouble; - } - - /** - * Checks to see if a chunk exists at x, y - */ - public boolean chunkExists(int par1, int par2) - { - return true; - } - - /** - * Populates chunk with ores etc etc - */ - public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) - { - BlockSand.fallInstantly = true; - int var4 = par2 * 16; - int var5 = par3 * 16; - BiomeGenBase var6 = this.endWorld.getBiomeGenForCoords(var4 + 16, var5 + 16); - var6.decorate(this.endWorld, this.endWorld.rand, var4, var5); - BlockSand.fallInstantly = false; - } - - /** - * 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. - */ - public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) - { - return true; - } - - public void func_104112_b() {} - - /** - * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. - */ - public boolean unloadQueuedChunks() - { - return false; - } - - /** - * Returns if the IChunkProvider supports saving. - */ - public boolean canSave() - { - return true; - } - - /** - * Converts the instance data to a readable string. - */ - public String makeString() - { - return "RandomLevelSource"; - } - - /** - * 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) - { - BiomeGenBase var5 = this.endWorld.getBiomeGenForCoords(par2, par4); - return var5 == null ? null : var5.getSpawnableList(par1EnumCreatureType); - } - - /** - * Returns the location of the closest structure of the specified type. If not found returns null. - */ - public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) - { - return null; - } - - public int getLoadedChunkCount() - { - return 0; - } - - public void recreateStructures(int par1, int par2) {} -} diff --git a/minecraft_server/betterterrain/world/generate/NetherChunkProvider.java b/minecraft_server/betterterrain/world/generate/NetherChunkProvider.java deleted file mode 100644 index 54a97c0..0000000 --- a/minecraft_server/betterterrain/world/generate/NetherChunkProvider.java +++ /dev/null @@ -1,508 +0,0 @@ -package betterterrain.world.generate; - -import java.util.List; -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.structure.mapgen.BTAMapGenBase; -import betterterrain.structure.mapgen.BTAMapGenCavesHell; -import betterterrain.structure.mapgen.BTAMapGenNetherBridge; -import betterterrain.world.BTAChunk; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.BlockSand; -import net.minecraft.src.Chunk; -import net.minecraft.src.ChunkPosition; -import net.minecraft.src.EnumCreatureType; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.IProgressUpdate; -import net.minecraft.src.NoiseGeneratorOctaves; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenFlowers; -import net.minecraft.src.WorldType; - -public class NetherChunkProvider implements BTAChunkProvider -{ - private Random hellRNG; - - /** A NoiseGeneratorOctaves used in generating nether terrain */ - private NoiseGeneratorOctaves netherNoiseGen1; - private NoiseGeneratorOctaves netherNoiseGen2; - private NoiseGeneratorOctaves netherNoiseGen3; - - /** Determines whether slowsand or gravel can be generated at a location */ - private NoiseGeneratorOctaves slowsandGravelNoiseGen; - - /** - * Determines whether something other than nettherack can be generated at a location - */ - private NoiseGeneratorOctaves netherrackExculsivityNoiseGen; - public NoiseGeneratorOctaves netherNoiseGen6; - public NoiseGeneratorOctaves netherNoiseGen7; - - /** Is the world that the nether is getting generated. */ - private World worldObj; - private double[] noiseArray; - public BTAMapGenNetherBridge genNetherBridge = new BTAMapGenNetherBridge(); - - /** - * Holds the noise used to determine whether slowsand can be generated at a location - */ - private double[] slowsandNoise = new double[256]; - private double[] gravelNoise = new double[256]; - - /** - * Holds the noise used to determine whether something other than netherrack can be generated at a location - */ - private double[] netherrackExclusivityNoise = new double[256]; - private BTAMapGenBase netherCaveGenerator = new BTAMapGenCavesHell(); - double[] noiseData1; - double[] noiseData2; - double[] noiseData3; - double[] noiseData4; - double[] noiseData5; - - public WorldConfigurationInfo generatorInfo; - private long seed; - - /** The biomes that are used to generate the chunk */ - private BiomeGenBase[] biomesForGeneration; - - public NetherChunkProvider(World world, long seed, WorldConfigurationInfo generatorInfo) - { - this.worldObj = world; - this.hellRNG = new Random(seed); - this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); - this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); - this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); - this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); - this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); - this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); - this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); - - this.generatorInfo = generatorInfo; - this.seed = seed; - - SurfaceBuilder.initForNoiseField(this.seed); - } - - /** - * Generates the shape of the terrain for the chunk though its all stone though the water is frozen if the - * temperature is low enough - */ - public void generateNetherTerrain(int chunkX, int chunkZ, int[] blockArray) - { - byte var4 = 4; - byte var5 = 16; - byte var6 = 32; - int var7 = var4 + 1; - byte var8 = 17; - int var9 = var4 + 1; - this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, chunkX * 4 - 2, chunkZ * 4 - 2, var7 + 5, var9 + 5); - - //if (this.generatorInfo.getCompatMode().isVersionAtLeast(BTAEnumVersionCompat.V1_4_0)) { - // this.noiseArray = BTASurfaceBuilder.initializeNoiseField(this.hellRNG, this.seed, this.noiseArray, chunkX * var4, 0, chunkZ * var4, var7, var8, var9, biomesForGeneration); - //} - //else { - this.noiseArray = this.initializeNoiseField(this.noiseArray, chunkX * var4, 0, chunkZ * var4, var7, var8, var9); - //} - - for (int var10 = 0; var10 < var4; ++var10) - { - for (int var11 = 0; var11 < var4; ++var11) - { - for (int var12 = 0; var12 < var5; ++var12) - { - double var13 = 0.125D; - double var15 = this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0]; - double var17 = this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0]; - double var19 = this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0]; - double var21 = this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0]; - double var23 = (this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13; - double var25 = (this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13; - double var27 = (this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13; - double var29 = (this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13; - - for (int var31 = 0; var31 < 8; ++var31) - { - double var32 = 0.25D; - double var34 = var15; - double var36 = var17; - double var38 = (var19 - var15) * var32; - double var40 = (var21 - var17) * var32; - - for (int var42 = 0; var42 < 4; ++var42) - { - int var43 = var42 + var10 * 4 << 11 | 0 + var11 * 4 << 7 | var12 * 8 + var31; - short var44 = 128; - var43 -= var44; - double var45 = 0.25D; - double var47 = (var36 - var34) * var45; - double var49 = var34 - var47; - - for (int var51 = 0; var51 < 4; ++var51) - { - if ((var49 += var47) > 0.0D) - { - blockArray[var43 += var44] = (byte)Block.netherrack.blockID; - } - else if (var12 * 8 + var31 < var6) - { - blockArray[var43 += var44] = (byte)Block.lavaStill.blockID; - } - else - { - blockArray[var43 += var44] = 0; - } - } - - var34 += var38; - var36 += var40; - } - - var15 += var23; - var17 += var25; - var19 += var27; - var21 += var29; - } - } - } - } - } - - /** - * loads or generates the chunk at the chunk location specified - */ - public Chunk loadChunk(int par1, int par2) - { - return this.provideChunk(par1, par2); - } - - /** - * 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 - */ - public Chunk provideChunk(int chunkX, int chunkZ) - { - this.hellRNG.setSeed((long)chunkX * 341873128712L + (long)chunkZ * 132897987541L); - int[] blockArray = new int[32768]; - int[] metaArray = new int[32768]; - this.generateNetherTerrain(chunkX, chunkZ, blockArray); - - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16); - SurfaceBuilder.replaceSurface(this.hellRNG, this.seed, chunkX, chunkZ, blockArray, metaArray, biomesForGeneration, generatorInfo, this.worldObj.provider.terrainType); - - this.netherCaveGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.genNetherBridge.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - Chunk var4 = new BTAChunk(this.worldObj, blockArray, metaArray, chunkX, chunkZ); - BiomeGenBase[] var5 = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, chunkX * 16, chunkZ * 16, 16, 16); - byte[] var6 = var4.getBiomeArray(); - - for (int var7 = 0; var7 < var6.length; ++var7) - { - var6[var7] = (byte)var5[var7].biomeID; - } - - var4.resetRelightChecks(); - return var4; - } - - /** - * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the - * size. - */ - private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) - { - if (par1ArrayOfDouble == null) - { - par1ArrayOfDouble = new double[par5 * par6 * par7]; - } - - double var8 = 684.412D; - double var10 = 2053.236D; - this.noiseData4 = this.netherNoiseGen6.generateNoiseOctaves(this.noiseData4, par2, par3, par4, par5, 1, par7, 1.0D, 0.0D, 1.0D); - this.noiseData5 = this.netherNoiseGen7.generateNoiseOctaves(this.noiseData5, par2, par3, par4, par5, 1, par7, 100.0D, 0.0D, 100.0D); - this.noiseData1 = this.netherNoiseGen3.generateNoiseOctaves(this.noiseData1, par2, par3, par4, par5, par6, par7, var8 / 80.0D, var10 / 60.0D, var8 / 80.0D); - this.noiseData2 = this.netherNoiseGen1.generateNoiseOctaves(this.noiseData2, par2, par3, par4, par5, par6, par7, var8, var10, var8); - this.noiseData3 = this.netherNoiseGen2.generateNoiseOctaves(this.noiseData3, par2, par3, par4, par5, par6, par7, var8, var10, var8); - int var12 = 0; - int var13 = 0; - double[] var14 = new double[par6]; - int var15; - - for (var15 = 0; var15 < par6; ++var15) - { - var14[var15] = Math.cos((double)var15 * Math.PI * 6.0D / (double)par6) * 2.0D; - double var16 = (double)var15; - - if (var15 > par6 / 2) - { - var16 = (double)(par6 - 1 - var15); - } - - if (var16 < 4.0D) - { - var16 = 4.0D - var16; - var14[var15] -= var16 * var16 * var16 * 10.0D; - } - } - - for (var15 = 0; var15 < par5; ++var15) - { - for (int var36 = 0; var36 < par7; ++var36) - { - double var17 = (this.noiseData4[var13] + 256.0D) / 512.0D; - - if (var17 > 1.0D) - { - var17 = 1.0D; - } - - double var19 = 0.0D; - double var21 = this.noiseData5[var13] / 8000.0D; - - if (var21 < 0.0D) - { - var21 = -var21; - } - - var21 = var21 * 3.0D - 3.0D; - - if (var21 < 0.0D) - { - var21 /= 2.0D; - - if (var21 < -1.0D) - { - var21 = -1.0D; - } - - var21 /= 1.4D; - var21 /= 2.0D; - var17 = 0.0D; - } - else - { - if (var21 > 1.0D) - { - var21 = 1.0D; - } - - var21 /= 6.0D; - } - - var17 += 0.5D; - var21 = var21 * (double)par6 / 16.0D; - ++var13; - - for (int var23 = 0; var23 < par6; ++var23) - { - double var24 = 0.0D; - double var26 = var14[var23]; - double var28 = this.noiseData2[var12] / 512.0D; - double var30 = this.noiseData3[var12] / 512.0D; - double var32 = (this.noiseData1[var12] / 10.0D + 1.0D) / 2.0D; - - if (var32 < 0.0D) - { - var24 = var28; - } - else if (var32 > 1.0D) - { - var24 = var30; - } - else - { - var24 = var28 + (var30 - var28) * var32; - } - - var24 -= var26; - double var34; - - if (var23 > par6 - 4) - { - var34 = (double)((float)(var23 - (par6 - 4)) / 3.0F); - var24 = var24 * (1.0D - var34) + -10.0D * var34; - } - - if ((double)var23 < var19) - { - var34 = (var19 - (double)var23) / 4.0D; - - if (var34 < 0.0D) - { - var34 = 0.0D; - } - - if (var34 > 1.0D) - { - var34 = 1.0D; - } - - var24 = var24 * (1.0D - var34) + -10.0D * var34; - } - - par1ArrayOfDouble[var12] = var24; - ++var12; - } - } - } - - return par1ArrayOfDouble; - } - - /** - * Checks to see if a chunk exists at x, y - */ - public boolean chunkExists(int par1, int par2) - { - return true; - } - - /** - * Populates chunk with ores etc etc - */ - public void populate(IChunkProvider par1IChunkProvider, int chunkX, int chunkZ) - { - BlockSand.fallInstantly = true; - int x = chunkX * 16; - int z = chunkZ * 16; - BiomeGenBase b = this.worldObj.getBiomeGenForCoords(x + 16, z + 16); - this.genNetherBridge.generateStructuresInChunk(this.worldObj, this.hellRNG, chunkX, chunkZ); - - int var7; - int var8; - int var9; - - if (this.hellRNG.nextInt(1) == 0) - { - var7 = x + this.hellRNG.nextInt(16) + 8; - var8 = this.hellRNG.nextInt(128); - var9 = z + this.hellRNG.nextInt(16) + 8; - (new WorldGenFlowers(Block.mushroomRed.blockID)).generate(this.worldObj, this.hellRNG, var7, var8, var9); - } - - if (b instanceof BTABiome) { - ((BTABiome) b).getSurfaceBuilder().decorateSurface(worldObj, this.hellRNG, (BTABiome) b, x, z, this.generatorInfo); - ((BTABiome) b).decorate(this.worldObj, this.hellRNG, x, z, this.generatorInfo); - } - else { - b.decorate(this.worldObj, this.hellRNG, x, z); - } - BlockSand.fallInstantly = false; - } - - /** - * 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. - */ - public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) - { - return true; - } - - public void func_104112_b() {} - - /** - * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. - */ - public boolean unloadQueuedChunks() - { - return false; - } - - /** - * Returns if the IChunkProvider supports saving. - */ - public boolean canSave() - { - return true; - } - - /** - * Converts the instance data to a readable string. - */ - public String makeString() - { - return "HellRandomLevelSource"; - } - - /** - * Returns a list of creatures of the specified type that can spawn at the given location. - */ - public List getPossibleCreatures(EnumCreatureType creatureType, int x, int y, int z) { - BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(x, z); - - if (biome != null) { - if (creatureType == EnumCreatureType.monster && this.genNetherBridge.HasStructureAtLoose(x, y, z)) { - List spawnList = this.genNetherBridge.getSpawnList(); - - if (spawnList != null) { - //spawnList.addAll(biome.getSpawnableList(creatureType)); - return spawnList; - } - else { - return biome.getSpawnableList(creatureType); - } - } - else { - return biome.getSpawnableList(creatureType); - } - } - else { - return null; - } - } - - @Override - public List getPossibleCreaturesStructuresOnly(EnumCreatureType creatureType, int x, int y, int z) { - BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(x, z); - - if (biome != null) { - if (creatureType == EnumCreatureType.monster && this.genNetherBridge.HasStructureAtLoose(x, y, z)) { - List spawnList = this.genNetherBridge.getSpawnList(); - - if (spawnList != null) { - //spawnList.addAll(biome.getSpawnableList(creatureType)); - return spawnList; - } - } - } - - return null; - } - - public boolean doesStructureExistAtCoords(int x, int y, int z) { - return this.genNetherBridge.HasStructureAtLoose(x, y, z); - } - - /** - * Returns the location of the closest structure of the specified type. If not found returns null. - */ - public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) - { - return null; - } - - public int getLoadedChunkCount() - { - return 0; - } - - public void recreateStructures(int par1, int par2) - { - this.genNetherBridge.generate(this, this.worldObj, par1, par2, (int[])null); - } - - @Override - public boolean isNether() { - return true; - } - - @Override - public BTAMapGenNetherBridge getNetherBridgeGenerator() { - return this.genNetherBridge; - } -} diff --git a/minecraft_server/betterterrain/world/generate/SimplexChunkProvider.java b/minecraft_server/betterterrain/world/generate/SimplexChunkProvider.java deleted file mode 100644 index f78a9cb..0000000 --- a/minecraft_server/betterterrain/world/generate/SimplexChunkProvider.java +++ /dev/null @@ -1,617 +0,0 @@ -package betterterrain.world.generate; - -import java.util.List; -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.structure.mapgen.BTAMapGenBase; -import betterterrain.structure.mapgen.BTAMapGenCave; -import betterterrain.structure.mapgen.BTAMapGenMineshaft; -import betterterrain.structure.mapgen.BTAMapGenRavine; -import betterterrain.structure.mapgen.BTAMapGenScatteredFeature; -import betterterrain.structure.mapgen.BTAMapGenStronghold; -import betterterrain.structure.mapgen.BTAMapGenVillage; -import betterterrain.world.BTAChunk; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.BlockSand; -import net.minecraft.src.Chunk; -import net.minecraft.src.ChunkPosition; -import net.minecraft.src.EnumCreatureType; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.IProgressUpdate; -import net.minecraft.src.MathHelper; -import net.minecraft.src.NoiseGeneratorOctaves; -import net.minecraft.src.SpawnerAnimals; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenDungeons; -import net.minecraft.src.WorldGenFlowers; -import net.minecraft.src.WorldGenLakes; -import net.minecraft.src.WorldType; - -public class SimplexChunkProvider implements IChunkProvider -{ - /** RNG. */ - private Random rand; - - private OpenSimplexOctaves blockNoiseGen; - private OpenSimplexOctaves blockThresholdNoiseGen; - - private OpenSimplexOctaves ridgeNoiseGen; - private OpenSimplexOctaves erosionLevelNoiseGen; - private OpenSimplexOctaves erosionNoiseGen; - private OpenSimplexOctaves mountainNoiseGen; - private OpenSimplexOctaves oceanNoiseGen; - private OpenSimplexOctaves riverNoiseGen; - private OpenSimplexOctaves riverNoiseGen2; - - private OpenSimplexOctaves cheeseCaveNoiseGen; - private OpenSimplexOctaves spaghettiCaveNoiseGen; - private OpenSimplexOctaves spaghettiCaveNoiseGen2; - - private OpenSimplexOctaves caveHollownessNoiseGen; - private OpenSimplexOctaves caveFrequencyNoiseGen; - private OpenSimplexOctaves caveFlatnessNoiseGen; - - private NoiseGeneratorOctaves soilDepthNoiseGen; - - /** Reference to the World object. */ - private World worldObj; - - /** are map structures going to be generated (e.g. strongholds) */ - private final boolean mapFeaturesEnabled; - - private BTAMapGenBase caveGenerator = new BTAMapGenCave(); - - /** Holds Stronghold Generator */ - private BTAMapGenStronghold strongholdGenerator = new BTAMapGenStronghold(); - - /** Holds Village Generator */ - public BTAMapGenVillage villageGenerator = new BTAMapGenVillage(); - - /** Holds Mineshaft Generator */ - private BTAMapGenMineshaft mineshaftGenerator = new BTAMapGenMineshaft(); - private BTAMapGenScatteredFeature scatteredFeatureGenerator = new BTAMapGenScatteredFeature(); - - /** Holds ravine generator */ - private BTAMapGenBase ravineGenerator = new BTAMapGenRavine(); - - /** The biomes that are used to generate the chunk */ - private BiomeGenBase[] biomesForGeneration; - - /** - * Used to store the 5x5 parabolic field that is used during terrain generation. - */ - float[] parabolicField; - private Random m_structureRand; - - public WorldConfigurationInfo generatorInfo; - private long seed; - - private double[][][] gaussianKernel; - - public SimplexChunkProvider(World world, long seed, boolean mapFeaturesEnabled, WorldConfigurationInfo generatorInfo) - { - this.worldObj = world; - this.mapFeaturesEnabled = mapFeaturesEnabled; - this.rand = new Random(seed); - this.m_structureRand = new Random(seed); - this.generatorInfo = generatorInfo; - - long blockSeed = rand.nextLong(); - this.blockNoiseGen = new OpenSimplexOctaves(blockSeed, 5); - this.blockThresholdNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 1); - - this.ridgeNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 2); - this.erosionLevelNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 1); - this.erosionNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 2); - this.mountainNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 1); - this.oceanNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 3); - this.riverNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 8); - this.riverNoiseGen2 = new OpenSimplexOctaves(rand.nextLong(), 8); - - this.cheeseCaveNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 4); - this.spaghettiCaveNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 5); - this.spaghettiCaveNoiseGen2 = new OpenSimplexOctaves(rand.nextLong(), 5); - - this.caveHollownessNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 1); - this.caveFrequencyNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 1); - this.caveFlatnessNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 1); - - this.seed = seed; - - SurfaceBuilder.initForNoiseField(this.seed); - } - - /** - * Generates the shape of the terrain for the chunk using only stone, though air below sea level gets filled with water. - */ - public void generateTerrain(int chunkX, int chunkZ, int[][][] blockArray) { - int seaLevel = 100; - - int maxHeight; - int minHeight; - - double blockNoiseScaleXZ; - double blockNoiseScaleY; - - double blockSwitchScale; - - for (int i = 0; i < 16; i++) { - for (int k = 0; k < 16; k++) { - int x = chunkX * 16 + i; - int z = chunkZ * 16 + k; - - //Soft max height - maxHeight = 200; - //Hard min height - minHeight = 75; - - blockNoiseScaleXZ = getTerrainFrequency(x, z); - blockNoiseScaleY = blockNoiseScaleXZ; - - //Hard max height - int jStop = Math.max(maxHeight + 48, seaLevel); - - for (int j = 0; j <= jStop; j++) { - double noise = 0; - - double noiseThreshold = 0; - - if (j < minHeight) - noise = 1; - else { - double blockNoise = blockNoiseGen.noise3(x, j, z, blockNoiseScaleXZ, blockNoiseScaleY, false); - - noise = biasNoiseForHeight(blockNoise, x, j, z, seaLevel, maxHeight, minHeight); - noise = erodeTerrain(noise, x, j, z, seaLevel); - noise = cutRivers(noise, x, j, z, jStop); - } - - if (noise > noiseThreshold) { - blockArray[i][k][j] = Block.stone.blockID; - } - else if (j <= seaLevel) { - blockArray[i][k][j] = Block.waterStill.blockID; - } - - //Breaks inner loop if it hits air while above max height - //Saves performance slightly and reduces chance of issues with terrain getting cut off - if (noise < noiseThreshold && j > maxHeight) { - break; - } - } - } - } - } - - public double getTerrainFrequency(int x, int z) { - double ridgeNoiseScale = 1/1024D; - double ridgeNoise = (float) ridgeNoiseGen.noise2(x, z, ridgeNoiseScale); - - double baseTerrainFrequency = 384D; - double frequencyVariance = 24D; - - double frequency = 1/(baseTerrainFrequency + frequencyVariance * Math.pow(ridgeNoise, 2)); - - return frequency; - } - - public double erodeTerrain(double noise, int x, int y, int z, int seaLevel) { - double erosionLevelNoiseScale = 1/1024D; - double erosionLevel = erosionLevelNoiseGen.noise2(x, z, erosionLevelNoiseScale); - //Normalize to (0, 1) - erosionLevel = (erosionLevel + 1) / 2; - //erosionLevel = MathHelper.clamp_float((float) erosionLevel, 0, 1); - erosionLevel = Math.pow(erosionLevel, 12); - - double erosionNoiseScale = 1/32D; - double erosion = erosionNoiseGen.noise2(x, z, erosionNoiseScale); - //Normalize to (0, 1) - erosion = (erosion + 1) / 2; - erosion = Math.pow(erosion, 3); - //Makes cutoff sharper and makes eroded outcroppings less round - erosion = erosion * 1.5; - //erosion = MathHelper.clamp_float((float) erosion, 0, 1); - - double erosionConstant = 1/3D; - double erosionFactor = erosion * erosionLevel; - - noise += erosionFactor * erosionConstant; - - return noise; - } - - public double biasNoiseForHeight(double noise, int x, int y, int z, int seaLevel, int maxHeight, int minHeight) { - double noiseModifier; - - int heightDivideLevel = seaLevel; - int heightSmoothingLevel = heightDivideLevel + 10; - - if (y >= heightDivideLevel) { - noiseModifier = (y - heightDivideLevel) / (double) (maxHeight - heightDivideLevel); - noiseModifier = Math.pow(noiseModifier, 1/2D); - noiseModifier = noiseModifier * (0.75) + 0.3; - - } - else { - noiseModifier = (y - minHeight) / (double) (heightDivideLevel - minHeight); - noiseModifier = Math.pow(noiseModifier, 2D); - noiseModifier = noiseModifier * 0.3; - } - - return noise + 1 - (2 * noiseModifier); - } - - public double cutRivers(double noise, int x, int y, int z, int maxHeight) { - double riverNoise = this.getRiverNoise(x, z); - - if (y <= maxHeight - riverNoise * (maxHeight - 91)) { - return noise; - } - else { - return -1; - } - } - - /** - * Calculates the noise value for the river map at each location. - * Low values of the river noise are culled to not affect terrain. - * High values decrease maximum height until they fall below sea level, - * creating guaranteed water that is far more consistent than vanilla. - * @param x - * @param z - * @return The noise value as a double between 0 and 1 - */ - public double getRiverNoise(int x, int z) { - double riverScale = 1/2048D; - - double riverNoise1 = riverNoiseGen.noise2(x, z, riverScale); - double riverNoise2 = riverNoiseGen2.noise2(x, z, riverScale); - - //Final river noise is generated from the intersection of the primary noise fields - //Dividing by 2 keeps the range (-1, 1) - double riverNoise = Math.abs(riverNoise1 - riverNoise2) / 2; - //Higher values mean a river, but the intersection creates low values - riverNoise = 1 - riverNoise; - - //Sigmoid function to bias to edges - riverNoise = 1 / (1 + Math.exp(-(riverNoise * 16 - 11))); - - //riverNoise = Math.pow(riverNoise, 3D) * 3 - 2; - riverNoise = Math.pow(riverNoise, 6D); - - //Culls lower half of values so that max height does not get increased - if (riverNoise < 0) { - riverNoise = 0; - } - - return riverNoise; - } - - public void generateCaves(int chunkX, int chunkZ, int[][][] blockArray) { - double minHeight = 8; - double maxHeight = 128; - - double minFuzzyHeight = 12; - double maxFuzzyHeight = 96; - - for (int i = 0; i < 16; i++) { - for (int k = 0; k < 16; k++) { - for (int j = (int) minHeight; j <= maxHeight; j++) { - double cheeseNoise = 0; - - double spaghettiNoise1 = 0; - double spaghettiNoise2 = 0; - - double hollownessThresholdCheese = 0; - double hollownessThresholdSpaghetti = 0; - - //Generate caves based on noise values - if (cheeseNoise > hollownessThresholdCheese && blockArray[i][k][j] != Block.waterStill.blockID) { - if (j < 16) - blockArray[i][k][j] = Block.lavaStill.blockID; - else - blockArray[i][k][j] = 0; - } - - double spaghettiBalanceScale = 0.2; - - if (spaghettiNoise1 * (1 - spaghettiBalanceScale) + spaghettiNoise2 * spaghettiBalanceScale < hollownessThresholdSpaghetti && - spaghettiNoise1 * (1 - spaghettiBalanceScale) + spaghettiNoise2 * spaghettiBalanceScale > -hollownessThresholdSpaghetti && - spaghettiNoise2 * (1 - spaghettiBalanceScale) + spaghettiNoise1 * spaghettiBalanceScale < hollownessThresholdSpaghetti && - spaghettiNoise2 * (1 - spaghettiBalanceScale) + spaghettiNoise1 * spaghettiBalanceScale > -hollownessThresholdSpaghetti && - blockArray[i][k][j] != Block.waterStill.blockID) { - if (j < 16) - blockArray[i][k][j] = Block.lavaStill.blockID; - else - blockArray[i][k][j] = 0; - } - } - } - } - } - - /** - * loads or generates the chunk at the chunk location specified - */ - public Chunk loadChunk(int par1, int par2) - { - return this.provideChunk(par1, par2); - } - - /** - * 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 - */ - public Chunk provideChunk(int chunkX, int chunkZ) - { - this.rand.setSeed((long)chunkX * 341873128712L + (long)chunkZ * 132897987541L); - int[][][] blockArray = new int[16][16][256]; - int[][][] metaArray = new int[16][16][256]; - this.generateTerrain(chunkX, chunkZ, blockArray); - //this.generateTerrainPerlin(chunkX, chunkZ, blockArray); - - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16); - - SurfaceBuilder.replaceSurface(this.rand, this.seed, chunkX, chunkZ, blockArray, metaArray, biomesForGeneration, generatorInfo, this.worldObj.provider.terrainType); - - //this.generateCaves(chunkX, chunkZ, blockArray); - - this.caveGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - - /* - this.ravineGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.villageGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.strongholdGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.scatteredFeatureGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - } - */ - - Chunk chunk = new BTAChunk(this.worldObj, blockArray, metaArray, chunkX, chunkZ); - byte[] chunkBiomeArray = chunk.getBiomeArray(); - - for (int i = 0; i < chunkBiomeArray.length; ++i) - { - chunkBiomeArray[i] = (byte)this.biomesForGeneration[i].biomeID; - } - - chunk.generateSkylightMap(); - return chunk; - } - - /** - * Checks to see if a chunk exists at x, y - */ - public boolean chunkExists(int par1, int par2) - { - return true; - } - - /** - * Populates chunk with ores etc etc - */ - public void populate(IChunkProvider chunkProvider, int chunkX, int chunkZ) - { - BlockSand.fallInstantly = true; - int x = chunkX * 16; - int z = chunkZ * 16; - BiomeGenBase b = this.worldObj.getBiomeGenForCoords(x + 16, z + 16); - this.rand.setSeed(this.worldObj.getSeed()); - long var7 = this.rand.nextLong() / 2L * 2L + 1L; - long var9 = this.rand.nextLong() / 2L * 2L + 1L; - long var11 = this.rand.nextLong() / 2L * 2L + 1L; - long var13 = this.rand.nextLong() / 2L * 2L + 1L; - this.rand.setSeed((long)chunkX * var7 + (long)chunkZ * var9 ^ this.worldObj.getSeed()); - boolean var15 = false; - - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, chunkX, chunkZ); - this.m_structureRand.setSeed((long)chunkX * var11 + (long)chunkZ * var13 ^ this.worldObj.getSeed()); - var15 = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, chunkX, chunkZ); - this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, chunkX, chunkZ); - this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, chunkX, chunkZ); - } - - int var16; - int var17; - int var18; - - if (!var15 && this.rand.nextInt(4) == 0) - { - var16 = x + this.rand.nextInt(16) + 8; - var17 = this.rand.nextInt(128); - var18 = z + this.rand.nextInt(16) + 8; - (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, var16, var17, var18); - } - - if (!var15 && this.rand.nextInt(8) == 0) - { - var16 = x + this.rand.nextInt(16) + 8; - var17 = this.rand.nextInt(this.rand.nextInt(120) + 8); - var18 = z + this.rand.nextInt(16) + 8; - - if (var17 < 63 || this.rand.nextInt(10) == 0) - { - (new WorldGenLakes(Block.lavaStill.blockID)).generate(this.worldObj, this.rand, var16, var17, var18); - } - } - - for (var16 = 0; var16 < 8; ++var16) - { - var17 = x + this.rand.nextInt(16) + 8; - var18 = this.rand.nextInt(128); - int var19 = z + this.rand.nextInt(16) + 8; - - if ((new WorldGenDungeons()).generate(this.worldObj, this.rand, var17, var18, var19)) - { - ; - } - } - - if (b instanceof BTABiome) { - ((BTABiome) b).getSurfaceBuilder().decorateSurface(worldObj, this.rand, (BTABiome) b, x, z, this.generatorInfo); - ((BTABiome) b).decorate(this.worldObj, this.rand, x, z, this.generatorInfo); - } - else { - b.decorate(this.worldObj, this.rand, x, z); - } - SpawnerAnimals.performWorldGenSpawning(this.worldObj, b, x + 8, z + 8, 16, 16, this.rand); - - x += 8; - z += 8; - - for (var16 = 0; var16 < 16; ++var16) - { - for (var17 = 0; var17 < 16; ++var17) - { - var18 = this.worldObj.getPrecipitationHeight(x + var16, z + var17); - - if (this.worldObj.isBlockFreezable(var16 + x, var18 - 1, var17 + z)) - { - this.worldObj.setBlock(var16 + x, var18 - 1, var17 + z, Block.ice.blockID, 0, 2); - } - - if (this.worldObj.canSnowAt(var16 + x, var18, var17 + z)) - { - this.worldObj.setBlock(var16 + x, var18, var17 + z, Block.snow.blockID, 0, 2); - } - } - } - - BlockSand.fallInstantly = false; - this.BTWPostProcessChunk(this.worldObj, x - 8, z - 8); - } - - /** - * 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. - */ - public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) - { - return true; - } - - public void func_104112_b() {} - - /** - * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. - */ - public boolean unloadQueuedChunks() - { - return false; - } - - /** - * Returns if the IChunkProvider supports saving. - */ - public boolean canSave() - { - return true; - } - - /** - * Converts the instance data to a readable string. - */ - public String makeString() - { - return "RandomLevelSource"; - } - - /** - * 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) - { - BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(par2, par4); - return var5 == null ? null : (var5 == BiomeGenBase.swampland && par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : var5.getSpawnableList(par1EnumCreatureType)); - } - - /** - * Returns the location of the closest structure of the specified type. If not found returns null. - */ - public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) - { - return "Stronghold".equals(par2Str) && this.strongholdGenerator != null ? this.strongholdGenerator.getNearestInstance(par1World, par3, par4, par5) : null; - } - - public int getLoadedChunkCount() - { - return 0; - } - - public void recreateStructures(int par1, int par2) - { - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); - this.villageGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); - this.strongholdGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); - this.scatteredFeatureGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); - } - } - - private void BTWPostProcessChunk(World var1, int var2, int var3) - { - if (var1.provider.dimensionId == 0) - { - this.GenerateStrata(var1, var2, var3); - this.GenerateAdditionalBrownMushrooms(var1, var2, var3); - } - } - - private void GenerateAdditionalBrownMushrooms(World var1, int var2, int var3) - { - if (var1.rand.nextInt(4) == 0) - { - WorldGenFlowers var4 = new WorldGenFlowers(Block.mushroomBrown.blockID); - int var5 = var2 + var1.rand.nextInt(16) + 8; - int var6 = var1.rand.nextInt(25); - int var7 = var3 + var1.rand.nextInt(16) + 8; - var4.generate(var1, var1.rand, var5, var6, var7); - } - } - - private void GenerateStrata(World var1, int var2, int var3) - { - Chunk var4 = var1.getChunkFromChunkCoords(var2 >> 4, var3 >> 4); - - for (int var5 = 0; var5 < 16; ++var5) - { - for (int var6 = 0; var6 < 16; ++var6) - { - int var7 = 0; - int var8; - int var9; - - for (var8 = 24 + var1.rand.nextInt(2); var7 <= var8; ++var7) - { - var9 = var4.getBlockID(var5, var7, var6); - - if (var9 == Block.stone.blockID) - { - var4.setBlockMetadata(var5, var7, var6, 2); - } - } - - for (var8 = 48 + var1.rand.nextInt(2); var7 <= var8; ++var7) - { - var9 = var4.getBlockID(var5, var7, var6); - - if (var9 == Block.stone.blockID) - { - var4.setBlockMetadata(var5, var7, var6, 1); - } - } - } - } - } -} diff --git a/minecraft_server/betterterrain/world/generate/SimplexChunkProviderOld.java b/minecraft_server/betterterrain/world/generate/SimplexChunkProviderOld.java deleted file mode 100644 index 57baf16..0000000 --- a/minecraft_server/betterterrain/world/generate/SimplexChunkProviderOld.java +++ /dev/null @@ -1,865 +0,0 @@ -package betterterrain.world.generate; - -import java.util.List; -import java.util.Random; - -import betterterrain.biome.BTABiome; -import betterterrain.structure.mapgen.BTAMapGenBase; -import betterterrain.structure.mapgen.BTAMapGenCave; -import betterterrain.structure.mapgen.BTAMapGenMineshaft; -import betterterrain.structure.mapgen.BTAMapGenRavine; -import betterterrain.structure.mapgen.BTAMapGenScatteredFeature; -import betterterrain.structure.mapgen.BTAMapGenStronghold; -import betterterrain.structure.mapgen.BTAMapGenVillage; -import betterterrain.world.BTAChunk; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.FastNoiseOctaves; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.BlockSand; -import net.minecraft.src.Chunk; -import net.minecraft.src.ChunkPosition; -import net.minecraft.src.EnumCreatureType; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.IProgressUpdate; -import net.minecraft.src.NoiseGeneratorOctaves; -import net.minecraft.src.SpawnerAnimals; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenDungeons; -import net.minecraft.src.WorldGenFlowers; -import net.minecraft.src.WorldGenLakes; - -public class SimplexChunkProviderOld implements IChunkProvider -{ - /** RNG. */ - private Random rand; - - private OpenSimplexOctaves blockNoiseGen; - private OpenSimplexOctaves blockNoiseGen2; - - private FastNoiseOctaves blockNoiseGenPerlin; - - private OpenSimplexOctaves blockNoiseSwitcherGen; - private OpenSimplexOctaves blockThresholdNoiseGen; - - private OpenSimplexOctaves heightMapNoiseGen; - private OpenSimplexOctaves depthMapNoiseGen; - - private OpenSimplexOctaves riverNoiseGen; - private OpenSimplexOctaves riverNoiseGen2; - - private OpenSimplexOctaves cheeseCaveNoiseGen; - private OpenSimplexOctaves spaghettiCaveNoiseGen; - private OpenSimplexOctaves spaghettiCaveNoiseGen2; - - private OpenSimplexOctaves caveHollownessNoiseGen; - private OpenSimplexOctaves caveFrequencyNoiseGen; - private OpenSimplexOctaves caveFlatnessNoiseGen; - - private NoiseGeneratorOctaves soilDepthNoiseGen; - - /** Reference to the World object. */ - private World worldObj; - - /** are map structures going to be generated (e.g. strongholds) */ - private final boolean mapFeaturesEnabled; - - private BTAMapGenBase caveGenerator = new BTAMapGenCave(); - - /** Holds Stronghold Generator */ - private BTAMapGenStronghold strongholdGenerator = new BTAMapGenStronghold(); - - /** Holds Village Generator */ - public BTAMapGenVillage villageGenerator = new BTAMapGenVillage(); - - /** Holds Mineshaft Generator */ - private BTAMapGenMineshaft mineshaftGenerator = new BTAMapGenMineshaft(); - private BTAMapGenScatteredFeature scatteredFeatureGenerator = new BTAMapGenScatteredFeature(); - - /** Holds ravine generator */ - private BTAMapGenBase ravineGenerator = new BTAMapGenRavine(); - - /** The biomes that are used to generate the chunk */ - private BiomeGenBase[] biomesForGeneration; - - /** - * Used to store the 5x5 parabolic field that is used during terrain generation. - */ - float[] parabolicField; - private Random m_structureRand; - - public WorldConfigurationInfo generatorInfo; - private long seed; - - private double[][][] gaussianKernel; - - public SimplexChunkProviderOld(World world, long seed, boolean mapFeaturesEnabled, WorldConfigurationInfo generatorInfo) - { - this.worldObj = world; - this.mapFeaturesEnabled = mapFeaturesEnabled; - this.rand = new Random(seed); - this.m_structureRand = new Random(seed); - this.generatorInfo = generatorInfo; - - long blockSeed = rand.nextLong(); - this.blockNoiseGen = new OpenSimplexOctaves(blockSeed, 5); - this.blockNoiseGen2 = new OpenSimplexOctaves(-blockSeed, 5); - - this.blockNoiseGenPerlin = new FastNoiseOctaves(blockSeed, 7); - - this.blockNoiseSwitcherGen = new OpenSimplexOctaves(rand.nextLong(), 1); - this.blockThresholdNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 1); - - long heightMapSeed = rand.nextLong(); - this.heightMapNoiseGen = new OpenSimplexOctaves(heightMapSeed, 1); - this.depthMapNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 1); - - this.riverNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 7); - this.riverNoiseGen2 = new OpenSimplexOctaves(rand.nextLong(), 7); - - this.cheeseCaveNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 4); - this.spaghettiCaveNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 5); - this.spaghettiCaveNoiseGen2 = new OpenSimplexOctaves(rand.nextLong(), 5); - - this.caveHollownessNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 1); - this.caveFrequencyNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 1); - this.caveFlatnessNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 1); - - this.seed = seed; - - SurfaceBuilder.initForNoiseField(this.seed); - } - - /** - * Generates the shape of the terrain for the chunk using only stone, though air below sea level gets filled with water. - */ - public void generateTerrain(int chunkX, int chunkZ, int[][][] blockArray) { - int seaLevel = 100; - - int maxHeight; - int minHeight; - - double blockNoiseScaleXZ; - double blockNoiseScaleY; - - double blockSwitchScale; - - for (int i = 0; i < 16; i++) { - for (int k = 0; k < 16; k++) { - int x = chunkX * 16 + i; - int z = chunkZ * 16 + k; - - //maxHeight = 216; - maxHeight = getMaxTerrainHeight(x, z); - minHeight = getMinTerrainHeight(x, z); - - int jStop = Math.max(maxHeight, seaLevel); - //int jStop = maxHeight; - - for (int j = 0; j <= jStop; j++) { - //Biases the generation based on y level. - //Below min height is guaranteed to be filled, above max height is guaranteed to be air. - //Between those is a weighting based on height. - double noise = 0; - - double noiseThresholdBase = 0; - double noiseThresholdTop = -0.125; - double noiseThreshold = noiseThresholdBase; - - if (j > maxHeight) - noise = -1; - else if (j < minHeight) - noise = 1; - else { - blockNoiseScaleXZ = 1/384D; - blockNoiseScaleY = 1/384D; - - double blockNoise = blockNoiseGen.noise3(x, j, z, blockNoiseScaleXZ, blockNoiseScaleY); - - /* - double blockNoise2 = blockNoiseGen2.noise3(x, j, z, blockNoiseScaleXZ, blockNoiseScaleY); - - blockSwitchScale = 1/512D; - - double blockNoiseSwitch = blockNoiseSwitcherGen.noise2(x, z, blockSwitchScale); - - double switchModified = blockNoiseSwitch / 2 + 0.5; - double blockNoise = blockNoise + (blockNoise2 - blockNoise) * (switchModified); - */ - - noise = biasNoiseForHeight(blockNoise, j, seaLevel, maxHeight, minHeight); - /* - noise = generateNoiseWithConvolution( - x, j, z, - blockNoiseGen, blockNoiseScaleXZ, blockNoiseScaleY, - seaLevel, maxHeight, minHeight, - 1 - ); - */ - - } - - if (noise > noiseThreshold) { - blockArray[i][k][j] = Block.stone.blockID; - } - else if (j == getMaxTerrainHeight(x, z)) { //Debug - blockArray[i][k][j] = Block.glass.blockID; - } - else if (j <= seaLevel) { - blockArray[i][k][j] = Block.waterStill.blockID; - } - } - } - } - } - - /** - * Generates block noise and convolves it with a gaussian kernel to smooth the result - * @param x - * @param y - * @param z - * @param noiseGen - * @param noiseScaleXZ - * @param noiseScaleY - * @param gaussianRadius - * @return - */ - private double generateNoiseWithConvolution( - int x, int y, int z, - OpenSimplexOctaves noiseGen, double noiseScaleXZ, double noiseScaleY, - int seaLevel, int maxHeight, int minHeight, - int gaussianRadius) { - - int gaussianSize = 2 * gaussianRadius - 1; - - //Caches kernel to avoid regenerating it on every call - //since this will be called thousands of times - if (gaussianKernel == null || gaussianSize != gaussianKernel.length) { - gaussianKernel = new double[gaussianSize][gaussianSize][gaussianSize]; - - for (int i = -gaussianRadius + 1; i < gaussianRadius; i++) { - for (int j = -gaussianRadius + 1; j < gaussianRadius; j++) { - for (int k = -gaussianRadius + 1; k < gaussianRadius; k++) { - double normalizationConstant = 1/(Math.pow(gaussianSize, 3) * Math.pow(2 * Math.PI, 3 / 2D)); - double gaussian = normalizationConstant * Math.exp(-(i*i + j*j + k*k) / (2 * Math.pow(gaussianSize, 2))); - - gaussianKernel[i + gaussianRadius - 1] - [j + gaussianRadius - 1] - [k + gaussianRadius - 1] = gaussian; - } - } - } - - /* - for (int i = 0; i < gaussianSize; i++) { - System.out.print("["); - - for (int j = 0; j < gaussianSize; j++) { - System.out.print(gaussianKernel[gaussianRadius - 1][i][j] + ", "); - } - - System.out.print("]\n"); - } - */ - - double total = 0; - - for (int i = 0; i < gaussianSize; i++) { - for (int j = 0; j < gaussianSize; j++) { - for (int k = 0; k < gaussianSize; k++) { - total += gaussianKernel[i][j][k]; - } - } - } - - System.out.println(total); - } - - double noiseTotal = 0; - - for (int i = 0; i < gaussianSize; i++) { - for (int j = 0; j < gaussianSize; j++) { - for (int k = 0; k < gaussianSize; k++) { - double noise = noiseGen.noise3( - x + i - gaussianRadius + 1, - y + j - gaussianRadius + 1, - z + k - gaussianRadius + 1, - noiseScaleXZ, noiseScaleY - ); - - noise = biasNoiseForHeight(noise, y, seaLevel, maxHeight, minHeight); - - noiseTotal += noise * gaussianKernel[i][j][k]; - } - } - } - - return noiseTotal; - } - - public double biasNoiseForHeight(double noise, int height, int seaLevel, int maxHeight, int minHeight) { - double noiseModifier; - - int heightDivideLevel = seaLevel + 0; - int heightSmoothingLevel = heightDivideLevel + 10; - - if (height >= heightDivideLevel) { - noiseModifier = (height - heightDivideLevel) / (double) (maxHeight - heightDivideLevel); - - /* - double thresholdScale = 1/256D; - double noiseThresholdModifer = blockThresholdNoiseGen.noise2(x, z, thresholdScale); - noiseThresholdModifer = (noiseThresholdModifer + 1) / 2; - noiseThresholdModifer = Math.pow(noiseThresholdModifer, 3); - noiseThresholdModifer = noiseThresholdModifer * 2 - 1; - - noiseThreshold = noiseThresholdTop * noiseThresholdModifer * (j - heightDivideLevel) / (double) (maxHeight - heightDivideLevel); - - float noiseSmoothFactor = ((j - heightDivideLevel) / (float) (heightSmoothingLevel - heightDivideLevel)); - noiseSmoothFactor = MathHelper.clamp_float(noiseSmoothFactor, 0, 1); - noiseSmoothFactor = (float) Math.pow(noiseSmoothFactor, 2); - //noiseModifier = noiseModifier + Math.abs(Math.pow(noiseModifier, 2) - noiseModifier) * noiseSmoothFactor; - noiseModifier = Math.pow(noiseModifier, 1/2D); - */ - - noiseModifier = noiseModifier * (0.75) + 0.3; - - } - else { - noiseModifier = (height - minHeight) / (double) (heightDivideLevel - minHeight); - noiseModifier = Math.pow(noiseModifier, 2D); - noiseModifier = noiseModifier * 0.3; - } - - noiseModifier *= 2; - - return noise + 1 - noiseModifier; - } - - /** - * Generates the shape of the terrain for the chunk using only stone, though air below sea level gets filled with water. - */ - public void generateTerrainPerlin(int chunkX, int chunkZ, int[][][] blockArray) { - int seaLevel = 100; - - int maxHeight; - int minHeight; - - double blockNoiseScaleXZ; - double blockNoiseScaleY; - - for (int i = 0; i < 16; i++) { - for (int k = 0; k < 16; k++) { - int x = chunkX * 16 + i; - int z = chunkZ * 16 + k; - - //maxHeight = 216; - maxHeight = getMaxTerrainHeight(x, z); - minHeight = getMinTerrainHeight(x, z); - - int jStop = Math.max(maxHeight, seaLevel); - //int jStop = maxHeight; - - for (int j = 0; j <= jStop; j++) { - //Biases the generation based on y level. - //Below min height is guaranteed to be filled, above max height is guaranteed to be air. - //Between those is a weighting based on height. - double noise = 0; - - double noiseThresholdBase = 0; - double noiseThresholdTop = -0.125; - double noiseThreshold = noiseThresholdBase; - - if (j > maxHeight) - noise = -1; - else if (j < minHeight) - noise = 1; - else { - blockNoiseScaleXZ = 1/2048D; - blockNoiseScaleY = 1/1024D; - - double blockNoise = blockNoiseGenPerlin.noise3(x, j, z, blockNoiseScaleXZ, blockNoiseScaleY); - - //Old linear weighting - //noise = blockNoise + 1 - 2 * ((j - minHeight) / (double) (maxHeight - minHeight)); - - double noiseModifier = 0; - - //Height weighting - int heightDivideLevel = seaLevel + 0; - int heightSmoothingLevel = heightDivideLevel + 10; - - if (j >= heightDivideLevel) { - noiseModifier = (j - heightDivideLevel) / (double) (maxHeight - heightDivideLevel); - - /* - float noiseSmoothFactor = ((j - heightDivideLevel) / (float) (heightSmoothingLevel - heightDivideLevel)); - noiseSmoothFactor = MathHelper.clamp_float(noiseSmoothFactor, 0, 1); - noiseSmoothFactor = (float) Math.pow(noiseSmoothFactor, 2); - //noiseModifier = noiseModifier + Math.abs(Math.pow(noiseModifier, 2) - noiseModifier) * noiseSmoothFactor; - noiseModifier = Math.pow(noiseModifier, 1/2D); - noiseModifier = noiseModifier * 0.75 + 0.3; - */ - - double thresholdScale = 1/256D; - double noiseThresholdModifer = blockThresholdNoiseGen.noise2(x, z, thresholdScale); - noiseThresholdModifer = (noiseThresholdModifer + 1) / 2; - noiseThresholdModifer = Math.pow(noiseThresholdModifer, 3); - noiseThresholdModifer = noiseThresholdModifer * 2 - 1; - - noiseThreshold = noiseThresholdTop * noiseThresholdModifer * (j - heightDivideLevel) / (double) (maxHeight - heightDivideLevel); - - } - else { - noiseModifier = (j - minHeight) / (double) (heightDivideLevel - minHeight); - noiseModifier = Math.pow(noiseModifier, 2D); - noiseModifier = noiseModifier * 0.3; - } - - noiseModifier *= 2; - - noise = blockNoise + 1 - noiseModifier; - } - - if (noise > noiseThreshold) { - //if (j <= getMaxTerrainHeight(x, z)) { //Debug - blockArray[i][k][j] = Block.stone.blockID; - } - else if (j <= seaLevel) { - blockArray[i][k][j] = Block.waterStill.blockID; - } - } - } - } - } - - /** - * Generates maximum terrain height - * River noise is incorporated into the final output - * @param x - * @param z - * @return the maximum height for generation at the given location as an integer - */ - public int getMaxTerrainHeight(int x, int z, boolean generateRivers) { - //double heightMapNoiseScale = 1/1024D; - double heightMapNoiseScale = 1/512D; - - double heightMapNoise = heightMapNoiseGen.noise2(x, z, heightMapNoiseScale); - double heightMapNoiseModified = (heightMapNoise + 1) / 2; - - //Sigmoid function - //heightMapNoiseModified = 0.5 * heightMapNoiseModified + 0.5 * (1 / (1 + Math.exp(-(heightMapNoiseModified * 20 - 10)))); - - //int maxHeight = (int) (120 + heightMapNoiseModified * 80); - int maxHeight = 200; - - double riverNoise = getRiverNoise(x, z); - - if (generateRivers) - maxHeight -= riverNoise * (maxHeight - 91); - - //maxHeight = MathHelper.clamp_int(maxHeight, 96, 216); - - return maxHeight; - } - - public int getMaxTerrainHeight(int x, int z) { - return this.getMaxTerrainHeight(x, z, true); - } - - public double getMaxTerrainBias(int x, int z) { - double heightMapNoiseScale = 1/1024D; - - double heightMapNoise = heightMapNoiseGen.noise2(x, z, heightMapNoiseScale); - double heightMapNoiseModified = 2 - (heightMapNoise + 1) * 3 + 0.5; - - return heightMapNoiseModified; - } - - /** - * Generates minimum terrain height - * @param x - * @param z - * @return the minimum height for generation at the given location as an integer - */ - public int getMinTerrainHeight(int x, int z, boolean generateRivers) { - double depthMapNoise = depthMapNoiseGen.noise2(x, z, 1/512D); - double depthMapNoiseModified = (depthMapNoise + 1) / 2; - - int minHeight = (int) (95 - depthMapNoiseModified * 20); - - double riverNoise = getRiverNoise(x, z); - - if (generateRivers) - minHeight -= riverNoise * (minHeight - 80); - - return minHeight; - } - - public int getMinTerrainHeight(int x, int z) { - return this.getMinTerrainHeight(x, z, true); - } - - /** - * Calculates the noise value for the river map at each location. - * Low values of the river noise are culled to not affect terrain. - * High values decrease maximum height until they fall below sea level, - * creating guaranteed water that is far more consistent than vanilla. - * @param x - * @param z - * @return The noise value as a double between 0 and 1 - */ - public double getRiverNoise(int x, int z) { - double riverScale = 1/2048D; - - double riverNoise1 = riverNoiseGen.noise2(x, z, riverScale); - double riverNoise2 = riverNoiseGen2.noise2(x, z, riverScale); - - //Final river noise is generated from the intersection of the primary noise fields - //Dividing by 2 keeps the range (-1, 1) - double riverNoise = Math.abs(riverNoise1 - riverNoise2) / 2; - //Higher values mean a river, but the intersection creates low values - riverNoise = 1 - riverNoise; - - //Sigmoid function to bias to edges - riverNoise = 1 / (1 + Math.exp(-(riverNoise * 16 - 11))); - - //Pulls bias towards lower values - //then redefines the range to (-1, 1) because the sigmoid - //output is (0, 1) - //riverNoise = Math.pow(riverNoise, 3D) * 2 - 1; - riverNoise = Math.pow(riverNoise, 6D); - - //Culls lower half of values so that max height does not get increased - if (riverNoise < 0) { - riverNoise = 0; - } - - return riverNoise; - } - - public void generateCaves(int chunkX, int chunkZ, int[][][] blockArray) { - double minHeight = 8; - double maxHeight = 128; - - double minFuzzyHeight = 12; - double maxFuzzyHeight = 96; - - for (int i = 0; i < 16; i++) { - for (int k = 0; k < 16; k++) { - for (int j = (int) minHeight; j <= maxHeight; j++) { - double cheeseNoise = 0; - - double spaghettiNoise1 = 0; - double spaghettiNoise2 = 0; - - double hollownessThresholdCheese = 0; - double hollownessThresholdSpaghetti = 0; - - //Generate caves based on noise values - if (cheeseNoise > hollownessThresholdCheese && blockArray[i][k][j] != Block.waterStill.blockID) { - if (j < 16) - blockArray[i][k][j] = Block.lavaStill.blockID; - else - blockArray[i][k][j] = 0; - } - - double spaghettiBalanceScale = 0.2; - - if (spaghettiNoise1 * (1 - spaghettiBalanceScale) + spaghettiNoise2 * spaghettiBalanceScale < hollownessThresholdSpaghetti && - spaghettiNoise1 * (1 - spaghettiBalanceScale) + spaghettiNoise2 * spaghettiBalanceScale > -hollownessThresholdSpaghetti && - spaghettiNoise2 * (1 - spaghettiBalanceScale) + spaghettiNoise1 * spaghettiBalanceScale < hollownessThresholdSpaghetti && - spaghettiNoise2 * (1 - spaghettiBalanceScale) + spaghettiNoise1 * spaghettiBalanceScale > -hollownessThresholdSpaghetti && - blockArray[i][k][j] != Block.waterStill.blockID) { - if (j < 16) - blockArray[i][k][j] = Block.lavaStill.blockID; - else - blockArray[i][k][j] = 0; - } - } - } - } - } - - /** - * loads or generates the chunk at the chunk location specified - */ - public Chunk loadChunk(int par1, int par2) - { - return this.provideChunk(par1, par2); - } - - /** - * 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 - */ - public Chunk provideChunk(int chunkX, int chunkZ) - { - this.rand.setSeed((long)chunkX * 341873128712L + (long)chunkZ * 132897987541L); - int[][][] blockArray = new int[16][16][256]; - int[][][] metaArray = new int[16][16][256]; - this.generateTerrain(chunkX, chunkZ, blockArray); - //this.generateTerrainPerlin(chunkX, chunkZ, blockArray); - - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16); - - SurfaceBuilder.replaceSurface(this.rand, this.seed, chunkX, chunkZ, blockArray, metaArray, biomesForGeneration, generatorInfo, this.worldObj.provider.terrainType); - - //this.generateCaves(chunkX, chunkZ, blockArray); - - this.caveGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - - /* - this.ravineGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.villageGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.strongholdGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.scatteredFeatureGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - } - */ - - Chunk chunk = new BTAChunk(this.worldObj, blockArray, metaArray, chunkX, chunkZ); - byte[] chunkBiomeArray = chunk.getBiomeArray(); - - for (int i = 0; i < chunkBiomeArray.length; ++i) - { - chunkBiomeArray[i] = (byte)this.biomesForGeneration[i].biomeID; - } - - chunk.generateSkylightMap(); - return chunk; - } - - /** - * Checks to see if a chunk exists at x, y - */ - public boolean chunkExists(int par1, int par2) - { - return true; - } - - /** - * Populates chunk with ores etc etc - */ - public void populate(IChunkProvider chunkProvider, int chunkX, int chunkZ) - { - if (1 == 1) - return; - - BlockSand.fallInstantly = true; - int x = chunkX * 16; - int z = chunkZ * 16; - BiomeGenBase b = this.worldObj.getBiomeGenForCoords(x + 16, z + 16); - this.rand.setSeed(this.worldObj.getSeed()); - long var7 = this.rand.nextLong() / 2L * 2L + 1L; - long var9 = this.rand.nextLong() / 2L * 2L + 1L; - long var11 = this.rand.nextLong() / 2L * 2L + 1L; - long var13 = this.rand.nextLong() / 2L * 2L + 1L; - this.rand.setSeed((long)chunkX * var7 + (long)chunkZ * var9 ^ this.worldObj.getSeed()); - boolean var15 = false; - - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, chunkX, chunkZ); - this.m_structureRand.setSeed((long)chunkX * var11 + (long)chunkZ * var13 ^ this.worldObj.getSeed()); - var15 = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, chunkX, chunkZ); - this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, chunkX, chunkZ); - this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, chunkX, chunkZ); - } - - int var16; - int var17; - int var18; - - if (!var15 && this.rand.nextInt(4) == 0) - { - var16 = x + this.rand.nextInt(16) + 8; - var17 = this.rand.nextInt(128); - var18 = z + this.rand.nextInt(16) + 8; - (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, var16, var17, var18); - } - - if (!var15 && this.rand.nextInt(8) == 0) - { - var16 = x + this.rand.nextInt(16) + 8; - var17 = this.rand.nextInt(this.rand.nextInt(120) + 8); - var18 = z + this.rand.nextInt(16) + 8; - - if (var17 < 63 || this.rand.nextInt(10) == 0) - { - (new WorldGenLakes(Block.lavaStill.blockID)).generate(this.worldObj, this.rand, var16, var17, var18); - } - } - - for (var16 = 0; var16 < 8; ++var16) - { - var17 = x + this.rand.nextInt(16) + 8; - var18 = this.rand.nextInt(128); - int var19 = z + this.rand.nextInt(16) + 8; - - if ((new WorldGenDungeons()).generate(this.worldObj, this.rand, var17, var18, var19)) - { - ; - } - } - - if (b instanceof BTABiome) - ((BTABiome) b).decorate(this.worldObj, this.rand, x, z, this.generatorInfo); - else - b.decorate(this.worldObj, this.rand, x, z); - SpawnerAnimals.performWorldGenSpawning(this.worldObj, b, x + 8, z + 8, 16, 16, this.rand); - - x += 8; - z += 8; - - for (var16 = 0; var16 < 16; ++var16) - { - for (var17 = 0; var17 < 16; ++var17) - { - var18 = this.worldObj.getPrecipitationHeight(x + var16, z + var17); - - if (this.worldObj.isBlockFreezable(var16 + x, var18 - 1, var17 + z)) - { - this.worldObj.setBlock(var16 + x, var18 - 1, var17 + z, Block.ice.blockID, 0, 2); - } - - if (this.worldObj.canSnowAt(var16 + x, var18, var17 + z)) - { - this.worldObj.setBlock(var16 + x, var18, var17 + z, Block.snow.blockID, 0, 2); - } - } - } - - BlockSand.fallInstantly = false; - this.BTWPostProcessChunk(this.worldObj, x - 8, z - 8); - } - - /** - * 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. - */ - public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) - { - return true; - } - - public void func_104112_b() {} - - /** - * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. - */ - public boolean unloadQueuedChunks() - { - return false; - } - - /** - * Returns if the IChunkProvider supports saving. - */ - public boolean canSave() - { - return true; - } - - /** - * Converts the instance data to a readable string. - */ - public String makeString() - { - return "RandomLevelSource"; - } - - /** - * 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) - { - BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(par2, par4); - return var5 == null ? null : (var5 == BiomeGenBase.swampland && par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : var5.getSpawnableList(par1EnumCreatureType)); - } - - /** - * Returns the location of the closest structure of the specified type. If not found returns null. - */ - public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) - { - return "Stronghold".equals(par2Str) && this.strongholdGenerator != null ? this.strongholdGenerator.getNearestInstance(par1World, par3, par4, par5) : null; - } - - public int getLoadedChunkCount() - { - return 0; - } - - public void recreateStructures(int par1, int par2) - { - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); - this.villageGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); - this.strongholdGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); - this.scatteredFeatureGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); - } - } - - private void BTWPostProcessChunk(World var1, int var2, int var3) - { - if (var1.provider.dimensionId == 0) - { - this.GenerateStrata(var1, var2, var3); - this.GenerateAdditionalBrownMushrooms(var1, var2, var3); - } - } - - private void GenerateAdditionalBrownMushrooms(World var1, int var2, int var3) - { - if (var1.rand.nextInt(4) == 0) - { - WorldGenFlowers var4 = new WorldGenFlowers(Block.mushroomBrown.blockID); - int var5 = var2 + var1.rand.nextInt(16) + 8; - int var6 = var1.rand.nextInt(25); - int var7 = var3 + var1.rand.nextInt(16) + 8; - var4.generate(var1, var1.rand, var5, var6, var7); - } - } - - private void GenerateStrata(World var1, int var2, int var3) - { - Chunk var4 = var1.getChunkFromChunkCoords(var2 >> 4, var3 >> 4); - - for (int var5 = 0; var5 < 16; ++var5) - { - for (int var6 = 0; var6 < 16; ++var6) - { - int var7 = 0; - int var8; - int var9; - - for (var8 = 24 + var1.rand.nextInt(2); var7 <= var8; ++var7) - { - var9 = var4.getBlockID(var5, var7, var6); - - if (var9 == Block.stone.blockID) - { - var4.setBlockMetadata(var5, var7, var6, 2); - } - } - - for (var8 = 48 + var1.rand.nextInt(2); var7 <= var8; ++var7) - { - var9 = var4.getBlockID(var5, var7, var6); - - if (var9 == Block.stone.blockID) - { - var4.setBlockMetadata(var5, var7, var6, 1); - } - } - } - } - } -} diff --git a/minecraft_server/betterterrain/world/generate/SkyChunkProvider.java b/minecraft_server/betterterrain/world/generate/SkyChunkProvider.java deleted file mode 100644 index c8a3d06..0000000 --- a/minecraft_server/betterterrain/world/generate/SkyChunkProvider.java +++ /dev/null @@ -1,824 +0,0 @@ -package betterterrain.world.generate; - -import java.util.List; -import java.util.Random; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.structure.mapgen.BTAMapGenBase; -import betterterrain.structure.mapgen.BTAMapGenCave; -import betterterrain.structure.mapgen.BTAMapGenMineshaft; -import betterterrain.structure.mapgen.BTAMapGenNetherBridge; -import betterterrain.structure.mapgen.BTAMapGenRavine; -import betterterrain.structure.mapgen.BTAMapGenScatteredFeature; -import betterterrain.structure.mapgen.BTAMapGenStronghold; -import betterterrain.structure.mapgen.BTAMapGenVillage; -import betterterrain.world.BTAChunk; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.BetaNoiseOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.BlockSand; -import net.minecraft.src.Chunk; -import net.minecraft.src.ChunkPosition; -import net.minecraft.src.EnumCreatureType; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.IProgressUpdate; -import net.minecraft.src.SpawnerAnimals; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenDungeons; -import net.minecraft.src.WorldGenFire; -import net.minecraft.src.WorldGenFlowers; -import net.minecraft.src.WorldGenGlowStone1; -import net.minecraft.src.WorldGenGlowStone2; -import net.minecraft.src.WorldGenHellLava; -import net.minecraft.src.WorldGenLakes; -import net.minecraft.src.WorldGenMinable; -import net.minecraft.src.WorldGenReed; -import net.minecraft.src.WorldType; - -public class SkyChunkProvider implements BTAChunkProvider -{ - private Random rand; - private BetaNoiseOctaves field_912_k; - private BetaNoiseOctaves field_911_l; - private BetaNoiseOctaves field_910_m; - private BetaNoiseOctaves field_909_n; - private BetaNoiseOctaves field_908_o; - public BetaNoiseOctaves field_922_a; - public BetaNoiseOctaves field_921_b; - public BetaNoiseOctaves mobSpawnerNoise; - private World worldObj; - private final boolean mapFeaturesEnabled; - private double[] field_4180_q; - private double[] sandNoise = new double[256]; - private double[] gravelNoise = new double[256]; - private double[] stoneNoise = new double[256]; - private BTAMapGenBase mapGenCaves = new BTAMapGenCave(); - private BTAMapGenStronghold strongholdGenerator = new BTAMapGenStronghold(); - public BTAMapGenVillage villageGenerator = new BTAMapGenVillage(); - private BTAMapGenMineshaft mineshaftGenerator = new BTAMapGenMineshaft(); - private BTAMapGenScatteredFeature scatteredFeatureGenerator = new BTAMapGenScatteredFeature(); - private BTAMapGenBase ravineGenerator = new BTAMapGenRavine(); - public BTAMapGenNetherBridge genNetherBridge = new BTAMapGenNetherBridge(); - private BiomeGenBase[] biomesForGeneration; - private int worldtype; - double[] field_4185_d; - double[] field_4184_e; - double[] field_4183_f; - double[] field_4182_g; - double[] field_4181_h; - int[][] field_914_i = new int[32][32]; - private Random m_structureRand; - private boolean isNether = false; - - private WorldConfigurationInfo generatorInfo; - - private long seed; - - public SkyChunkProvider(World var1, long var2, boolean var4, WorldConfigurationInfo generatorInfo) - { - this.worldObj = var1; - this.rand = new Random(var2); - this.m_structureRand = new Random(var2); - this.mapFeaturesEnabled = var4; - this.generatorInfo = generatorInfo; - this.field_912_k = new BetaNoiseOctaves(this.rand, 16); - this.field_911_l = new BetaNoiseOctaves(this.rand, 16); - this.field_910_m = new BetaNoiseOctaves(this.rand, 8); - this.field_909_n = new BetaNoiseOctaves(this.rand, 4); - this.field_908_o = new BetaNoiseOctaves(this.rand, 4); - this.field_922_a = new BetaNoiseOctaves(this.rand, 10); - this.field_921_b = new BetaNoiseOctaves(this.rand, 16); - this.mobSpawnerNoise = new BetaNoiseOctaves(this.rand, 8); - this.seed = var2; - - SurfaceBuilder.initForNoiseField(this.seed); - } - - public SkyChunkProvider setNether() { - this.isNether = true; - return this; - } - - public void generateTerrain(int var1, int var2, int[] var3, BiomeGenBase[] var4) - { - byte var6 = 2; - int var7 = var6 + 1; - byte var8 = 33; - int var9 = var6 + 1; - this.field_4180_q = this.initializeNoiseField(this.field_4180_q, var1 * var6, 0, var2 * var6, var7, var8, var9); - - for (int var10 = 0; var10 < var6; ++var10) - { - for (int var11 = 0; var11 < var6; ++var11) - { - for (int var12 = 0; var12 < 32; ++var12) - { - double var13 = 0.25D; - double var15 = this.field_4180_q[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0]; - double var17 = this.field_4180_q[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0]; - double var19 = this.field_4180_q[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0]; - double var21 = this.field_4180_q[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0]; - double var23 = (this.field_4180_q[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13; - double var25 = (this.field_4180_q[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13; - double var27 = (this.field_4180_q[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13; - double var29 = (this.field_4180_q[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13; - - for (int var31 = 0; var31 < 4; ++var31) - { - double var32 = 0.125D; - double var34 = var15; - double var36 = var17; - double var38 = (var19 - var15) * var32; - double var40 = (var21 - var17) * var32; - - for (int var42 = 0; var42 < 8; ++var42) - { - int var43 = var42 + var10 * 8 << 11 | 0 + var11 * 8 << 7 | var12 * 4 + var31; - short var44 = 128; - double var45 = 0.125D; - double var47 = var34; - double var49 = (var36 - var34) * var45; - - for (int var51 = 0; var51 < 8; ++var51) - { - int var52 = 0; - - double threshold = -20D; - - //if (this.isEnd) - // threshold = 0D; - - if (var47 > threshold) - { - if (this.isNether) - var52 = Block.netherrack.blockID; - else - var52 = Block.stone.blockID; - } - - var3[var43] = var52; - var43 += var44; - var47 += var49; - } - - var34 += var38; - var36 += var40; - } - - var15 += var23; - var17 += var25; - var19 += var27; - var21 += var29; - } - } - } - } - } - - public void replaceBlocksForBiome(int var1, int var2, int[] var3, BiomeGenBase[] var4) - { - byte var5 = 64; - double var6 = 0.03125D; - this.sandNoise = this.field_909_n.generateNoiseOctaves(this.sandNoise, (double)(var1 * 16), (double)(var2 * 16), 0.0D, 16, 16, 1, var6, var6, 1.0D); - this.gravelNoise = this.field_909_n.generateNoiseOctaves(this.gravelNoise, (double)(var1 * 16), 109.0134D, (double)(var2 * 16), 16, 1, 16, var6, 1.0D, var6); - this.stoneNoise = this.field_908_o.generateNoiseOctaves(this.stoneNoise, (double)(var1 * 16), (double)(var2 * 16), 0.0D, 16, 16, 1, var6 * 2.0D, var6 * 2.0D, var6 * 2.0D); - - for (int var8 = 0; var8 < 16; ++var8) - { - for (int var9 = 0; var9 < 16; ++var9) - { - BiomeGenBase var10 = var4[var8 + var9 * 16]; - boolean var11 = this.sandNoise[var8 + var9 * 16] + this.rand.nextDouble() * 0.2D > 0.0D; - boolean var12 = this.gravelNoise[var8 + var9 * 16] + this.rand.nextDouble() * 0.2D > 3.0D; - int var13 = (int)(this.stoneNoise[var8 + var9 * 16] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); - int var14 = -1; - int var15; - int var16; - - if (var10 instanceof BTABiome) { - var15 = ((BTABiome) var10).topBlockExt; - var16 = ((BTABiome) var10).fillerBlockExt; - } - else { - var15 = var10.topBlock; - var16 = var10.fillerBlock; - } - - for (int var17 = 127; var17 >= 0; --var17) - { - int var18 = (var8 * 16 + var9) * 128 + var17; - int var19 = var3[var18]; - - if (var19 == 0) - { - var14 = -1; - } - else if (var19 == Block.stone.blockID) - { - if (var14 == -1) - { - var3[var18] = var15; - var14 = var13; - - if (var10.biomeID == BetterBiomesConfiguration.badlandsPlateau.biomeID) - var14 += 10; - } - else if (var14 > 0) - { - --var14; - var3[var18] = var16; - - if (var14 == 0 && var16 == Block.sand.blockID) - { - var14 = this.rand.nextInt(4); - var16 = Block.sandStone.blockID; - } - else if (DecoIntegration.isDecoInstalled() && var14 == 0 && var16 == DecoIntegration.redSand.blockID) - { - var14 = this.rand.nextInt(4); - var16 = DecoIntegration.redSandStone.blockID; - } - } - } - } - } - } - } - - /** - * loads or generates the chunk at the chunk location specified - */ - public Chunk loadChunk(int var1, int var2) - { - return this.provideChunk(var1, var2); - } - - /** - * 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 - */ - public Chunk provideChunk(int chunkX, int chunkZ) - { - this.rand.setSeed((long)chunkX * 341873128712L + (long)chunkZ * 132897987541L); - int[] blockArray = new int[32768]; - int[] metaArray = new int[32768]; - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16); - - this.generateTerrain(chunkX, chunkZ, blockArray, this.biomesForGeneration); - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16); - SurfaceBuilder.replaceSurface(this.rand, this.seed, chunkX, chunkZ, blockArray, metaArray, biomesForGeneration, generatorInfo, this.worldObj.provider.terrainType); - - this.mapGenCaves.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.ravineGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - //this.villageGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - //this.strongholdGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - this.scatteredFeatureGenerator.generate(this, this.worldObj, chunkX, chunkZ, blockArray); - } - - Chunk chunk = new BTAChunk(this.worldObj, blockArray, metaArray, chunkX, chunkZ); - byte[] var6 = chunk.getBiomeArray(); - - for (int var7 = 0; var7 < var6.length; ++var7) - { - var6[var7] = (byte)this.biomesForGeneration[var7].biomeID; - } - - chunk.generateSkylightMap(); - return chunk; - } - - - - private double[] initializeNoiseField(double[] var1, int var2, int var3, int var4, int var5, int var6, int var7) - { - if (var1 == null) - { - var1 = new double[var5 * var6 * var7]; - } - - double var8 = 684.412D; - double var10 = 684.412D; - this.field_4182_g = this.field_922_a.generateNoiseOctaves(this.field_4182_g, var2, var4, var5, var7, 1.121D, 1.121D, 0.5D); - this.field_4181_h = this.field_921_b.generateNoiseOctaves(this.field_4181_h, var2, var4, var5, var7, 200.0D, 200.0D, 0.5D); - var8 *= 2.0D; - this.field_4185_d = this.field_910_m.generateNoiseOctaves(this.field_4185_d, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8 / 80.0D, var10 / 160.0D, var8 / 80.0D); - this.field_4184_e = this.field_912_k.generateNoiseOctaves(this.field_4184_e, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8, var10, var8); - this.field_4183_f = this.field_911_l.generateNoiseOctaves(this.field_4183_f, (double)var2, (double)var3, (double)var4, var5, var6, var7, var8, var10, var8); - int var14 = 0; - int var15 = 0; - int var16 = 16 / var5; - - for (int var17 = 0; var17 < var5; ++var17) - { - int var18 = var17 * var16 + var16 / 2; - - for (int var19 = 0; var19 < var7; ++var19) - { - int var20 = var19 * var16 + var16 / 2; - double var21; - double var23; - double var25 = (this.field_4182_g[var15] + 256.0D) / 512.0D; - - if (var25 > 1.0D) - { - var25 = 1.0D; - } - - double var27 = this.field_4181_h[var15] / 8000.0D; - - if (var27 < 0.0D) - { - var27 = -var27 * 0.3D; - } - - var27 = var27 * 3.0D - 2.0D; - - if (var27 > 1.0D) - { - var27 = 1.0D; - } - - var27 /= 8.0D; - var27 = 0.0D; - - if (var25 < 0.0D) - { - var25 = 0.0D; - } - - var25 += 0.5D; - var27 = var27 * (double)var6 / 16.0D; - ++var15; - double var29 = (double)var6 / 2.0D; - - for (int var31 = 0; var31 < var6; ++var31) - { - double var32 = 0.0D; - double var34 = ((double)var31 - var29) * 8.0D / var25; - - if (var34 < 0.0D) - { - var34 *= -1.0D; - } - - double var36 = this.field_4184_e[var14] / 512.0D; - double var38 = this.field_4183_f[var14] / 512.0D; - double var40 = (this.field_4185_d[var14] / 10.0D + 1.0D) / 2.0D; - - if (var40 < 0.0D) - { - var32 = var36; - } - else if (var40 > 1.0D) - { - var32 = var38; - } - else - { - var32 = var36 + (var38 - var36) * var40; - } - - var32 -= 8.0D; - byte var42 = 32; - double var43; - - if (var31 > var6 - var42) - { - var43 = (double)((float)(var31 - (var6 - var42)) / ((float)var42 - 1.0F)); - var32 = var32 * (1.0D - var43) + -30.0D * var43; - } - - var42 = 8; - - if (var31 < var42) - { - var43 = (double)((float)(var42 - var31) / ((float)var42 - 1.0F)); - var32 = var32 * (1.0D - var43) + -30.0D * var43; - } - - var1[var14] = var32; - ++var14; - } - } - } - - return var1; - } - - /** - * Checks to see if a chunk exists at x, y - */ - public boolean chunkExists(int var1, int var2) - { - return true; - } - - /** - * Populates chunk with ores etc etc - */ - public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) - { - if (this.isNether) { - this.populateNether(par1IChunkProvider, par2, par3); - return; - } - - BlockSand.fallInstantly = true; - int x = par2 * 16; - int z = par3 * 16; - BiomeGenBase b = this.worldObj.getBiomeGenForCoords(x + 16, z + 16); - this.rand.setSeed(this.worldObj.getSeed()); - long var7 = this.rand.nextLong() / 2L * 2L + 1L; - long var9 = this.rand.nextLong() / 2L * 2L + 1L; - long var11 = this.rand.nextLong() / 2L * 2L + 1L; - long var13 = this.rand.nextLong() / 2L * 2L + 1L; - this.rand.setSeed((long)par2 * var7 + (long)par3 * var9 ^ this.worldObj.getSeed()); - boolean var15 = false; - - if (this.mapFeaturesEnabled) - { - this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); - this.m_structureRand.setSeed((long)par2 * var11 + (long)par3 * var13 ^ this.worldObj.getSeed()); - var15 = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, par2, par3); - this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, par2, par3); - this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.m_structureRand, par2, par3); - } - - int var16; - int var17; - int var18; - - if (!var15 && this.rand.nextInt(1) == 0) - { - var16 = x + this.rand.nextInt(16) + 8; - var17 = this.rand.nextInt(128); - var18 = z + this.rand.nextInt(16) + 8; - (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, var16, var17, var18); - } - - for (int i = 0; i < 20; i++) - { - var16 = x + this.rand.nextInt(16) + 8; - var17 = z + this.rand.nextInt(16) + 8; - var18 = this.rand.nextInt(128); - new WorldGenReed().generate(this.worldObj, this.rand, var16, var18, var17); - } - - if (!var15 && this.rand.nextInt(4) == 0) - { - var16 = x + this.rand.nextInt(16) + 8; - var17 = this.rand.nextInt(this.rand.nextInt(120) + 8); - var18 = z + this.rand.nextInt(16) + 8; - - if (var17 < 63 || this.rand.nextInt(10) == 0) - { - (new WorldGenLakes(Block.lavaStill.blockID)).generate(this.worldObj, this.rand, var16, var17, var18); - } - } - - for (var16 = 0; var16 < 16; ++var16) - { - var17 = x + this.rand.nextInt(16) + 8; - var18 = this.rand.nextInt(128); - int var19 = z + this.rand.nextInt(16) + 8; - - if ((new WorldGenDungeons()).generate(this.worldObj, this.rand, var17, var18, var19)) - { - ; - } - } - - if (b instanceof BTABiome) { - ((BTABiome) b).getSurfaceBuilder().decorateSurface(worldObj, this.rand, (BTABiome) b, x, z, this.generatorInfo); - ((BTABiome) b).decorate(this.worldObj, this.rand, x, z, this.generatorInfo); - } - else { - b.decorate(this.worldObj, this.rand, x, z); - } - SpawnerAnimals.performWorldGenSpawning(this.worldObj, b, x + 8, z + 8, 16, 16, this.rand); - - x += 8; - z += 8; - - for (var16 = 0; var16 < 16; ++var16) - { - for (var17 = 0; var17 < 16; ++var17) - { - var18 = this.worldObj.getPrecipitationHeight(x + var16, z + var17); - - if (this.worldObj.isBlockFreezable(var16 + x, var18 - 1, var17 + z)) - { - this.worldObj.setBlock(var16 + x, var18 - 1, var17 + z, Block.ice.blockID, 0, 2); - } - - if (this.worldObj.canSnowAt(var16 + x, var18, var17 + z)) - { - this.worldObj.setBlock(var16 + x, var18, var17 + z, Block.snow.blockID, 0, 2); - } - } - } - - BlockSand.fallInstantly = false; - this.BTWPostProcessChunk(this.worldObj, x - 8, z - 8); - } - - /** - * Populates chunk with ores etc etc - */ - public void populateNether(IChunkProvider par1IChunkProvider, int par2, int par3) - { - BlockSand.fallInstantly = true; - int var4 = par2 * 16; - int var5 = par3 * 16; - this.genNetherBridge.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); - int var6; - int var7; - int var8; - int var9; - - for (var6 = 0; var6 < 8; ++var6) - { - var7 = var4 + this.rand.nextInt(16) + 8; - var8 = this.rand.nextInt(120) + 4; - var9 = var5 + this.rand.nextInt(16) + 8; - (new WorldGenHellLava(Block.lavaMoving.blockID, false)).generate(this.worldObj, this.rand, var7, var8, var9); - } - - var6 = this.rand.nextInt(this.rand.nextInt(10) + 10) + 1; - int var10; - - for (var7 = 0; var7 < var6; ++var7) - { - var8 = var4 + this.rand.nextInt(16) + 8; - var9 = this.rand.nextInt(120) + 4; - var10 = var5 + this.rand.nextInt(16) + 8; - (new WorldGenFire()).generate(this.worldObj, this.rand, var8, var9, var10); - } - - var6 = this.rand.nextInt(this.rand.nextInt(10) + 1); - - for (var7 = 0; var7 < var6; ++var7) - { - var8 = var4 + this.rand.nextInt(16) + 8; - var9 = this.rand.nextInt(120) + 4; - var10 = var5 + this.rand.nextInt(16) + 8; - (new WorldGenGlowStone1()).generate(this.worldObj, this.rand, var8, var9, var10); - } - - for (var7 = 0; var7 < 20; ++var7) - { - var8 = var4 + this.rand.nextInt(16) + 8; - var9 = this.rand.nextInt(128); - var10 = var5 + this.rand.nextInt(16) + 8; - (new WorldGenGlowStone2()).generate(this.worldObj, this.rand, var8, var9, var10); - } - - if (this.rand.nextInt(1) == 0) - { - var7 = var4 + this.rand.nextInt(16) + 8; - var8 = this.rand.nextInt(128); - var9 = var5 + this.rand.nextInt(16) + 8; - (new WorldGenFlowers(Block.mushroomBrown.blockID)).generate(this.worldObj, this.rand, var7, var8, var9); - } - - if (this.rand.nextInt(1) == 0) - { - var7 = var4 + this.rand.nextInt(16) + 8; - var8 = this.rand.nextInt(128); - var9 = var5 + this.rand.nextInt(16) + 8; - (new WorldGenFlowers(Block.mushroomRed.blockID)).generate(this.worldObj, this.rand, var7, var8, var9); - } - - WorldGenMinable var11 = new WorldGenMinable(Block.oreNetherQuartz.blockID, 13, Block.netherrack.blockID); - int var12; - - for (var8 = 0; var8 < 16; ++var8) - { - var9 = var4 + this.rand.nextInt(16); - var10 = this.rand.nextInt(108) + 10; - var12 = var5 + this.rand.nextInt(16); - var11.generate(this.worldObj, this.rand, var9, var10, var12); - } - - for (var8 = 0; var8 < 16; ++var8) - { - var9 = var4 + this.rand.nextInt(16) + 8; - var10 = this.rand.nextInt(108) + 10; - var12 = var5 + this.rand.nextInt(16) + 8; - (new WorldGenHellLava(Block.lavaMoving.blockID, true)).generate(this.worldObj, this.rand, var9, var10, var12); - } - - BlockSand.fallInstantly = false; - } - - private void BTWPostProcessChunk(World var1, int var2, int var3) - { - if (var1.provider.dimensionId == 0) - { - this.GenerateStrata(var1, var2, var3); - this.GenerateAdditionalBrownMushrooms(var1, var2, var3); - } - } - - private void GenerateAdditionalBrownMushrooms(World var1, int var2, int var3) - { - if (var1.rand.nextInt(4) == 0) - { - WorldGenFlowers var4 = new WorldGenFlowers(Block.mushroomBrown.blockID); - int var5 = var2 + var1.rand.nextInt(16) + 8; - int var6 = var1.rand.nextInt(25); - int var7 = var3 + var1.rand.nextInt(16) + 8; - var4.generate(var1, var1.rand, var5, var6, var7); - } - } - - private void GenerateStrata(World var1, int var2, int var3) - { - Chunk var4 = var1.getChunkFromChunkCoords(var2 >> 4, var3 >> 4); - - for (int var5 = 0; var5 < 16; ++var5) - { - for (int var6 = 0; var6 < 16; ++var6) - { - int var7 = 0; - int var8; - int var9; - - for (var8 = 32 + var1.rand.nextInt(2); var7 <= var8; ++var7) - { - var9 = var4.getBlockID(var5, var7, var6); - - if (var9 == Block.stone.blockID) - { - var4.setBlockMetadata(var5, var7, var6, 2); - } - } - - for (var8 = 48 + var1.rand.nextInt(2); var7 <= var8; ++var7) - { - var9 = var4.getBlockID(var5, var7, var6); - - if (var9 == Block.stone.blockID) - { - var4.setBlockMetadata(var5, var7, var6, 1); - } - } - } - } - } - - /** - * 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. - */ - public boolean saveChunks(boolean var1, IProgressUpdate var2) - { - return true; - } - - /** - * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. - */ - public boolean unloadQueuedChunks() - { - return false; - } - - public boolean unload100OldestChunks() - { - return false; - } - - /** - * Returns if the IChunkProvider supports saving. - */ - public boolean canSave() - { - return true; - } - - /** - * Converts the instance data to a readable string. - */ - public String makeString() - { - return "RandomLevelSource"; - } - - /** - * Returns a list of creatures of the specified type that can spawn at the given location. - */ - public List getPossibleCreatures(EnumCreatureType creatureType, int x, int y, int z) { - BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(x, z); - - if (biome != null) { - if (!this.isNether && creatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(x, y, z)) { - List spawnList = this.scatteredFeatureGenerator.getScatteredFeatureSpawnList(); - - if (spawnList != null) { - return spawnList; - } - else { - return biome.getSpawnableList(creatureType); - } - } - else if (this.isNether && creatureType == EnumCreatureType.monster && this.genNetherBridge.HasStructureAtLoose(x, y, z)) { - List spawnList = this.genNetherBridge.getSpawnList(); - - if (spawnList != null) { - //spawnList.addAll(biome.getSpawnableList(creatureType)); - return spawnList; - } - else { - return biome.getSpawnableList(creatureType); - } - } - else { - return biome.getSpawnableList(creatureType); - } - } - else { - return null; - } - } - - @Override - public List getPossibleCreaturesStructuresOnly(EnumCreatureType creatureType, int x, int y, int z) { - BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(x, z); - - if (biome != null) { - if (!this.isNether && creatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(x, y, z)) { - List spawnList = this.scatteredFeatureGenerator.getScatteredFeatureSpawnList(); - - if (spawnList != null) { - return spawnList; - } - } - else if (this.isNether && creatureType == EnumCreatureType.monster && this.genNetherBridge.HasStructureAtLoose(x, y, z)) { - List spawnList = this.genNetherBridge.getSpawnList(); - - if (spawnList != null) { - //spawnList.addAll(biome.getSpawnableList(creatureType)); - return spawnList; - } - } - } - - return null; - } - - public boolean doesStructureExistAtCoords(int x, int y, int z) { - if (!this.isNether) { - return this.scatteredFeatureGenerator.hasStructureAt(x, y, z); - } - else { - return this.genNetherBridge.HasStructureAtLoose(x, y, z); - } - } - - /** - * Returns the location of the closest structure of the specified type. If not found returns null. - */ - public ChunkPosition findClosestStructure(World var1, String var2, int var3, int var4, int var5) - { - return "Stronghold".equals(var2) && this.strongholdGenerator != null ? this.strongholdGenerator.getNearestInstance(var1, var3, var4, var5) : null; - } - - public int getLoadedChunkCount() - { - return 0; - } - - public void recreateStructures(int var1, int var2) - { - if (this.mapFeaturesEnabled) - { - if (this.isNether) { - this.genNetherBridge.generate(this, this.worldObj, var1, var2, (int[])null); - } - else { - this.strongholdGenerator.generate(this, this.worldObj, var1, var2, (int[])null); - } - } - } - - public void func_104112_b() {} - - @Override - public boolean isNether() { - return this.isNether; - } - - @Override - public BTAMapGenNetherBridge getNetherBridgeGenerator() { - return this.isNether ? this.genNetherBridge : null; - } -} diff --git a/minecraft_server/betterterrain/world/generate/TerrainGenerator.java b/minecraft_server/betterterrain/world/generate/TerrainGenerator.java deleted file mode 100644 index 7027063..0000000 --- a/minecraft_server/betterterrain/world/generate/TerrainGenerator.java +++ /dev/null @@ -1,36 +0,0 @@ -package betterterrain.world.generate; - -public enum TerrainGenerator { - CLASSIC(0, "classic"), - SIMPLEX(1, "simplex"), - BETA(2, "beta"), - SKYLANDS(3, "skylands"); - - public final int id; - public final String name; - - TerrainGenerator(int id, String name) { - this.id = id; - this.name = name; - } - - public static TerrainGenerator fromId(int id) { - for (TerrainGenerator gen : values()) { - if (gen.id == id) { - return gen; - } - } - - return null; - } - - public static TerrainGenerator fromName(String name) { - for (TerrainGenerator gen : values()) { - if (gen.name.equals(name)) { - return gen; - } - } - - return null; - } -} diff --git a/minecraft_server/betterterrain/world/generate/noise/BetaNoiseOctaves.java b/minecraft_server/betterterrain/world/generate/noise/BetaNoiseOctaves.java deleted file mode 100644 index 204df4f..0000000 --- a/minecraft_server/betterterrain/world/generate/noise/BetaNoiseOctaves.java +++ /dev/null @@ -1,73 +0,0 @@ -// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. -// Jad home page: http://www.kpdus.com/jad.html -// Decompiler options: packimports(3) braces deadcode - -package betterterrain.world.generate.noise; - -import java.util.Random; - -import net.minecraft.src.NoiseGenerator; - -// Referenced classes of package net.minecraft.src: -// NoiseGenerator, NoiseGeneratorPerlin - -public class BetaNoiseOctaves extends NoiseGenerator -{ - private BetaNoisePerlin generatorCollection[]; - private int field_1191_b; - - public BetaNoiseOctaves(Random random, int i) - { - field_1191_b = i; - generatorCollection = new BetaNoisePerlin[i]; - for(int j = 0; j < i; j++) - { - generatorCollection[j] = new BetaNoisePerlin(random); - } - - } - - public double func_806_a(double d, double d1) - { - double d2 = 0.0D; - double d3 = 1.0D; - for(int i = 0; i < field_1191_b; i++) - { - d2 += generatorCollection[i].func_801_a(d * d3, d1 * d3) / d3; - d3 /= 2D; - } - - return d2; - } - - public double[] generateNoiseOctaves(double ad[], double d, double d1, double d2, - int i, int j, int k, double d3, double d4, - double d5) - { - if(ad == null) - { - ad = new double[i * j * k]; - } else - { - for(int l = 0; l < ad.length; l++) - { - ad[l] = 0.0D; - } - - } - double d6 = 1.0D; - for(int i1 = 0; i1 < field_1191_b; i1++) - { - generatorCollection[i1].func_805_a(ad, d, d1, d2, i, j, k, d3 * d6, d4 * d6, d5 * d6, d6); - d6 /= 2D; - } - - return ad; - } - - public double[] generateNoiseOctaves(double ad[], int i, int j, int k, int l, double d, - double d1, double d2) - { - return generateNoiseOctaves(ad, i, 10D, j, k, 1, l, d, 1.0D, d1); - } -} diff --git a/minecraft_server/betterterrain/world/generate/noise/BetaNoisePerlin.java b/minecraft_server/betterterrain/world/generate/noise/BetaNoisePerlin.java deleted file mode 100644 index 2038a8c..0000000 --- a/minecraft_server/betterterrain/world/generate/noise/BetaNoisePerlin.java +++ /dev/null @@ -1,234 +0,0 @@ -// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. -// Jad home page: http://www.kpdus.com/jad.html -// Decompiler options: packimports(3) braces deadcode - -package betterterrain.world.generate.noise; - -import java.util.Random; - -import net.minecraft.src.NoiseGenerator; - -// Referenced classes of package net.minecraft.src: -// NoiseGenerator - -public class BetaNoisePerlin extends NoiseGenerator -{ - - public BetaNoisePerlin() - { - this(new Random()); - } - - public BetaNoisePerlin(Random random) - { - permutations = new int[512]; - xCoord = random.nextDouble() * 256D; - yCoord = random.nextDouble() * 256D; - zCoord = random.nextDouble() * 256D; - for(int i = 0; i < 256; i++) - { - permutations[i] = i; - } - - for(int j = 0; j < 256; j++) - { - int k = random.nextInt(256 - j) + j; - int l = permutations[j]; - permutations[j] = permutations[k]; - permutations[k] = l; - permutations[j + 256] = permutations[j]; - } - - } - - public double generateNoise(double d, double d1, double d2) - { - double d3 = d + xCoord; - double d4 = d1 + yCoord; - double d5 = d2 + zCoord; - int i = (int)d3; - int j = (int)d4; - int k = (int)d5; - if(d3 < (double)i) - { - i--; - } - if(d4 < (double)j) - { - j--; - } - if(d5 < (double)k) - { - k--; - } - int l = i & 0xff; - int i1 = j & 0xff; - int j1 = k & 0xff; - d3 -= i; - d4 -= j; - d5 -= k; - double d6 = d3 * d3 * d3 * (d3 * (d3 * 6D - 15D) + 10D); - double d7 = d4 * d4 * d4 * (d4 * (d4 * 6D - 15D) + 10D); - double d8 = d5 * d5 * d5 * (d5 * (d5 * 6D - 15D) + 10D); - int k1 = permutations[l] + i1; - int l1 = permutations[k1] + j1; - int i2 = permutations[k1 + 1] + j1; - int j2 = permutations[l + 1] + i1; - int k2 = permutations[j2] + j1; - int l2 = permutations[j2 + 1] + j1; - return lerp(d8, lerp(d7, lerp(d6, grad(permutations[l1], d3, d4, d5), grad(permutations[k2], d3 - 1.0D, d4, d5)), lerp(d6, grad(permutations[i2], d3, d4 - 1.0D, d5), grad(permutations[l2], d3 - 1.0D, d4 - 1.0D, d5))), lerp(d7, lerp(d6, grad(permutations[l1 + 1], d3, d4, d5 - 1.0D), grad(permutations[k2 + 1], d3 - 1.0D, d4, d5 - 1.0D)), lerp(d6, grad(permutations[i2 + 1], d3, d4 - 1.0D, d5 - 1.0D), grad(permutations[l2 + 1], d3 - 1.0D, d4 - 1.0D, d5 - 1.0D)))); - } - - public final double lerp(double d, double d1, double d2) - { - return d1 + d * (d2 - d1); - } - - public final double func_4110_a(int i, double d, double d1) - { - int j = i & 0xf; - double d2 = (double)(1 - ((j & 8) >> 3)) * d; - double d3 = j >= 4 ? j != 12 && j != 14 ? d1 : d : 0.0D; - return ((j & 1) != 0 ? -d2 : d2) + ((j & 2) != 0 ? -d3 : d3); - } - - public final double grad(int i, double d, double d1, double d2) - { - int j = i & 0xf; - double d3 = j >= 8 ? d1 : d; - double d4 = j >= 4 ? j != 12 && j != 14 ? d2 : d : d1; - return ((j & 1) != 0 ? -d3 : d3) + ((j & 2) != 0 ? -d4 : d4); - } - - public double func_801_a(double d, double d1) - { - return generateNoise(d, d1, 0.0D); - } - - public void func_805_a(double ad[], double d, double d1, double d2, - int i, int j, int k, double d3, double d4, - double d5, double d6) - { - if(j == 1) - { - boolean flag = false; - boolean flag1 = false; - boolean flag2 = false; - boolean flag3 = false; - double d8 = 0.0D; - double d10 = 0.0D; - int j3 = 0; - double d12 = 1.0D / d6; - for(int i4 = 0; i4 < i; i4++) - { - double d14 = (d + (double)i4) * d3 + xCoord; - int j4 = (int)d14; - if(d14 < (double)j4) - { - j4--; - } - int k4 = j4 & 0xff; - d14 -= j4; - double d17 = d14 * d14 * d14 * (d14 * (d14 * 6D - 15D) + 10D); - for(int l4 = 0; l4 < k; l4++) - { - double d19 = (d2 + (double)l4) * d5 + zCoord; - int j5 = (int)d19; - if(d19 < (double)j5) - { - j5--; - } - int l5 = j5 & 0xff; - d19 -= j5; - double d21 = d19 * d19 * d19 * (d19 * (d19 * 6D - 15D) + 10D); - int l = permutations[k4] + 0; - int j1 = permutations[l] + l5; - int k1 = permutations[k4 + 1] + 0; - int l1 = permutations[k1] + l5; - double d9 = lerp(d17, func_4110_a(permutations[j1], d14, d19), grad(permutations[l1], d14 - 1.0D, 0.0D, d19)); - double d11 = lerp(d17, grad(permutations[j1 + 1], d14, 0.0D, d19 - 1.0D), grad(permutations[l1 + 1], d14 - 1.0D, 0.0D, d19 - 1.0D)); - double d23 = lerp(d21, d9, d11); - ad[j3++] += d23 * d12; - } - - } - - return; - } - int i1 = 0; - double d7 = 1.0D / d6; - int i2 = -1; - boolean flag4 = false; - boolean flag5 = false; - boolean flag6 = false; - boolean flag7 = false; - boolean flag8 = false; - boolean flag9 = false; - double d13 = 0.0D; - double d15 = 0.0D; - double d16 = 0.0D; - double d18 = 0.0D; - for(int i5 = 0; i5 < i; i5++) - { - double d20 = (d + (double)i5) * d3 + xCoord; - int k5 = (int)d20; - if(d20 < (double)k5) - { - k5--; - } - int i6 = k5 & 0xff; - d20 -= k5; - double d22 = d20 * d20 * d20 * (d20 * (d20 * 6D - 15D) + 10D); - for(int j6 = 0; j6 < k; j6++) - { - double d24 = (d2 + (double)j6) * d5 + zCoord; - int k6 = (int)d24; - if(d24 < (double)k6) - { - k6--; - } - int l6 = k6 & 0xff; - d24 -= k6; - double d25 = d24 * d24 * d24 * (d24 * (d24 * 6D - 15D) + 10D); - for(int i7 = 0; i7 < j; i7++) - { - double d26 = (d1 + (double)i7) * d4 + yCoord; - int j7 = (int)d26; - if(d26 < (double)j7) - { - j7--; - } - int k7 = j7 & 0xff; - d26 -= j7; - double d27 = d26 * d26 * d26 * (d26 * (d26 * 6D - 15D) + 10D); - if(i7 == 0 || k7 != i2) - { - i2 = k7; - int j2 = permutations[i6] + k7; - int k2 = permutations[j2] + l6; - int l2 = permutations[j2 + 1] + l6; - int i3 = permutations[i6 + 1] + k7; - int k3 = permutations[i3] + l6; - int l3 = permutations[i3 + 1] + l6; - d13 = lerp(d22, grad(permutations[k2], d20, d26, d24), grad(permutations[k3], d20 - 1.0D, d26, d24)); - d15 = lerp(d22, grad(permutations[l2], d20, d26 - 1.0D, d24), grad(permutations[l3], d20 - 1.0D, d26 - 1.0D, d24)); - d16 = lerp(d22, grad(permutations[k2 + 1], d20, d26, d24 - 1.0D), grad(permutations[k3 + 1], d20 - 1.0D, d26, d24 - 1.0D)); - d18 = lerp(d22, grad(permutations[l2 + 1], d20, d26 - 1.0D, d24 - 1.0D), grad(permutations[l3 + 1], d20 - 1.0D, d26 - 1.0D, d24 - 1.0D)); - } - double d28 = lerp(d27, d13, d15); - double d29 = lerp(d27, d16, d18); - double d30 = lerp(d25, d28, d29); - ad[i1++] += d30 * d7; - } - - } - - } - - } - - private int permutations[]; - public double xCoord; - public double yCoord; - public double zCoord; -} diff --git a/minecraft_server/betterterrain/world/generate/noise/FastNoise.java b/minecraft_server/betterterrain/world/generate/noise/FastNoise.java deleted file mode 100644 index 9d20922..0000000 --- a/minecraft_server/betterterrain/world/generate/noise/FastNoise.java +++ /dev/null @@ -1,2051 +0,0 @@ -// FastNoise.java -// -// MIT License -// -// Copyright(c) 2017 Jordan Peck -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// The developer's email is jorzixdan.me2@gzixmail.com (for great email, take -// off every 'zix'.) -// - -package betterterrain.world.generate.noise; - -public class FastNoise { - public enum NoiseType {Value, ValueFractal, Perlin, PerlinFractal, Simplex, SimplexFractal, Cellular, WhiteNoise, Cubic, CubicFractal} - public enum Interp {Linear, Hermite, Quintic} - public enum FractalType {FBM, Billow, RigidMulti} - public enum CellularDistanceFunction {Euclidean, Manhattan, Natural} - public enum CellularReturnType {CellValue, NoiseLookup, Distance, Distance2, Distance2Add, Distance2Sub, Distance2Mul, Distance2Div} - - private int m_seed = 1337; - private float m_frequency = (float) 0.01; - private Interp m_interp = Interp.Quintic; - private NoiseType m_noiseType = NoiseType.Simplex; - - private int m_octaves = 3; - private float m_lacunarity = (float) 2.0; - private float m_gain = (float) 0.5; - private FractalType m_fractalType = FractalType.FBM; - - private float m_fractalBounding; - - private CellularDistanceFunction m_cellularDistanceFunction = CellularDistanceFunction.Euclidean; - private CellularReturnType m_cellularReturnType = CellularReturnType.CellValue; - private FastNoise m_cellularNoiseLookup = null; - - private float m_gradientPerturbAmp = (float) (1.0 / 0.45); - - public FastNoise() { - this(1337); - } - - public FastNoise(int seed) { - m_seed = seed; - CalculateFractalBounding(); - } - - // Returns a 0 float/double - public static float GetDecimalType() { - return 0; - } - - // Returns the seed used by this object - public int GetSeed() { - return m_seed; - } - - // Sets seed used for all noise types - // Default: 1337 - public void SetSeed(int seed) { - m_seed = seed; - } - - // Sets frequency for all noise types - // Default: 0.01 - public void SetFrequency(float frequency) { - m_frequency = frequency; - } - - // Changes the interpolation method used to smooth between noise values - // Possible interpolation methods (lowest to highest quality) : - // - Linear - // - Hermite - // - Quintic - // Used in Value, Gradient Noise and Position Perturbing - // Default: Quintic - public void SetInterp(Interp interp) { - m_interp = interp; - } - - // Sets noise return type of GetNoise(...) - // Default: Simplex - public void SetNoiseType(NoiseType noiseType) { - m_noiseType = noiseType; - } - - // Sets octave count for all fractal noise types - // Default: 3 - public void SetFractalOctaves(int octaves) { - m_octaves = octaves; - CalculateFractalBounding(); - } - - // Sets octave lacunarity for all fractal noise types - // Default: 2.0 - public void SetFractalLacunarity(float lacunarity) { - m_lacunarity = lacunarity; - } - - // Sets octave gain for all fractal noise types - // Default: 0.5 - public void SetFractalGain(float gain) { - m_gain = gain; - CalculateFractalBounding(); - } - - // Sets method for combining octaves in all fractal noise types - // Default: FBM - public void SetFractalType(FractalType fractalType) { - m_fractalType = fractalType; - } - - // Sets return type from cellular noise calculations - // Note: NoiseLookup requires another FastNoise object be set with SetCellularNoiseLookup() to function - // Default: CellValue - public void SetCellularDistanceFunction(CellularDistanceFunction cellularDistanceFunction) { - m_cellularDistanceFunction = cellularDistanceFunction; - } - - // Sets distance function used in cellular noise calculations - // Default: Euclidean - public void SetCellularReturnType(CellularReturnType cellularReturnType) { - m_cellularReturnType = cellularReturnType; - } - - // Noise used to calculate a cell value if cellular return type is NoiseLookup - // The lookup value is acquired through GetNoise() so ensure you SetNoiseType() on the noise lookup, value, gradient or simplex is recommended - public void SetCellularNoiseLookup(FastNoise noise) { - m_cellularNoiseLookup = noise; - } - - // Sets the maximum perturb distance from original location when using GradientPerturb{Fractal}(...) - // Default: 1.0 - public void SetGradientPerturbAmp(float gradientPerturbAmp) { - m_gradientPerturbAmp = gradientPerturbAmp / (float) 0.45; - } - - private static class Float2 { - public final float x, y; - - public Float2(float x, float y) { - this.x = x; - this.y = y; - } - } - - private static class Float3 { - public final float x, y, z; - - public Float3(float x, float y, float z) { - this.x = x; - this.y = y; - this.z = z; - } - } - - private static final Float2[] GRAD_2D = { - new Float2(-1, -1), new Float2(1, -1), new Float2(-1, 1), new Float2(1, 1), - new Float2(0, -1), new Float2(-1, 0), new Float2(0, 1), new Float2(1, 0), - }; - - private static final Float3[] GRAD_3D = { - new Float3(1, 1, 0), new Float3(-1, 1, 0), new Float3(1, -1, 0), new Float3(-1, -1, 0), - new Float3(1, 0, 1), new Float3(-1, 0, 1), new Float3(1, 0, -1), new Float3(-1, 0, -1), - new Float3(0, 1, 1), new Float3(0, -1, 1), new Float3(0, 1, -1), new Float3(0, -1, -1), - new Float3(1, 1, 0), new Float3(0, -1, 1), new Float3(-1, 1, 0), new Float3(0, -1, -1), - }; - - private static final Float2[] CELL_2D = - { - new Float2(-0.4313539279f, 0.1281943404f), new Float2(-0.1733316799f, 0.415278375f), new Float2(-0.2821957395f, -0.3505218461f), new Float2(-0.2806473808f, 0.3517627718f), new Float2(0.3125508975f, -0.3237467165f), new Float2(0.3383018443f, -0.2967353402f), new Float2(-0.4393982022f, -0.09710417025f), new Float2(-0.4460443703f, -0.05953502905f), - new Float2(-0.302223039f, 0.3334085102f), new Float2(-0.212681052f, -0.3965687458f), new Float2(-0.2991156529f, 0.3361990872f), new Float2(0.2293323691f, 0.3871778202f), new Float2(0.4475439151f, -0.04695150755f), new Float2(0.1777518f, 0.41340573f), new Float2(0.1688522499f, -0.4171197882f), new Float2(-0.0976597166f, 0.4392750616f), - new Float2(0.08450188373f, 0.4419948321f), new Float2(-0.4098760448f, -0.1857461384f), new Float2(0.3476585782f, -0.2857157906f), new Float2(-0.3350670039f, -0.30038326f), new Float2(0.2298190031f, -0.3868891648f), new Float2(-0.01069924099f, 0.449872789f), new Float2(-0.4460141246f, -0.05976119672f), new Float2(0.3650293864f, 0.2631606867f), - new Float2(-0.349479423f, 0.2834856838f), new Float2(-0.4122720642f, 0.1803655873f), new Float2(-0.267327811f, 0.3619887311f), new Float2(0.322124041f, -0.3142230135f), new Float2(0.2880445931f, -0.3457315612f), new Float2(0.3892170926f, -0.2258540565f), new Float2(0.4492085018f, -0.02667811596f), new Float2(-0.4497724772f, 0.01430799601f), - new Float2(0.1278175387f, -0.4314657307f), new Float2(-0.03572100503f, 0.4485799926f), new Float2(-0.4297407068f, -0.1335025276f), new Float2(-0.3217817723f, 0.3145735065f), new Float2(-0.3057158873f, 0.3302087162f), new Float2(-0.414503978f, 0.1751754899f), new Float2(-0.3738139881f, 0.2505256519f), new Float2(0.2236891408f, -0.3904653228f), - new Float2(0.002967775577f, -0.4499902136f), new Float2(0.1747128327f, -0.4146991995f), new Float2(-0.4423772489f, -0.08247647938f), new Float2(-0.2763960987f, -0.355112935f), new Float2(-0.4019385906f, -0.2023496216f), new Float2(0.3871414161f, -0.2293938184f), new Float2(-0.430008727f, 0.1326367019f), new Float2(-0.03037574274f, -0.4489736231f), - new Float2(-0.3486181573f, 0.2845441624f), new Float2(0.04553517144f, -0.4476902368f), new Float2(-0.0375802926f, 0.4484280562f), new Float2(0.3266408905f, 0.3095250049f), new Float2(0.06540017593f, -0.4452222108f), new Float2(0.03409025829f, 0.448706869f), new Float2(-0.4449193635f, 0.06742966669f), new Float2(-0.4255936157f, -0.1461850686f), - new Float2(0.449917292f, 0.008627302568f), new Float2(0.05242606404f, 0.4469356864f), new Float2(-0.4495305179f, -0.02055026661f), new Float2(-0.1204775703f, 0.4335725488f), new Float2(-0.341986385f, -0.2924813028f), new Float2(0.3865320182f, 0.2304191809f), new Float2(0.04506097811f, -0.447738214f), new Float2(-0.06283465979f, 0.4455915232f), - new Float2(0.3932600341f, -0.2187385324f), new Float2(0.4472261803f, -0.04988730975f), new Float2(0.3753571011f, -0.2482076684f), new Float2(-0.273662295f, 0.357223947f), new Float2(0.1700461538f, 0.4166344988f), new Float2(0.4102692229f, 0.1848760794f), new Float2(0.323227187f, -0.3130881435f), new Float2(-0.2882310238f, -0.3455761521f), - new Float2(0.2050972664f, 0.4005435199f), new Float2(0.4414085979f, -0.08751256895f), new Float2(-0.1684700334f, 0.4172743077f), new Float2(-0.003978032396f, 0.4499824166f), new Float2(-0.2055133639f, 0.4003301853f), new Float2(-0.006095674897f, -0.4499587123f), new Float2(-0.1196228124f, -0.4338091548f), new Float2(0.3901528491f, -0.2242337048f), - new Float2(0.01723531752f, 0.4496698165f), new Float2(-0.3015070339f, 0.3340561458f), new Float2(-0.01514262423f, -0.4497451511f), new Float2(-0.4142574071f, -0.1757577897f), new Float2(-0.1916377265f, -0.4071547394f), new Float2(0.3749248747f, 0.2488600778f), new Float2(-0.2237774255f, 0.3904147331f), new Float2(-0.4166343106f, -0.1700466149f), - new Float2(0.3619171625f, 0.267424695f), new Float2(0.1891126846f, -0.4083336779f), new Float2(-0.3127425077f, 0.323561623f), new Float2(-0.3281807787f, 0.307891826f), new Float2(-0.2294806661f, 0.3870899429f), new Float2(-0.3445266136f, 0.2894847362f), new Float2(-0.4167095422f, -0.1698621719f), new Float2(-0.257890321f, -0.3687717212f), - new Float2(-0.3612037825f, 0.2683874578f), new Float2(0.2267996491f, 0.3886668486f), new Float2(0.207157062f, 0.3994821043f), new Float2(0.08355176718f, -0.4421754202f), new Float2(-0.4312233307f, 0.1286329626f), new Float2(0.3257055497f, 0.3105090899f), new Float2(0.177701095f, -0.4134275279f), new Float2(-0.445182522f, 0.06566979625f), - new Float2(0.3955143435f, 0.2146355146f), new Float2(-0.4264613988f, 0.1436338239f), new Float2(-0.3793799665f, -0.2420141339f), new Float2(0.04617599081f, -0.4476245948f), new Float2(-0.371405428f, -0.2540826796f), new Float2(0.2563570295f, -0.3698392535f), new Float2(0.03476646309f, 0.4486549822f), new Float2(-0.3065454405f, 0.3294387544f), - new Float2(-0.2256979823f, 0.3893076172f), new Float2(0.4116448463f, -0.1817925206f), new Float2(-0.2907745828f, -0.3434387019f), new Float2(0.2842278468f, -0.348876097f), new Float2(0.3114589359f, -0.3247973695f), new Float2(0.4464155859f, -0.0566844308f), new Float2(-0.3037334033f, -0.3320331606f), new Float2(0.4079607166f, 0.1899159123f), - new Float2(-0.3486948919f, -0.2844501228f), new Float2(0.3264821436f, 0.3096924441f), new Float2(0.3211142406f, 0.3152548881f), new Float2(0.01183382662f, 0.4498443737f), new Float2(0.4333844092f, 0.1211526057f), new Float2(0.3118668416f, 0.324405723f), new Float2(-0.272753471f, 0.3579183483f), new Float2(-0.422228622f, -0.1556373694f), - new Float2(-0.1009700099f, -0.4385260051f), new Float2(-0.2741171231f, -0.3568750521f), new Float2(-0.1465125133f, 0.4254810025f), new Float2(0.2302279044f, -0.3866459777f), new Float2(-0.3699435608f, 0.2562064828f), new Float2(0.105700352f, -0.4374099171f), new Float2(-0.2646713633f, 0.3639355292f), new Float2(0.3521828122f, 0.2801200935f), - new Float2(-0.1864187807f, -0.4095705534f), new Float2(0.1994492955f, -0.4033856449f), new Float2(0.3937065066f, 0.2179339044f), new Float2(-0.3226158377f, 0.3137180602f), new Float2(0.3796235338f, 0.2416318948f), new Float2(0.1482921929f, 0.4248640083f), new Float2(-0.407400394f, 0.1911149365f), new Float2(0.4212853031f, 0.1581729856f), - new Float2(-0.2621297173f, 0.3657704353f), new Float2(-0.2536986953f, -0.3716678248f), new Float2(-0.2100236383f, 0.3979825013f), new Float2(0.3624152444f, 0.2667493029f), new Float2(-0.3645038479f, -0.2638881295f), new Float2(0.2318486784f, 0.3856762766f), new Float2(-0.3260457004f, 0.3101519002f), new Float2(-0.2130045332f, -0.3963950918f), - new Float2(0.3814998766f, -0.2386584257f), new Float2(-0.342977305f, 0.2913186713f), new Float2(-0.4355865605f, 0.1129794154f), new Float2(-0.2104679605f, 0.3977477059f), new Float2(0.3348364681f, -0.3006402163f), new Float2(0.3430468811f, 0.2912367377f), new Float2(-0.2291836801f, -0.3872658529f), new Float2(0.2547707298f, -0.3709337882f), - new Float2(0.4236174945f, -0.151816397f), new Float2(-0.15387742f, 0.4228731957f), new Float2(-0.4407449312f, 0.09079595574f), new Float2(-0.06805276192f, -0.444824484f), new Float2(0.4453517192f, -0.06451237284f), new Float2(0.2562464609f, -0.3699158705f), new Float2(0.3278198355f, -0.3082761026f), new Float2(-0.4122774207f, -0.1803533432f), - new Float2(0.3354090914f, -0.3000012356f), new Float2(0.446632869f, -0.05494615882f), new Float2(-0.1608953296f, 0.4202531296f), new Float2(-0.09463954939f, 0.4399356268f), new Float2(-0.02637688324f, -0.4492262904f), new Float2(0.447102804f, -0.05098119915f), new Float2(-0.4365670908f, 0.1091291678f), new Float2(-0.3959858651f, 0.2137643437f), - new Float2(-0.4240048207f, -0.1507312575f), new Float2(-0.3882794568f, 0.2274622243f), new Float2(-0.4283652566f, -0.1378521198f), new Float2(0.3303888091f, 0.305521251f), new Float2(0.3321434919f, -0.3036127481f), new Float2(-0.413021046f, -0.1786438231f), new Float2(0.08403060337f, -0.4420846725f), new Float2(-0.3822882919f, 0.2373934748f), - new Float2(-0.3712395594f, -0.2543249683f), new Float2(0.4472363971f, -0.04979563372f), new Float2(-0.4466591209f, 0.05473234629f), new Float2(0.0486272539f, -0.4473649407f), new Float2(-0.4203101295f, -0.1607463688f), new Float2(0.2205360833f, 0.39225481f), new Float2(-0.3624900666f, 0.2666476169f), new Float2(-0.4036086833f, -0.1989975647f), - new Float2(0.2152727807f, 0.3951678503f), new Float2(-0.4359392962f, -0.1116106179f), new Float2(0.4178354266f, 0.1670735057f), new Float2(0.2007630161f, 0.4027334247f), new Float2(-0.07278067175f, -0.4440754146f), new Float2(0.3644748615f, -0.2639281632f), new Float2(-0.4317451775f, 0.126870413f), new Float2(-0.297436456f, 0.3376855855f), - new Float2(-0.2998672222f, 0.3355289094f), new Float2(-0.2673674124f, 0.3619594822f), new Float2(0.2808423357f, 0.3516071423f), new Float2(0.3498946567f, 0.2829730186f), new Float2(-0.2229685561f, 0.390877248f), new Float2(0.3305823267f, 0.3053118493f), new Float2(-0.2436681211f, -0.3783197679f), new Float2(-0.03402776529f, 0.4487116125f), - new Float2(-0.319358823f, 0.3170330301f), new Float2(0.4454633477f, -0.06373700535f), new Float2(0.4483504221f, 0.03849544189f), new Float2(-0.4427358436f, -0.08052932871f), new Float2(0.05452298565f, 0.4466847255f), new Float2(-0.2812560807f, 0.3512762688f), new Float2(0.1266696921f, 0.4318041097f), new Float2(-0.3735981243f, 0.2508474468f), - new Float2(0.2959708351f, -0.3389708908f), new Float2(-0.3714377181f, 0.254035473f), new Float2(-0.404467102f, -0.1972469604f), new Float2(0.1636165687f, -0.419201167f), new Float2(0.3289185495f, -0.3071035458f), new Float2(-0.2494824991f, -0.3745109914f), new Float2(0.03283133272f, 0.4488007393f), new Float2(-0.166306057f, -0.4181414777f), - new Float2(-0.106833179f, 0.4371346153f), new Float2(0.06440260376f, -0.4453676062f), new Float2(-0.4483230967f, 0.03881238203f), new Float2(-0.421377757f, -0.1579265206f), new Float2(0.05097920662f, -0.4471030312f), new Float2(0.2050584153f, -0.4005634111f), new Float2(0.4178098529f, -0.167137449f), new Float2(-0.3565189504f, -0.2745801121f), - new Float2(0.4478398129f, 0.04403977727f), new Float2(-0.3399999602f, -0.2947881053f), new Float2(0.3767121994f, 0.2461461331f), new Float2(-0.3138934434f, 0.3224451987f), new Float2(-0.1462001792f, -0.4255884251f), new Float2(0.3970290489f, -0.2118205239f), new Float2(0.4459149305f, -0.06049689889f), new Float2(-0.4104889426f, -0.1843877112f), - new Float2(0.1475103971f, -0.4251360756f), new Float2(0.09258030352f, 0.4403735771f), new Float2(-0.1589664637f, -0.4209865359f), new Float2(0.2482445008f, 0.3753327428f), new Float2(0.4383624232f, -0.1016778537f), new Float2(0.06242802956f, 0.4456486745f), new Float2(0.2846591015f, -0.3485243118f), new Float2(-0.344202744f, -0.2898697484f), - new Float2(0.1198188883f, -0.4337550392f), new Float2(-0.243590703f, 0.3783696201f), new Float2(0.2958191174f, -0.3391033025f), new Float2(-0.1164007991f, 0.4346847754f), new Float2(0.1274037151f, -0.4315881062f), new Float2(0.368047306f, 0.2589231171f), new Float2(0.2451436949f, 0.3773652989f), new Float2(-0.4314509715f, 0.12786735f), - }; - - private static final Float3[] CELL_3D = - { - new Float3(0.1453787434f, -0.4149781685f, -0.0956981749f), new Float3(-0.01242829687f, -0.1457918398f, -0.4255470325f), new Float3(0.2877979582f, -0.02606483451f, -0.3449535616f), new Float3(-0.07732986802f, 0.2377094325f, 0.3741848704f), new Float3(0.1107205875f, -0.3552302079f, -0.2530858567f), new Float3(0.2755209141f, 0.2640521179f, -0.238463215f), new Float3(0.294168941f, 0.1526064594f, 0.3044271714f), new Float3(0.4000921098f, -0.2034056362f, 0.03244149937f), - new Float3(-0.1697304074f, 0.3970864695f, -0.1265461359f), new Float3(-0.1483224484f, -0.3859694688f, 0.1775613147f), new Float3(0.2623596946f, -0.2354852944f, 0.2796677792f), new Float3(-0.2709003183f, 0.3505271138f, -0.07901746678f), new Float3(-0.03516550699f, 0.3885234328f, 0.2243054374f), new Float3(-0.1267712655f, 0.1920044036f, 0.3867342179f), new Float3(0.02952021915f, 0.4409685861f, 0.08470692262f), new Float3(-0.2806854217f, -0.266996757f, 0.2289725438f), - new Float3(-0.171159547f, 0.2141185563f, 0.3568720405f), new Float3(0.2113227183f, 0.3902405947f, -0.07453178509f), new Float3(-0.1024352839f, 0.2128044156f, -0.3830421561f), new Float3(-0.3304249877f, -0.1566986703f, 0.2622305365f), new Float3(0.2091111325f, 0.3133278055f, -0.2461670583f), new Float3(0.344678154f, -0.1944240454f, -0.2142341261f), new Float3(0.1984478035f, -0.3214342325f, -0.2445373252f), new Float3(-0.2929008603f, 0.2262915116f, 0.2559320961f), - new Float3(-0.1617332831f, 0.006314769776f, -0.4198838754f), new Float3(-0.3582060271f, -0.148303178f, -0.2284613961f), new Float3(-0.1852067326f, -0.3454119342f, -0.2211087107f), new Float3(0.3046301062f, 0.1026310383f, 0.314908508f), new Float3(-0.03816768434f, -0.2551766358f, -0.3686842991f), new Float3(-0.4084952196f, 0.1805950793f, 0.05492788837f), new Float3(-0.02687443361f, -0.2749741471f, 0.3551999201f), new Float3(-0.03801098351f, 0.3277859044f, 0.3059600725f), - new Float3(0.2371120802f, 0.2900386767f, -0.2493099024f), new Float3(0.4447660503f, 0.03946930643f, 0.05590469027f), new Float3(0.01985147278f, -0.01503183293f, -0.4493105419f), new Float3(0.4274339143f, 0.03345994256f, -0.1366772882f), new Float3(-0.2072988631f, 0.2871414597f, -0.2776273824f), new Float3(-0.3791240978f, 0.1281177671f, 0.2057929936f), new Float3(-0.2098721267f, -0.1007087278f, -0.3851122467f), new Float3(0.01582798878f, 0.4263894424f, 0.1429738373f), - new Float3(-0.1888129464f, -0.3160996813f, -0.2587096108f), new Float3(0.1612988974f, -0.1974805082f, -0.3707885038f), new Float3(-0.08974491322f, 0.229148752f, -0.3767448739f), new Float3(0.07041229526f, 0.4150230285f, -0.1590534329f), new Float3(-0.1082925611f, -0.1586061639f, 0.4069604477f), new Float3(0.2474100658f, -0.3309414609f, 0.1782302128f), new Float3(-0.1068836661f, -0.2701644537f, -0.3436379634f), new Float3(0.2396452163f, 0.06803600538f, -0.3747549496f), - new Float3(-0.3063886072f, 0.2597428179f, 0.2028785103f), new Float3(0.1593342891f, -0.3114350249f, -0.2830561951f), new Float3(0.2709690528f, 0.1412648683f, -0.3303331794f), new Float3(-0.1519780427f, 0.3623355133f, 0.2193527988f), new Float3(0.1699773681f, 0.3456012883f, 0.2327390037f), new Float3(-0.1986155616f, 0.3836276443f, -0.1260225743f), new Float3(-0.1887482106f, -0.2050154888f, -0.353330953f), new Float3(0.2659103394f, 0.3015631259f, -0.2021172246f), - new Float3(-0.08838976154f, -0.4288819642f, -0.1036702021f), new Float3(-0.04201869311f, 0.3099592485f, 0.3235115047f), new Float3(-0.3230334656f, 0.201549922f, -0.2398478873f), new Float3(0.2612720941f, 0.2759854499f, -0.2409749453f), new Float3(0.385713046f, 0.2193460345f, 0.07491837764f), new Float3(0.07654967953f, 0.3721732183f, 0.241095919f), new Float3(0.4317038818f, -0.02577753072f, 0.1243675091f), new Float3(-0.2890436293f, -0.3418179959f, -0.04598084447f), - new Float3(-0.2201947582f, 0.383023377f, -0.08548310451f), new Float3(0.4161322773f, -0.1669634289f, -0.03817251927f), new Float3(0.2204718095f, 0.02654238946f, -0.391391981f), new Float3(-0.1040307469f, 0.3890079625f, -0.2008741118f), new Float3(-0.1432122615f, 0.371614387f, -0.2095065525f), new Float3(0.3978380468f, -0.06206669342f, 0.2009293758f), new Float3(-0.2599274663f, 0.2616724959f, -0.2578084893f), new Float3(0.4032618332f, -0.1124593585f, 0.1650235939f), - new Float3(-0.08953470255f, -0.3048244735f, 0.3186935478f), new Float3(0.118937202f, -0.2875221847f, 0.325092195f), new Float3(0.02167047076f, -0.03284630549f, -0.4482761547f), new Float3(-0.3411343612f, 0.2500031105f, 0.1537068389f), new Float3(0.3162964612f, 0.3082064153f, -0.08640228117f), new Float3(0.2355138889f, -0.3439334267f, -0.1695376245f), new Float3(-0.02874541518f, -0.3955933019f, 0.2125550295f), new Float3(-0.2461455173f, 0.02020282325f, -0.3761704803f), - new Float3(0.04208029445f, -0.4470439576f, 0.02968078139f), new Float3(0.2727458746f, 0.2288471896f, -0.2752065618f), new Float3(-0.1347522818f, -0.02720848277f, -0.4284874806f), new Float3(0.3829624424f, 0.1231931484f, -0.2016512234f), new Float3(-0.3547613644f, 0.1271702173f, 0.2459107769f), new Float3(0.2305790207f, 0.3063895591f, 0.2354968222f), new Float3(-0.08323845599f, -0.1922245118f, 0.3982726409f), new Float3(0.2993663085f, -0.2619918095f, -0.2103333191f), - new Float3(-0.2154865723f, 0.2706747713f, 0.287751117f), new Float3(0.01683355354f, -0.2680655787f, -0.3610505186f), new Float3(0.05240429123f, 0.4335128183f, -0.1087217856f), new Float3(0.00940104872f, -0.4472890582f, 0.04841609928f), new Float3(0.3465688735f, 0.01141914583f, -0.2868093776f), new Float3(-0.3706867948f, -0.2551104378f, 0.003156692623f), new Float3(0.2741169781f, 0.2139972417f, -0.2855959784f), new Float3(0.06413433865f, 0.1708718512f, 0.4113266307f), - new Float3(-0.388187972f, -0.03973280434f, -0.2241236325f), new Float3(0.06419469312f, -0.2803682491f, 0.3460819069f), new Float3(-0.1986120739f, -0.3391173584f, 0.2192091725f), new Float3(-0.203203009f, -0.3871641506f, 0.1063600375f), new Float3(-0.1389736354f, -0.2775901578f, -0.3257760473f), new Float3(-0.06555641638f, 0.342253257f, -0.2847192729f), new Float3(-0.2529246486f, -0.2904227915f, 0.2327739768f), new Float3(0.1444476522f, 0.1069184044f, 0.4125570634f), - new Float3(-0.3643780054f, -0.2447099973f, -0.09922543227f), new Float3(0.4286142488f, -0.1358496089f, -0.01829506817f), new Float3(0.165872923f, -0.3136808464f, -0.2767498872f), new Float3(0.2219610524f, -0.3658139958f, 0.1393320198f), new Float3(0.04322940318f, -0.3832730794f, 0.2318037215f), new Float3(-0.08481269795f, -0.4404869674f, -0.03574965489f), new Float3(0.1822082075f, -0.3953259299f, 0.1140946023f), new Float3(-0.3269323334f, 0.3036542563f, 0.05838957105f), - new Float3(-0.4080485344f, 0.04227858267f, -0.184956522f), new Float3(0.2676025294f, -0.01299671652f, 0.36155217f), new Float3(0.3024892441f, -0.1009990293f, -0.3174892964f), new Float3(0.1448494052f, 0.425921681f, -0.0104580805f), new Float3(0.4198402157f, 0.08062320474f, 0.1404780841f), new Float3(-0.3008872161f, -0.333040905f, -0.03241355801f), new Float3(0.3639310428f, -0.1291284382f, -0.2310412139f), new Float3(0.3295806598f, 0.0184175994f, -0.3058388149f), - new Float3(0.2776259487f, -0.2974929052f, -0.1921504723f), new Float3(0.4149000507f, -0.144793182f, -0.09691688386f), new Float3(0.145016715f, -0.0398992945f, 0.4241205002f), new Float3(0.09299023471f, -0.299732164f, -0.3225111565f), new Float3(0.1028907093f, -0.361266869f, 0.247789732f), new Float3(0.2683057049f, -0.07076041213f, -0.3542668666f), new Float3(-0.4227307273f, -0.07933161816f, -0.1323073187f), new Float3(-0.1781224702f, 0.1806857196f, -0.3716517945f), - new Float3(0.4390788626f, -0.02841848598f, -0.09435116353f), new Float3(0.2972583585f, 0.2382799621f, -0.2394997452f), new Float3(-0.1707002821f, 0.2215845691f, 0.3525077196f), new Float3(0.3806686614f, 0.1471852559f, -0.1895464869f), new Float3(-0.1751445661f, -0.274887877f, 0.3102596268f), new Float3(-0.2227237566f, -0.2316778837f, 0.3149912482f), new Float3(0.1369633021f, 0.1341343041f, -0.4071228836f), new Float3(-0.3529503428f, -0.2472893463f, -0.129514612f), - new Float3(-0.2590744185f, -0.2985577559f, -0.2150435121f), new Float3(-0.3784019401f, 0.2199816631f, -0.1044989934f), new Float3(-0.05635805671f, 0.1485737441f, 0.4210102279f), new Float3(0.3251428613f, 0.09666046873f, -0.2957006485f), new Float3(-0.4190995804f, 0.1406751354f, -0.08405978803f), new Float3(-0.3253150961f, -0.3080335042f, -0.04225456877f), new Float3(0.2857945863f, -0.05796152095f, 0.3427271751f), new Float3(-0.2733604046f, 0.1973770973f, -0.2980207554f), - new Float3(0.219003657f, 0.2410037886f, -0.3105713639f), new Float3(0.3182767252f, -0.271342949f, 0.1660509868f), new Float3(-0.03222023115f, -0.3331161506f, -0.300824678f), new Float3(-0.3087780231f, 0.1992794134f, -0.2596995338f), new Float3(-0.06487611647f, -0.4311322747f, 0.1114273361f), new Float3(0.3921171432f, -0.06294284106f, -0.2116183942f), new Float3(-0.1606404506f, -0.358928121f, -0.2187812825f), new Float3(-0.03767771199f, -0.2290351443f, 0.3855169162f), - new Float3(0.1394866832f, -0.3602213994f, 0.2308332918f), new Float3(-0.4345093872f, 0.005751117145f, 0.1169124335f), new Float3(-0.1044637494f, 0.4168128432f, -0.1336202785f), new Float3(0.2658727501f, 0.2551943237f, 0.2582393035f), new Float3(0.2051461999f, 0.1975390727f, 0.3484154868f), new Float3(-0.266085566f, 0.23483312f, 0.2766800993f), new Float3(0.07849405464f, -0.3300346342f, -0.2956616708f), new Float3(-0.2160686338f, 0.05376451292f, -0.3910546287f), - new Float3(-0.185779186f, 0.2148499206f, 0.3490352499f), new Float3(0.02492421743f, -0.3229954284f, -0.3123343347f), new Float3(-0.120167831f, 0.4017266681f, 0.1633259825f), new Float3(-0.02160084693f, -0.06885389554f, 0.4441762538f), new Float3(0.2597670064f, 0.3096300784f, 0.1978643903f), new Float3(-0.1611553854f, -0.09823036005f, 0.4085091653f), new Float3(-0.3278896792f, 0.1461670309f, 0.2713366126f), new Float3(0.2822734956f, 0.03754421121f, -0.3484423997f), - new Float3(0.03169341113f, 0.347405252f, -0.2842624114f), new Float3(0.2202613604f, -0.3460788041f, -0.1849713341f), new Float3(0.2933396046f, 0.3031973659f, 0.1565989581f), new Float3(-0.3194922995f, 0.2453752201f, -0.200538455f), new Float3(-0.3441586045f, -0.1698856132f, -0.2349334659f), new Float3(0.2703645948f, -0.3574277231f, 0.04060059933f), new Float3(0.2298568861f, 0.3744156221f, 0.0973588921f), new Float3(0.09326603877f, -0.3170108894f, 0.3054595587f), - new Float3(-0.1116165319f, -0.2985018719f, 0.3177080142f), new Float3(0.2172907365f, -0.3460005203f, -0.1885958001f), new Float3(0.1991339479f, 0.3820341668f, -0.1299829458f), new Float3(-0.0541918155f, -0.2103145071f, 0.39412061f), new Float3(0.08871336998f, 0.2012117383f, 0.3926114802f), new Float3(0.2787673278f, 0.3505404674f, 0.04370535101f), new Float3(-0.322166438f, 0.3067213525f, 0.06804996813f), new Float3(-0.4277366384f, 0.132066775f, 0.04582286686f), - new Float3(0.240131882f, -0.1612516055f, 0.344723946f), new Float3(0.1448607981f, -0.2387819045f, 0.3528435224f), new Float3(-0.3837065682f, -0.2206398454f, 0.08116235683f), new Float3(-0.4382627882f, -0.09082753406f, -0.04664855374f), new Float3(-0.37728353f, 0.05445141085f, 0.2391488697f), new Float3(0.1259579313f, 0.348394558f, 0.2554522098f), new Float3(-0.1406285511f, -0.270877371f, -0.3306796947f), new Float3(-0.1580694418f, 0.4162931958f, -0.06491553533f), - new Float3(0.2477612106f, -0.2927867412f, -0.2353514536f), new Float3(0.2916132853f, 0.3312535401f, 0.08793624968f), new Float3(0.07365265219f, -0.1666159848f, 0.411478311f), new Float3(-0.26126526f, -0.2422237692f, 0.2748965434f), new Float3(-0.3721862032f, 0.252790166f, 0.008634938242f), new Float3(-0.3691191571f, -0.255281188f, 0.03290232422f), new Float3(0.2278441737f, -0.3358364886f, 0.1944244981f), new Float3(0.363398169f, -0.2310190248f, 0.1306597909f), - new Float3(-0.304231482f, -0.2698452035f, 0.1926830856f), new Float3(-0.3199312232f, 0.316332536f, -0.008816977938f), new Float3(0.2874852279f, 0.1642275508f, -0.304764754f), new Float3(-0.1451096801f, 0.3277541114f, -0.2720669462f), new Float3(0.3220090754f, 0.0511344108f, 0.3101538769f), new Float3(-0.1247400865f, -0.04333605335f, -0.4301882115f), new Float3(-0.2829555867f, -0.3056190617f, -0.1703910946f), new Float3(0.1069384374f, 0.3491024667f, -0.2630430352f), - new Float3(-0.1420661144f, -0.3055376754f, -0.2982682484f), new Float3(-0.250548338f, 0.3156466809f, -0.2002316239f), new Float3(0.3265787872f, 0.1871229129f, 0.2466400438f), new Float3(0.07646097258f, -0.3026690852f, 0.324106687f), new Float3(0.3451771584f, 0.2757120714f, -0.0856480183f), new Float3(0.298137964f, 0.2852657134f, 0.179547284f), new Float3(0.2812250376f, 0.3466716415f, 0.05684409612f), new Float3(0.4390345476f, -0.09790429955f, -0.01278335452f), - new Float3(0.2148373234f, 0.1850172527f, 0.3494474791f), new Float3(0.2595421179f, -0.07946825393f, 0.3589187731f), new Float3(0.3182823114f, -0.307355516f, -0.08203022006f), new Float3(-0.4089859285f, -0.04647718411f, 0.1818526372f), new Float3(-0.2826749061f, 0.07417482322f, 0.3421885344f), new Float3(0.3483864637f, 0.225442246f, -0.1740766085f), new Float3(-0.3226415069f, -0.1420585388f, -0.2796816575f), new Float3(0.4330734858f, -0.118868561f, -0.02859407492f), - new Float3(-0.08717822568f, -0.3909896417f, -0.2050050172f), new Float3(-0.2149678299f, 0.3939973956f, -0.03247898316f), new Float3(-0.2687330705f, 0.322686276f, -0.1617284888f), new Float3(0.2105665099f, -0.1961317136f, -0.3459683451f), new Float3(0.4361845915f, -0.1105517485f, 0.004616608544f), new Float3(0.05333333359f, -0.313639498f, -0.3182543336f), new Float3(-0.05986216652f, 0.1361029153f, -0.4247264031f), new Float3(0.3664988455f, 0.2550543014f, -0.05590974511f), - new Float3(-0.2341015558f, -0.182405731f, 0.3382670703f), new Float3(-0.04730947785f, -0.4222150243f, -0.1483114513f), new Float3(-0.2391566239f, -0.2577696514f, -0.2808182972f), new Float3(-0.1242081035f, 0.4256953395f, -0.07652336246f), new Float3(0.2614832715f, -0.3650179274f, 0.02980623099f), new Float3(-0.2728794681f, -0.3499628774f, 0.07458404908f), new Float3(0.007892900508f, -0.1672771315f, 0.4176793787f), new Float3(-0.01730330376f, 0.2978486637f, -0.3368779738f), - new Float3(0.2054835762f, -0.3252600376f, -0.2334146693f), new Float3(-0.3231994983f, 0.1564282844f, -0.2712420987f), new Float3(-0.2669545963f, 0.2599343665f, -0.2523278991f), new Float3(-0.05554372779f, 0.3170813944f, -0.3144428146f), new Float3(-0.2083935713f, -0.310922837f, -0.2497981362f), new Float3(0.06989323478f, -0.3156141536f, 0.3130537363f), new Float3(0.3847566193f, -0.1605309138f, -0.1693876312f), new Float3(-0.3026215288f, -0.3001537679f, -0.1443188342f), - new Float3(0.3450735512f, 0.08611519592f, 0.2756962409f), new Float3(0.1814473292f, -0.2788782453f, -0.3029914042f), new Float3(-0.03855010448f, 0.09795110726f, 0.4375151083f), new Float3(0.3533670318f, 0.2665752752f, 0.08105160988f), new Float3(-0.007945601311f, 0.140359426f, -0.4274764309f), new Float3(0.4063099273f, -0.1491768253f, -0.1231199324f), new Float3(-0.2016773589f, 0.008816271194f, -0.4021797064f), new Float3(-0.07527055435f, -0.425643481f, -0.1251477955f), - }; - - - private static int FastFloor(float f) { - return (f >= 0 ? (int) f : (int) f - 1); - } - - - private static int FastRound(float f) { - return (f >= 0) ? (int) (f + (float) 0.5) : (int) (f - (float) 0.5); - } - - - private static float Lerp(float a, float b, float t) { - return a + t * (b - a); - } - - - private static float InterpHermiteFunc(float t) { - return t * t * (3 - 2 * t); - } - - - private static float InterpQuinticFunc(float t) { - return t * t * t * (t * (t * 6 - 15) + 10); - } - - - private static float CubicLerp(float a, float b, float c, float d, float t) { - float p = (d - c) - (a - b); - return t * t * t * p + t * t * ((a - b) - p) + t * (c - a) + b; - } - - private void CalculateFractalBounding() { - float amp = m_gain; - float ampFractal = 1; - for (int i = 1; i < m_octaves; i++) { - ampFractal += amp; - amp *= m_gain; - } - m_fractalBounding = 1 / ampFractal; - } - - // Hashing - private final static int X_PRIME = 1619; - private final static int Y_PRIME = 31337; - private final static int Z_PRIME = 6971; - private final static int W_PRIME = 1013; - - private static int Hash2D(int seed, int x, int y) { - int hash = seed; - hash ^= X_PRIME * x; - hash ^= Y_PRIME * y; - - hash = hash * hash * hash * 60493; - hash = (hash >> 13) ^ hash; - - return hash; - } - - private static int Hash3D(int seed, int x, int y, int z) { - int hash = seed; - hash ^= X_PRIME * x; - hash ^= Y_PRIME * y; - hash ^= Z_PRIME * z; - - hash = hash * hash * hash * 60493; - hash = (hash >> 13) ^ hash; - - return hash; - } - - private static int Hash4D(int seed, int x, int y, int z, int w) { - int hash = seed; - hash ^= X_PRIME * x; - hash ^= Y_PRIME * y; - hash ^= Z_PRIME * z; - hash ^= W_PRIME * w; - - hash = hash * hash * hash * 60493; - hash = (hash >> 13) ^ hash; - - return hash; - } - - private static float ValCoord2D(int seed, int x, int y) { - int n = seed; - n ^= X_PRIME * x; - n ^= Y_PRIME * y; - - return (n * n * n * 60493) / (float) 2147483648.0; - } - - private static float ValCoord3D(int seed, int x, int y, int z) { - int n = seed; - n ^= X_PRIME * x; - n ^= Y_PRIME * y; - n ^= Z_PRIME * z; - - return (n * n * n * 60493) / (float) 2147483648.0; - } - - private static float ValCoord4D(int seed, int x, int y, int z, int w) { - int n = seed; - n ^= X_PRIME * x; - n ^= Y_PRIME * y; - n ^= Z_PRIME * z; - n ^= W_PRIME * w; - - return (n * n * n * 60493) / (float) 2147483648.0; - } - - private static float GradCoord2D(int seed, int x, int y, float xd, float yd) { - int hash = seed; - hash ^= X_PRIME * x; - hash ^= Y_PRIME * y; - - hash = hash * hash * hash * 60493; - hash = (hash >> 13) ^ hash; - - Float2 g = GRAD_2D[hash & 7]; - - return xd * g.x + yd * g.y; - } - - private static float GradCoord3D(int seed, int x, int y, int z, float xd, float yd, float zd) { - int hash = seed; - hash ^= X_PRIME * x; - hash ^= Y_PRIME * y; - hash ^= Z_PRIME * z; - - hash = hash * hash * hash * 60493; - hash = (hash >> 13) ^ hash; - - Float3 g = GRAD_3D[hash & 15]; - - return xd * g.x + yd * g.y + zd * g.z; - } - - private static float GradCoord4D(int seed, int x, int y, int z, int w, float xd, float yd, float zd, float wd) { - int hash = seed; - hash ^= X_PRIME * x; - hash ^= Y_PRIME * y; - hash ^= Z_PRIME * z; - hash ^= W_PRIME * w; - - hash = hash * hash * hash * 60493; - hash = (hash >> 13) ^ hash; - - hash &= 31; - float a = yd, b = zd, c = wd; // X,Y,Z - switch (hash >> 3) { // OR, DEPENDING ON HIGH ORDER 2 BITS: - case 1: - a = wd; - b = xd; - c = yd; - break; // W,X,Y - case 2: - a = zd; - b = wd; - c = xd; - break; // Z,W,X - case 3: - a = yd; - b = zd; - c = wd; - break; // Y,Z,W - } - return ((hash & 4) == 0 ? -a : a) + ((hash & 2) == 0 ? -b : b) + ((hash & 1) == 0 ? -c : c); - } - - public float GetNoise(float x, float y, float z) { - x *= m_frequency; - y *= m_frequency; - z *= m_frequency; - - switch (m_noiseType) { - case Value: - return SingleValue(m_seed, x, y, z); - case ValueFractal: - switch (m_fractalType) { - case FBM: - return SingleValueFractalFBM(x, y, z); - case Billow: - return SingleValueFractalBillow(x, y, z); - case RigidMulti: - return SingleValueFractalRigidMulti(x, y, z); - default: - return 0; - } - case Perlin: - return SinglePerlin(m_seed, x, y, z); - case PerlinFractal: - switch (m_fractalType) { - case FBM: - return SinglePerlinFractalFBM(x, y, z); - case Billow: - return SinglePerlinFractalBillow(x, y, z); - case RigidMulti: - return SinglePerlinFractalRigidMulti(x, y, z); - default: - return 0; - } - case Simplex: - return SingleSimplex(m_seed, x, y, z); - case SimplexFractal: - switch (m_fractalType) { - case FBM: - return SingleSimplexFractalFBM(x, y, z); - case Billow: - return SingleSimplexFractalBillow(x, y, z); - case RigidMulti: - return SingleSimplexFractalRigidMulti(x, y, z); - default: - return 0; - } - case Cellular: - switch (m_cellularReturnType) { - case CellValue: - case NoiseLookup: - case Distance: - return SingleCellular(x, y, z); - default: - return SingleCellular2Edge(x, y, z); - } - case WhiteNoise: - return GetWhiteNoise(x, y, z); - case Cubic: - return SingleCubic(m_seed, x, y, z); - case CubicFractal: - switch (m_fractalType) { - case FBM: - return SingleCubicFractalFBM(x, y, z); - case Billow: - return SingleCubicFractalBillow(x, y, z); - case RigidMulti: - return SingleCubicFractalRigidMulti(x, y, z); - default: - return 0; - } - default: - return 0; - } - } - - public float GetNoise(float x, float y) { - x *= m_frequency; - y *= m_frequency; - - switch (m_noiseType) { - case Value: - return SingleValue(m_seed, x, y); - case ValueFractal: - switch (m_fractalType) { - case FBM: - return SingleValueFractalFBM(x, y); - case Billow: - return SingleValueFractalBillow(x, y); - case RigidMulti: - return SingleValueFractalRigidMulti(x, y); - default: - return 0; - } - case Perlin: - return SinglePerlin(m_seed, x, y); - case PerlinFractal: - switch (m_fractalType) { - case FBM: - return SinglePerlinFractalFBM(x, y); - case Billow: - return SinglePerlinFractalBillow(x, y); - case RigidMulti: - return SinglePerlinFractalRigidMulti(x, y); - default: - return 0; - } - case Simplex: - return SingleSimplex(m_seed, x, y); - case SimplexFractal: - switch (m_fractalType) { - case FBM: - return SingleSimplexFractalFBM(x, y); - case Billow: - return SingleSimplexFractalBillow(x, y); - case RigidMulti: - return SingleSimplexFractalRigidMulti(x, y); - default: - return 0; - } - case Cellular: - switch (m_cellularReturnType) { - case CellValue: - case NoiseLookup: - case Distance: - return SingleCellular(x, y); - default: - return SingleCellular2Edge(x, y); - } - case WhiteNoise: - return GetWhiteNoise(x, y); - case Cubic: - return SingleCubic(m_seed, x, y); - case CubicFractal: - switch (m_fractalType) { - case FBM: - return SingleCubicFractalFBM(x, y); - case Billow: - return SingleCubicFractalBillow(x, y); - case RigidMulti: - return SingleCubicFractalRigidMulti(x, y); - default: - return 0; - } - default: - return 0; - } - } - - // White Noise - - private int FloatCast2Int(float f) { - int i = Float.floatToRawIntBits(f); - - return i ^ (i >> 16); - } - - public float GetWhiteNoise(float x, float y, float z, float w) { - int xi = FloatCast2Int(x); - int yi = FloatCast2Int(y); - int zi = FloatCast2Int(z); - int wi = FloatCast2Int(w); - - return ValCoord4D(m_seed, xi, yi, zi, wi); - } - - public float GetWhiteNoise(float x, float y, float z) { - int xi = FloatCast2Int(x); - int yi = FloatCast2Int(y); - int zi = FloatCast2Int(z); - - return ValCoord3D(m_seed, xi, yi, zi); - } - - public float GetWhiteNoise(float x, float y) { - int xi = FloatCast2Int(x); - int yi = FloatCast2Int(y); - - return ValCoord2D(m_seed, xi, yi); - } - - public float GetWhiteNoiseInt(int x, int y, int z, int w) { - return ValCoord4D(m_seed, x, y, z, w); - } - - public float GetWhiteNoiseInt(int x, int y, int z) { - return ValCoord3D(m_seed, x, y, z); - } - - public float GetWhiteNoiseInt(int x, int y) { - return ValCoord2D(m_seed, x, y); - } - - // Value Noise - public float GetValueFractal(float x, float y, float z) { - x *= m_frequency; - y *= m_frequency; - z *= m_frequency; - - switch (m_fractalType) { - case FBM: - return SingleValueFractalFBM(x, y, z); - case Billow: - return SingleValueFractalBillow(x, y, z); - case RigidMulti: - return SingleValueFractalRigidMulti(x, y, z); - default: - return 0; - } - } - - private float SingleValueFractalFBM(float x, float y, float z) { - int seed = m_seed; - float sum = SingleValue(seed, x, y, z); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum += SingleValue(++seed, x, y, z) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleValueFractalBillow(float x, float y, float z) { - int seed = m_seed; - float sum = Math.abs(SingleValue(seed, x, y, z)) * 2 - 1; - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum += (Math.abs(SingleValue(++seed, x, y, z)) * 2 - 1) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleValueFractalRigidMulti(float x, float y, float z) { - int seed = m_seed; - float sum = 1 - Math.abs(SingleValue(seed, x, y, z)); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum -= (1 - Math.abs(SingleValue(++seed, x, y, z))) * amp; - } - - return sum; - } - - public float GetValue(float x, float y, float z) { - return SingleValue(m_seed, x * m_frequency, y * m_frequency, z * m_frequency); - } - - private float SingleValue(int seed, float x, float y, float z) { - int x0 = FastFloor(x); - int y0 = FastFloor(y); - int z0 = FastFloor(z); - int x1 = x0 + 1; - int y1 = y0 + 1; - int z1 = z0 + 1; - - float xs, ys, zs; - switch (m_interp) { - default: - case Linear: - xs = x - x0; - ys = y - y0; - zs = z - z0; - break; - case Hermite: - xs = InterpHermiteFunc(x - x0); - ys = InterpHermiteFunc(y - y0); - zs = InterpHermiteFunc(z - z0); - break; - case Quintic: - xs = InterpQuinticFunc(x - x0); - ys = InterpQuinticFunc(y - y0); - zs = InterpQuinticFunc(z - z0); - break; - } - - float xf00 = Lerp(ValCoord3D(seed, x0, y0, z0), ValCoord3D(seed, x1, y0, z0), xs); - float xf10 = Lerp(ValCoord3D(seed, x0, y1, z0), ValCoord3D(seed, x1, y1, z0), xs); - float xf01 = Lerp(ValCoord3D(seed, x0, y0, z1), ValCoord3D(seed, x1, y0, z1), xs); - float xf11 = Lerp(ValCoord3D(seed, x0, y1, z1), ValCoord3D(seed, x1, y1, z1), xs); - - float yf0 = Lerp(xf00, xf10, ys); - float yf1 = Lerp(xf01, xf11, ys); - - return Lerp(yf0, yf1, zs); - } - - public float GetValueFractal(float x, float y) { - x *= m_frequency; - y *= m_frequency; - - switch (m_fractalType) { - case FBM: - return SingleValueFractalFBM(x, y); - case Billow: - return SingleValueFractalBillow(x, y); - case RigidMulti: - return SingleValueFractalRigidMulti(x, y); - default: - return 0; - } - } - - private float SingleValueFractalFBM(float x, float y) { - int seed = m_seed; - float sum = SingleValue(seed, x, y); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - - amp *= m_gain; - sum += SingleValue(++seed, x, y) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleValueFractalBillow(float x, float y) { - int seed = m_seed; - float sum = Math.abs(SingleValue(seed, x, y)) * 2 - 1; - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - amp *= m_gain; - sum += (Math.abs(SingleValue(++seed, x, y)) * 2 - 1) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleValueFractalRigidMulti(float x, float y) { - int seed = m_seed; - float sum = 1 - Math.abs(SingleValue(seed, x, y)); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - - amp *= m_gain; - sum -= (1 - Math.abs(SingleValue(++seed, x, y))) * amp; - } - - return sum; - } - - public float GetValue(float x, float y) { - return SingleValue(m_seed, x * m_frequency, y * m_frequency); - } - - private float SingleValue(int seed, float x, float y) { - int x0 = FastFloor(x); - int y0 = FastFloor(y); - int x1 = x0 + 1; - int y1 = y0 + 1; - - float xs, ys; - switch (m_interp) { - default: - case Linear: - xs = x - x0; - ys = y - y0; - break; - case Hermite: - xs = InterpHermiteFunc(x - x0); - ys = InterpHermiteFunc(y - y0); - break; - case Quintic: - xs = InterpQuinticFunc(x - x0); - ys = InterpQuinticFunc(y - y0); - break; - } - - float xf0 = Lerp(ValCoord2D(seed, x0, y0), ValCoord2D(seed, x1, y0), xs); - float xf1 = Lerp(ValCoord2D(seed, x0, y1), ValCoord2D(seed, x1, y1), xs); - - return Lerp(xf0, xf1, ys); - } - - // Gradient Noise - public float GetPerlinFractal(float x, float y, float z) { - x *= m_frequency; - y *= m_frequency; - z *= m_frequency; - - switch (m_fractalType) { - case FBM: - return SinglePerlinFractalFBM(x, y, z); - case Billow: - return SinglePerlinFractalBillow(x, y, z); - case RigidMulti: - return SinglePerlinFractalRigidMulti(x, y, z); - default: - return 0; - } - } - - private float SinglePerlinFractalFBM(float x, float y, float z) { - int seed = m_seed; - float sum = SinglePerlin(seed, x, y, z); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum += SinglePerlin(++seed, x, y, z) * amp; - } - - return sum * m_fractalBounding; - } - - private float SinglePerlinFractalBillow(float x, float y, float z) { - int seed = m_seed; - float sum = Math.abs(SinglePerlin(seed, x, y, z)) * 2 - 1; - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum += (Math.abs(SinglePerlin(++seed, x, y, z)) * 2 - 1) * amp; - } - - return sum * m_fractalBounding; - } - - private float SinglePerlinFractalRigidMulti(float x, float y, float z) { - int seed = m_seed; - float sum = 1 - Math.abs(SinglePerlin(seed, x, y, z)); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum -= (1 - Math.abs(SinglePerlin(++seed, x, y, z))) * amp; - } - - return sum; - } - - public float GetPerlin(float x, float y, float z) { - return SinglePerlin(m_seed, x * m_frequency, y * m_frequency, z * m_frequency); - } - - public float SinglePerlin(int seed, float x, float y, float z) { - int x0 = FastFloor(x); - int y0 = FastFloor(y); - int z0 = FastFloor(z); - int x1 = x0 + 1; - int y1 = y0 + 1; - int z1 = z0 + 1; - - float xs, ys, zs; - switch (m_interp) { - default: - case Linear: - xs = x - x0; - ys = y - y0; - zs = z - z0; - break; - case Hermite: - xs = InterpHermiteFunc(x - x0); - ys = InterpHermiteFunc(y - y0); - zs = InterpHermiteFunc(z - z0); - break; - case Quintic: - xs = InterpQuinticFunc(x - x0); - ys = InterpQuinticFunc(y - y0); - zs = InterpQuinticFunc(z - z0); - break; - } - - float xd0 = x - x0; - float yd0 = y - y0; - float zd0 = z - z0; - float xd1 = xd0 - 1; - float yd1 = yd0 - 1; - float zd1 = zd0 - 1; - - float xf00 = Lerp(GradCoord3D(seed, x0, y0, z0, xd0, yd0, zd0), GradCoord3D(seed, x1, y0, z0, xd1, yd0, zd0), xs); - float xf10 = Lerp(GradCoord3D(seed, x0, y1, z0, xd0, yd1, zd0), GradCoord3D(seed, x1, y1, z0, xd1, yd1, zd0), xs); - float xf01 = Lerp(GradCoord3D(seed, x0, y0, z1, xd0, yd0, zd1), GradCoord3D(seed, x1, y0, z1, xd1, yd0, zd1), xs); - float xf11 = Lerp(GradCoord3D(seed, x0, y1, z1, xd0, yd1, zd1), GradCoord3D(seed, x1, y1, z1, xd1, yd1, zd1), xs); - - float yf0 = Lerp(xf00, xf10, ys); - float yf1 = Lerp(xf01, xf11, ys); - - return Lerp(yf0, yf1, zs); - } - - public float GetPerlinFractal(float x, float y) { - x *= m_frequency; - y *= m_frequency; - - switch (m_fractalType) { - case FBM: - return SinglePerlinFractalFBM(x, y); - case Billow: - return SinglePerlinFractalBillow(x, y); - case RigidMulti: - return SinglePerlinFractalRigidMulti(x, y); - default: - return 0; - } - } - - private float SinglePerlinFractalFBM(float x, float y) { - int seed = m_seed; - float sum = SinglePerlin(seed, x, y); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - - amp *= m_gain; - sum += SinglePerlin(++seed, x, y) * amp; - } - - return sum * m_fractalBounding; - } - - private float SinglePerlinFractalBillow(float x, float y) { - int seed = m_seed; - float sum = Math.abs(SinglePerlin(seed, x, y)) * 2 - 1; - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - - amp *= m_gain; - sum += (Math.abs(SinglePerlin(++seed, x, y)) * 2 - 1) * amp; - } - - return sum * m_fractalBounding; - } - - private float SinglePerlinFractalRigidMulti(float x, float y) { - int seed = m_seed; - float sum = 1 - Math.abs(SinglePerlin(seed, x, y)); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - - amp *= m_gain; - sum -= (1 - Math.abs(SinglePerlin(++seed, x, y))) * amp; - } - - return sum; - } - - public float GetPerlin(float x, float y) { - return SinglePerlin(m_seed, x * m_frequency, y * m_frequency); - } - - private float SinglePerlin(int seed, float x, float y) { - int x0 = FastFloor(x); - int y0 = FastFloor(y); - int x1 = x0 + 1; - int y1 = y0 + 1; - - float xs, ys; - switch (m_interp) { - default: - case Linear: - xs = x - x0; - ys = y - y0; - break; - case Hermite: - xs = InterpHermiteFunc(x - x0); - ys = InterpHermiteFunc(y - y0); - break; - case Quintic: - xs = InterpQuinticFunc(x - x0); - ys = InterpQuinticFunc(y - y0); - break; - } - - float xd0 = x - x0; - float yd0 = y - y0; - float xd1 = xd0 - 1; - float yd1 = yd0 - 1; - - float xf0 = Lerp(GradCoord2D(seed, x0, y0, xd0, yd0), GradCoord2D(seed, x1, y0, xd1, yd0), xs); - float xf1 = Lerp(GradCoord2D(seed, x0, y1, xd0, yd1), GradCoord2D(seed, x1, y1, xd1, yd1), xs); - - return Lerp(xf0, xf1, ys); - } - - // Simplex Noise - public float GetSimplexFractal(float x, float y, float z) { - x *= m_frequency; - y *= m_frequency; - z *= m_frequency; - - switch (m_fractalType) { - case FBM: - return SingleSimplexFractalFBM(x, y, z); - case Billow: - return SingleSimplexFractalBillow(x, y, z); - case RigidMulti: - return SingleSimplexFractalRigidMulti(x, y, z); - default: - return 0; - } - } - - private float SingleSimplexFractalFBM(float x, float y, float z) { - int seed = m_seed; - float sum = SingleSimplex(seed, x, y, z); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum += SingleSimplex(++seed, x, y, z) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleSimplexFractalBillow(float x, float y, float z) { - int seed = m_seed; - float sum = Math.abs(SingleSimplex(seed, x, y, z)) * 2 - 1; - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum += (Math.abs(SingleSimplex(++seed, x, y, z)) * 2 - 1) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleSimplexFractalRigidMulti(float x, float y, float z) { - int seed = m_seed; - float sum = 1 - Math.abs(SingleSimplex(seed, x, y, z)); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum -= (1 - Math.abs(SingleSimplex(++seed, x, y, z))) * amp; - } - - return sum; - } - - public float GetSimplex(float x, float y, float z) { - return SingleSimplex(m_seed, x * m_frequency, y * m_frequency, z * m_frequency); - } - - private final static float F3 = (float) (1.0 / 3.0); - private final static float G3 = (float) (1.0 / 6.0); - private final static float G33 = G3 * 3 - 1; - - private float SingleSimplex(int seed, float x, float y, float z) { - float t = (x + y + z) * F3; - int i = FastFloor(x + t); - int j = FastFloor(y + t); - int k = FastFloor(z + t); - - t = (i + j + k) * G3; - float x0 = x - (i - t); - float y0 = y - (j - t); - float z0 = z - (k - t); - - int i1, j1, k1; - int i2, j2, k2; - - if (x0 >= y0) { - if (y0 >= z0) { - i1 = 1; - j1 = 0; - k1 = 0; - i2 = 1; - j2 = 1; - k2 = 0; - } else if (x0 >= z0) { - i1 = 1; - j1 = 0; - k1 = 0; - i2 = 1; - j2 = 0; - k2 = 1; - } else // x0 < z0 - { - i1 = 0; - j1 = 0; - k1 = 1; - i2 = 1; - j2 = 0; - k2 = 1; - } - } else // x0 < y0 - { - if (y0 < z0) { - i1 = 0; - j1 = 0; - k1 = 1; - i2 = 0; - j2 = 1; - k2 = 1; - } else if (x0 < z0) { - i1 = 0; - j1 = 1; - k1 = 0; - i2 = 0; - j2 = 1; - k2 = 1; - } else // x0 >= z0 - { - i1 = 0; - j1 = 1; - k1 = 0; - i2 = 1; - j2 = 1; - k2 = 0; - } - } - - float x1 = x0 - i1 + G3; - float y1 = y0 - j1 + G3; - float z1 = z0 - k1 + G3; - float x2 = x0 - i2 + F3; - float y2 = y0 - j2 + F3; - float z2 = z0 - k2 + F3; - float x3 = x0 + G33; - float y3 = y0 + G33; - float z3 = z0 + G33; - - float n0, n1, n2, n3; - - t = (float) 0.6 - x0 * x0 - y0 * y0 - z0 * z0; - if (t < 0) n0 = 0; - else { - t *= t; - n0 = t * t * GradCoord3D(seed, i, j, k, x0, y0, z0); - } - - t = (float) 0.6 - x1 * x1 - y1 * y1 - z1 * z1; - if (t < 0) n1 = 0; - else { - t *= t; - n1 = t * t * GradCoord3D(seed, i + i1, j + j1, k + k1, x1, y1, z1); - } - - t = (float) 0.6 - x2 * x2 - y2 * y2 - z2 * z2; - if (t < 0) n2 = 0; - else { - t *= t; - n2 = t * t * GradCoord3D(seed, i + i2, j + j2, k + k2, x2, y2, z2); - } - - t = (float) 0.6 - x3 * x3 - y3 * y3 - z3 * z3; - if (t < 0) n3 = 0; - else { - t *= t; - n3 = t * t * GradCoord3D(seed, i + 1, j + 1, k + 1, x3, y3, z3); - } - - return 32 * (n0 + n1 + n2 + n3); - } - - public float GetSimplexFractal(float x, float y) { - x *= m_frequency; - y *= m_frequency; - - switch (m_fractalType) { - case FBM: - return SingleSimplexFractalFBM(x, y); - case Billow: - return SingleSimplexFractalBillow(x, y); - case RigidMulti: - return SingleSimplexFractalRigidMulti(x, y); - default: - return 0; - } - } - - private float SingleSimplexFractalFBM(float x, float y) { - int seed = m_seed; - float sum = SingleSimplex(seed, x, y); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - - amp *= m_gain; - sum += SingleSimplex(++seed, x, y) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleSimplexFractalBillow(float x, float y) { - int seed = m_seed; - float sum = Math.abs(SingleSimplex(seed, x, y)) * 2 - 1; - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - - amp *= m_gain; - sum += (Math.abs(SingleSimplex(++seed, x, y)) * 2 - 1) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleSimplexFractalRigidMulti(float x, float y) { - int seed = m_seed; - float sum = 1 - Math.abs(SingleSimplex(seed, x, y)); - float amp = 1; - - for (int i = 1; i < m_octaves; i++) { - x *= m_lacunarity; - y *= m_lacunarity; - - amp *= m_gain; - sum -= (1 - Math.abs(SingleSimplex(++seed, x, y))) * amp; - } - - return sum; - } - - public float GetSimplex(float x, float y) { - return SingleSimplex(m_seed, x * m_frequency, y * m_frequency); - } - - //private final static float F2 = (float) (1.0 / 2.0); - //private final static float G2 = (float) (1.0 / 4.0); - - private final static float SQRT3 = (float) 1.7320508075688772935274463415059; - private final static float F2 = 0.5f * (SQRT3 - 1.0f); - private final static float G2 = (3.0f - SQRT3) / 6.0f; - - private float SingleSimplex(int seed, float x, float y) { - float t = (x + y) * F2; - int i = FastFloor(x + t); - int j = FastFloor(y + t); - - t = (i + j) * G2; - float X0 = i - t; - float Y0 = j - t; - - float x0 = x - X0; - float y0 = y - Y0; - - int i1, j1; - if (x0 > y0) { - i1 = 1; - j1 = 0; - } else { - i1 = 0; - j1 = 1; - } - - float x1 = x0 - i1 + G2; - float y1 = y0 - j1 + G2; - float x2 = x0 - 1 + 2*G2; - float y2 = y0 - 1 + 2*G2; - - float n0, n1, n2; - - t = (float) 0.5 - x0 * x0 - y0 * y0; - if (t < 0) n0 = 0; - else { - t *= t; - n0 = t * t * GradCoord2D(seed, i, j, x0, y0); - } - - t = (float) 0.5 - x1 * x1 - y1 * y1; - if (t < 0) n1 = 0; - else { - t *= t; - n1 = t * t * GradCoord2D(seed, i + i1, j + j1, x1, y1); - } - - t = (float) 0.5 - x2 * x2 - y2 * y2; - if (t < 0) n2 = 0; - else { - t *= t; - n2 = t * t * GradCoord2D(seed, i + 1, j + 1, x2, y2); - } - - return 50 * (n0 + n1 + n2); - } - - public float GetSimplex(float x, float y, float z, float w) { - return SingleSimplex(m_seed, x * m_frequency, y * m_frequency, z * m_frequency, w * m_frequency); - } - - private static final byte[] SIMPLEX_4D = - { - 0, 1, 2, 3, 0, 1, 3, 2, 0, 0, 0, 0, 0, 2, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 0, - 0, 2, 1, 3, 0, 0, 0, 0, 0, 3, 1, 2, 0, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 0, 3, 0, 0, 0, 0, 1, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 1, 2, 3, 1, 0, - 1, 0, 2, 3, 1, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 1, 0, 0, 0, 0, 2, 1, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 2, 3, 0, 2, 1, 0, 0, 0, 0, 3, 1, 2, 0, - 2, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 2, 0, 0, 0, 0, 3, 2, 0, 1, 3, 2, 1, 0 - }; - - private final static float F4 = (float) ((2.23606797 - 1.0) / 4.0); - private final static float G4 = (float) ((5.0 - 2.23606797) / 20.0); - - private float SingleSimplex(int seed, float x, float y, float z, float w) { - float n0, n1, n2, n3, n4; - float t = (x + y + z + w) * F4; - int i = FastFloor(x + t); - int j = FastFloor(y + t); - int k = FastFloor(z + t); - int l = FastFloor(w + t); - t = (i + j + k + l) * G4; - float X0 = i - t; - float Y0 = j - t; - float Z0 = k - t; - float W0 = l - t; - float x0 = x - X0; - float y0 = y - Y0; - float z0 = z - Z0; - float w0 = w - W0; - - int c = (x0 > y0) ? 32 : 0; - c += (x0 > z0) ? 16 : 0; - c += (y0 > z0) ? 8 : 0; - c += (x0 > w0) ? 4 : 0; - c += (y0 > w0) ? 2 : 0; - c += (z0 > w0) ? 1 : 0; - c <<= 2; - - int i1 = SIMPLEX_4D[c] >= 3 ? 1 : 0; - int i2 = SIMPLEX_4D[c] >= 2 ? 1 : 0; - int i3 = SIMPLEX_4D[c++] >= 1 ? 1 : 0; - int j1 = SIMPLEX_4D[c] >= 3 ? 1 : 0; - int j2 = SIMPLEX_4D[c] >= 2 ? 1 : 0; - int j3 = SIMPLEX_4D[c++] >= 1 ? 1 : 0; - int k1 = SIMPLEX_4D[c] >= 3 ? 1 : 0; - int k2 = SIMPLEX_4D[c] >= 2 ? 1 : 0; - int k3 = SIMPLEX_4D[c++] >= 1 ? 1 : 0; - int l1 = SIMPLEX_4D[c] >= 3 ? 1 : 0; - int l2 = SIMPLEX_4D[c] >= 2 ? 1 : 0; - int l3 = SIMPLEX_4D[c] >= 1 ? 1 : 0; - - float x1 = x0 - i1 + G4; - float y1 = y0 - j1 + G4; - float z1 = z0 - k1 + G4; - float w1 = w0 - l1 + G4; - float x2 = x0 - i2 + 2 * G4; - float y2 = y0 - j2 + 2 * G4; - float z2 = z0 - k2 + 2 * G4; - float w2 = w0 - l2 + 2 * G4; - float x3 = x0 - i3 + 3 * G4; - float y3 = y0 - j3 + 3 * G4; - float z3 = z0 - k3 + 3 * G4; - float w3 = w0 - l3 + 3 * G4; - float x4 = x0 - 1 + 4 * G4; - float y4 = y0 - 1 + 4 * G4; - float z4 = z0 - 1 + 4 * G4; - float w4 = w0 - 1 + 4 * G4; - - t = (float) 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0; - if (t < 0) n0 = 0; - else { - t *= t; - n0 = t * t * GradCoord4D(seed, i, j, k, l, x0, y0, z0, w0); - } - t = (float) 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1; - if (t < 0) n1 = 0; - else { - t *= t; - n1 = t * t * GradCoord4D(seed, i + i1, j + j1, k + k1, l + l1, x1, y1, z1, w1); - } - t = (float) 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2; - if (t < 0) n2 = 0; - else { - t *= t; - n2 = t * t * GradCoord4D(seed, i + i2, j + j2, k + k2, l + l2, x2, y2, z2, w2); - } - t = (float) 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3; - if (t < 0) n3 = 0; - else { - t *= t; - n3 = t * t * GradCoord4D(seed, i + i3, j + j3, k + k3, l + l3, x3, y3, z3, w3); - } - t = (float) 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4; - if (t < 0) n4 = 0; - else { - t *= t; - n4 = t * t * GradCoord4D(seed, i + 1, j + 1, k + 1, l + 1, x4, y4, z4, w4); - } - - return 27 * (n0 + n1 + n2 + n3 + n4); - } - - // Cubic Noise - public float GetCubicFractal(float x, float y, float z) { - x *= m_frequency; - y *= m_frequency; - z *= m_frequency; - - switch (m_fractalType) { - case FBM: - return SingleCubicFractalFBM(x, y, z); - case Billow: - return SingleCubicFractalBillow(x, y, z); - case RigidMulti: - return SingleCubicFractalRigidMulti(x, y, z); - default: - return 0; - } - } - - private float SingleCubicFractalFBM(float x, float y, float z) { - int seed = m_seed; - float sum = SingleCubic(seed, x, y, z); - float amp = 1; - int i = 0; - - while (++i < m_octaves) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum += SingleCubic(++seed, x, y, z) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleCubicFractalBillow(float x, float y, float z) { - int seed = m_seed; - float sum = Math.abs(SingleCubic(seed, x, y, z)) * 2 - 1; - float amp = 1; - int i = 0; - - while (++i < m_octaves) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum += (Math.abs(SingleCubic(++seed, x, y, z)) * 2 - 1) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleCubicFractalRigidMulti(float x, float y, float z) { - int seed = m_seed; - float sum = 1 - Math.abs(SingleCubic(seed, x, y, z)); - float amp = 1; - int i = 0; - - while (++i < m_octaves) { - x *= m_lacunarity; - y *= m_lacunarity; - z *= m_lacunarity; - - amp *= m_gain; - sum -= (1 - Math.abs(SingleCubic(++seed, x, y, z))) * amp; - } - - return sum; - } - - public float GetCubic(float x, float y, float z) { - return SingleCubic(m_seed, x * m_frequency, y * m_frequency, z * m_frequency); - } - - private final static float CUBIC_3D_BOUNDING = 1 / (float) (1.5 * 1.5 * 1.5); - - private float SingleCubic(int seed, float x, float y, float z) { - int x1 = FastFloor(x); - int y1 = FastFloor(y); - int z1 = FastFloor(z); - - int x0 = x1 - 1; - int y0 = y1 - 1; - int z0 = z1 - 1; - int x2 = x1 + 1; - int y2 = y1 + 1; - int z2 = z1 + 1; - int x3 = x1 + 2; - int y3 = y1 + 2; - int z3 = z1 + 2; - - float xs = x - (float) x1; - float ys = y - (float) y1; - float zs = z - (float) z1; - - return CubicLerp( - CubicLerp( - CubicLerp(ValCoord3D(seed, x0, y0, z0), ValCoord3D(seed, x1, y0, z0), ValCoord3D(seed, x2, y0, z0), ValCoord3D(seed, x3, y0, z0), xs), - CubicLerp(ValCoord3D(seed, x0, y1, z0), ValCoord3D(seed, x1, y1, z0), ValCoord3D(seed, x2, y1, z0), ValCoord3D(seed, x3, y1, z0), xs), - CubicLerp(ValCoord3D(seed, x0, y2, z0), ValCoord3D(seed, x1, y2, z0), ValCoord3D(seed, x2, y2, z0), ValCoord3D(seed, x3, y2, z0), xs), - CubicLerp(ValCoord3D(seed, x0, y3, z0), ValCoord3D(seed, x1, y3, z0), ValCoord3D(seed, x2, y3, z0), ValCoord3D(seed, x3, y3, z0), xs), - ys), - CubicLerp( - CubicLerp(ValCoord3D(seed, x0, y0, z1), ValCoord3D(seed, x1, y0, z1), ValCoord3D(seed, x2, y0, z1), ValCoord3D(seed, x3, y0, z1), xs), - CubicLerp(ValCoord3D(seed, x0, y1, z1), ValCoord3D(seed, x1, y1, z1), ValCoord3D(seed, x2, y1, z1), ValCoord3D(seed, x3, y1, z1), xs), - CubicLerp(ValCoord3D(seed, x0, y2, z1), ValCoord3D(seed, x1, y2, z1), ValCoord3D(seed, x2, y2, z1), ValCoord3D(seed, x3, y2, z1), xs), - CubicLerp(ValCoord3D(seed, x0, y3, z1), ValCoord3D(seed, x1, y3, z1), ValCoord3D(seed, x2, y3, z1), ValCoord3D(seed, x3, y3, z1), xs), - ys), - CubicLerp( - CubicLerp(ValCoord3D(seed, x0, y0, z2), ValCoord3D(seed, x1, y0, z2), ValCoord3D(seed, x2, y0, z2), ValCoord3D(seed, x3, y0, z2), xs), - CubicLerp(ValCoord3D(seed, x0, y1, z2), ValCoord3D(seed, x1, y1, z2), ValCoord3D(seed, x2, y1, z2), ValCoord3D(seed, x3, y1, z2), xs), - CubicLerp(ValCoord3D(seed, x0, y2, z2), ValCoord3D(seed, x1, y2, z2), ValCoord3D(seed, x2, y2, z2), ValCoord3D(seed, x3, y2, z2), xs), - CubicLerp(ValCoord3D(seed, x0, y3, z2), ValCoord3D(seed, x1, y3, z2), ValCoord3D(seed, x2, y3, z2), ValCoord3D(seed, x3, y3, z2), xs), - ys), - CubicLerp( - CubicLerp(ValCoord3D(seed, x0, y0, z3), ValCoord3D(seed, x1, y0, z3), ValCoord3D(seed, x2, y0, z3), ValCoord3D(seed, x3, y0, z3), xs), - CubicLerp(ValCoord3D(seed, x0, y1, z3), ValCoord3D(seed, x1, y1, z3), ValCoord3D(seed, x2, y1, z3), ValCoord3D(seed, x3, y1, z3), xs), - CubicLerp(ValCoord3D(seed, x0, y2, z3), ValCoord3D(seed, x1, y2, z3), ValCoord3D(seed, x2, y2, z3), ValCoord3D(seed, x3, y2, z3), xs), - CubicLerp(ValCoord3D(seed, x0, y3, z3), ValCoord3D(seed, x1, y3, z3), ValCoord3D(seed, x2, y3, z3), ValCoord3D(seed, x3, y3, z3), xs), - ys), - zs) * CUBIC_3D_BOUNDING; - } - - - public float GetCubicFractal(float x, float y) { - x *= m_frequency; - y *= m_frequency; - - switch (m_fractalType) { - case FBM: - return SingleCubicFractalFBM(x, y); - case Billow: - return SingleCubicFractalBillow(x, y); - case RigidMulti: - return SingleCubicFractalRigidMulti(x, y); - default: - return 0; - } - } - - private float SingleCubicFractalFBM(float x, float y) { - int seed = m_seed; - float sum = SingleCubic(seed, x, y); - float amp = 1; - int i = 0; - - while (++i < m_octaves) { - x *= m_lacunarity; - y *= m_lacunarity; - - amp *= m_gain; - sum += SingleCubic(++seed, x, y) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleCubicFractalBillow(float x, float y) { - int seed = m_seed; - float sum = Math.abs(SingleCubic(seed, x, y)) * 2 - 1; - float amp = 1; - int i = 0; - - while (++i < m_octaves) { - x *= m_lacunarity; - y *= m_lacunarity; - - amp *= m_gain; - sum += (Math.abs(SingleCubic(++seed, x, y)) * 2 - 1) * amp; - } - - return sum * m_fractalBounding; - } - - private float SingleCubicFractalRigidMulti(float x, float y) { - int seed = m_seed; - float sum = 1 - Math.abs(SingleCubic(seed, x, y)); - float amp = 1; - int i = 0; - - while (++i < m_octaves) { - x *= m_lacunarity; - y *= m_lacunarity; - - amp *= m_gain; - sum -= (1 - Math.abs(SingleCubic(++seed, x, y))) * amp; - } - - return sum; - } - - public float GetCubic(float x, float y) { - x *= m_frequency; - y *= m_frequency; - - return SingleCubic(0, x, y); - } - - private final static float CUBIC_2D_BOUNDING = 1 / (float) (1.5 * 1.5); - - private float SingleCubic(int seed, float x, float y) { - int x1 = FastFloor(x); - int y1 = FastFloor(y); - - int x0 = x1 - 1; - int y0 = y1 - 1; - int x2 = x1 + 1; - int y2 = y1 + 1; - int x3 = x1 + 2; - int y3 = y1 + 2; - - float xs = x - (float) x1; - float ys = y - (float) y1; - - return CubicLerp( - CubicLerp(ValCoord2D(seed, x0, y0), ValCoord2D(seed, x1, y0), ValCoord2D(seed, x2, y0), ValCoord2D(seed, x3, y0), - xs), - CubicLerp(ValCoord2D(seed, x0, y1), ValCoord2D(seed, x1, y1), ValCoord2D(seed, x2, y1), ValCoord2D(seed, x3, y1), - xs), - CubicLerp(ValCoord2D(seed, x0, y2), ValCoord2D(seed, x1, y2), ValCoord2D(seed, x2, y2), ValCoord2D(seed, x3, y2), - xs), - CubicLerp(ValCoord2D(seed, x0, y3), ValCoord2D(seed, x1, y3), ValCoord2D(seed, x2, y3), ValCoord2D(seed, x3, y3), - xs), - ys) * CUBIC_2D_BOUNDING; - } - - // Cellular Noise - public float GetCellular(float x, float y, float z) { - x *= m_frequency; - y *= m_frequency; - z *= m_frequency; - - switch (m_cellularReturnType) { - case CellValue: - case NoiseLookup: - case Distance: - return SingleCellular(x, y, z); - default: - return SingleCellular2Edge(x, y, z); - } - } - - private float SingleCellular(float x, float y, float z) { - int xr = FastRound(x); - int yr = FastRound(y); - int zr = FastRound(z); - - float distance = 999999; - int xc = 0, yc = 0, zc = 0; - - switch (m_cellularDistanceFunction) { - case Euclidean: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - for (int zi = zr - 1; zi <= zr + 1; zi++) { - Float3 vec = CELL_3D[Hash3D(m_seed, xi, yi, zi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - float vecZ = zi - z + vec.z; - - float newDistance = vecX * vecX + vecY * vecY + vecZ * vecZ; - - if (newDistance < distance) { - distance = newDistance; - xc = xi; - yc = yi; - zc = zi; - } - } - } - } - break; - case Manhattan: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - for (int zi = zr - 1; zi <= zr + 1; zi++) { - Float3 vec = CELL_3D[Hash3D(m_seed, xi, yi, zi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - float vecZ = zi - z + vec.z; - - float newDistance = Math.abs(vecX) + Math.abs(vecY) + Math.abs(vecZ); - - if (newDistance < distance) { - distance = newDistance; - xc = xi; - yc = yi; - zc = zi; - } - } - } - } - break; - case Natural: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - for (int zi = zr - 1; zi <= zr + 1; zi++) { - Float3 vec = CELL_3D[Hash3D(m_seed, xi, yi, zi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - float vecZ = zi - z + vec.z; - - float newDistance = (Math.abs(vecX) + Math.abs(vecY) + Math.abs(vecZ)) + (vecX * vecX + vecY * vecY + vecZ * vecZ); - - if (newDistance < distance) { - distance = newDistance; - xc = xi; - yc = yi; - zc = zi; - } - } - } - } - break; - } - - switch (m_cellularReturnType) { - case CellValue: - return ValCoord3D(0, xc, yc, zc); - - case NoiseLookup: - Float3 vec = CELL_3D[Hash3D(m_seed, xc, yc, zc) & 255]; - return m_cellularNoiseLookup.GetNoise(xc + vec.x, yc + vec.y, zc + vec.z); - - case Distance: - return distance - 1; - default: - return 0; - } - } - - private float SingleCellular2Edge(float x, float y, float z) { - int xr = FastRound(x); - int yr = FastRound(y); - int zr = FastRound(z); - - float distance = 999999; - float distance2 = 999999; - - switch (m_cellularDistanceFunction) { - case Euclidean: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - for (int zi = zr - 1; zi <= zr + 1; zi++) { - Float3 vec = CELL_3D[Hash3D(m_seed, xi, yi, zi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - float vecZ = zi - z + vec.z; - - float newDistance = vecX * vecX + vecY * vecY + vecZ * vecZ; - - distance2 = Math.max(Math.min(distance2, newDistance), distance); - distance = Math.min(distance, newDistance); - } - } - } - break; - case Manhattan: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - for (int zi = zr - 1; zi <= zr + 1; zi++) { - Float3 vec = CELL_3D[Hash3D(m_seed, xi, yi, zi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - float vecZ = zi - z + vec.z; - - float newDistance = Math.abs(vecX) + Math.abs(vecY) + Math.abs(vecZ); - - distance2 = Math.max(Math.min(distance2, newDistance), distance); - distance = Math.min(distance, newDistance); - } - } - } - break; - case Natural: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - for (int zi = zr - 1; zi <= zr + 1; zi++) { - Float3 vec = CELL_3D[Hash3D(m_seed, xi, yi, zi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - float vecZ = zi - z + vec.z; - - float newDistance = (Math.abs(vecX) + Math.abs(vecY) + Math.abs(vecZ)) + (vecX * vecX + vecY * vecY + vecZ * vecZ); - - distance2 = Math.max(Math.min(distance2, newDistance), distance); - distance = Math.min(distance, newDistance); - } - } - } - break; - default: - break; - } - - switch (m_cellularReturnType) { - case Distance2: - return distance2 - 1; - case Distance2Add: - return distance2 + distance - 1; - case Distance2Sub: - return distance2 - distance - 1; - case Distance2Mul: - return distance2 * distance - 1; - case Distance2Div: - return distance / distance2 - 1; - default: - return 0; - } - } - - public float GetCellular(float x, float y) { - x *= m_frequency; - y *= m_frequency; - - switch (m_cellularReturnType) { - case CellValue: - case NoiseLookup: - case Distance: - return SingleCellular(x, y); - default: - return SingleCellular2Edge(x, y); - } - } - - private float SingleCellular(float x, float y) { - int xr = FastRound(x); - int yr = FastRound(y); - - float distance = 999999; - int xc = 0, yc = 0; - - switch (m_cellularDistanceFunction) { - default: - case Euclidean: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - Float2 vec = CELL_2D[Hash2D(m_seed, xi, yi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - - float newDistance = vecX * vecX + vecY * vecY; - - if (newDistance < distance) { - distance = newDistance; - xc = xi; - yc = yi; - } - } - } - break; - case Manhattan: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - Float2 vec = CELL_2D[Hash2D(m_seed, xi, yi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - - float newDistance = (Math.abs(vecX) + Math.abs(vecY)); - - if (newDistance < distance) { - distance = newDistance; - xc = xi; - yc = yi; - } - } - } - break; - case Natural: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - Float2 vec = CELL_2D[Hash2D(m_seed, xi, yi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - - float newDistance = (Math.abs(vecX) + Math.abs(vecY)) + (vecX * vecX + vecY * vecY); - - if (newDistance < distance) { - distance = newDistance; - xc = xi; - yc = yi; - } - } - } - break; - } - - switch (m_cellularReturnType) { - case CellValue: - return ValCoord2D(0, xc, yc); - - case NoiseLookup: - Float2 vec = CELL_2D[Hash2D(m_seed, xc, yc) & 255]; - return m_cellularNoiseLookup.GetNoise(xc + vec.x, yc + vec.y); - - case Distance: - return distance - 1; - default: - return 0; - } - } - - private float SingleCellular2Edge(float x, float y) { - int xr = FastRound(x); - int yr = FastRound(y); - - float distance = 999999; - float distance2 = 999999; - - switch (m_cellularDistanceFunction) { - default: - case Euclidean: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - Float2 vec = CELL_2D[Hash2D(m_seed, xi, yi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - - float newDistance = vecX * vecX + vecY * vecY; - - distance2 = Math.max(Math.min(distance2, newDistance), distance); - distance = Math.min(distance, newDistance); - } - } - break; - case Manhattan: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - Float2 vec = CELL_2D[Hash2D(m_seed, xi, yi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - - float newDistance = Math.abs(vecX) + Math.abs(vecY); - - distance2 = Math.max(Math.min(distance2, newDistance), distance); - distance = Math.min(distance, newDistance); - } - } - break; - case Natural: - for (int xi = xr - 1; xi <= xr + 1; xi++) { - for (int yi = yr - 1; yi <= yr + 1; yi++) { - Float2 vec = CELL_2D[Hash2D(m_seed, xi, yi) & 255]; - - float vecX = xi - x + vec.x; - float vecY = yi - y + vec.y; - - float newDistance = (Math.abs(vecX) + Math.abs(vecY)) + (vecX * vecX + vecY * vecY); - - distance2 = Math.max(Math.min(distance2, newDistance), distance); - distance = Math.min(distance, newDistance); - } - } - break; - } - - switch (m_cellularReturnType) { - case Distance2: - return distance2 - 1; - case Distance2Add: - return distance2 + distance - 1; - case Distance2Sub: - return distance2 - distance - 1; - case Distance2Mul: - return distance2 * distance - 1; - case Distance2Div: - return distance / distance2 - 1; - default: - return 0; - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/generate/noise/FastNoiseOctaves.java b/minecraft_server/betterterrain/world/generate/noise/FastNoiseOctaves.java deleted file mode 100644 index ca386b9..0000000 --- a/minecraft_server/betterterrain/world/generate/noise/FastNoiseOctaves.java +++ /dev/null @@ -1,40 +0,0 @@ -package betterterrain.world.generate.noise; - -import java.util.Random; - -import opensimplex2.OpenSimplex2; -import opensimplex2.OpenSimplex2F; -import opensimplex2.OpenSimplex2S; - -public class FastNoiseOctaves { - private FastNoise[] generators; - - public FastNoiseOctaves(long seed, int numOctaves) { - Random rand = new Random(); - rand.setSeed(seed); - - this.generators = new FastNoise[numOctaves]; - - for (int i = 0; i < numOctaves; i++) { - this.generators[i] = new FastNoise(rand.nextInt()); - } - } - - public double noise3(double x, double y, double z, double noiseScale) { - return this.noise3(x, y, z, noiseScale, noiseScale); - } - - public double noise3(double x, double y, double z, double noiseScaleXZ, double noiseScaleY) { - float octaveScale = 1; - double noise = 0; - - for (int i = 0; i < generators.length; i++) { - noise += generators[i].SinglePerlin(generators[i].GetSeed(), (float) (x * noiseScaleXZ / octaveScale), (float) (z * noiseScaleXZ / octaveScale), (float) (y * noiseScaleY / octaveScale * octaveScale)); - octaveScale /= 2; - } - - //Perlin noise has output range of (-sqrt(n / 4), sqrt(n/4)) where n is the number of dimensions. - //Here the value is normalized to the range (-1, 1). - return noise;// / (Math.sqrt(3) / 2); - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/generate/noise/HorizonsNoiseFieldGenerator.java b/minecraft_server/betterterrain/world/generate/noise/HorizonsNoiseFieldGenerator.java deleted file mode 100644 index dbfde68..0000000 --- a/minecraft_server/betterterrain/world/generate/noise/HorizonsNoiseFieldGenerator.java +++ /dev/null @@ -1,5 +0,0 @@ -package betterterrain.world.generate.noise; - -public class HorizonsNoiseFieldGenerator { - -} diff --git a/minecraft_server/betterterrain/world/generate/noise/HorizonsNoiseGeneratorTerrain.java b/minecraft_server/betterterrain/world/generate/noise/HorizonsNoiseGeneratorTerrain.java deleted file mode 100644 index d116d69..0000000 --- a/minecraft_server/betterterrain/world/generate/noise/HorizonsNoiseGeneratorTerrain.java +++ /dev/null @@ -1,169 +0,0 @@ -package betterterrain.world.generate.noise; - -import java.util.Random; - -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.MathHelper; - -public class HorizonsNoiseGeneratorTerrain extends HorizonsNoiseFieldGenerator { - private Random rand; - - private HorizonsNoiseOctaves biomeHeightNoiseGen; - private HorizonsNoiseOctaves blockModifierNoiseGen; - private HorizonsNoiseOctaves blockNoiseGen1; - private HorizonsNoiseOctaves blockNoiseGen2; - - private double[] biomeHeightNoise; - private double[] blockModifierNoise; - private double[] blockNoise1; - private double[] blockNoise2; - - //Used for smoothing between biomes - private float[] parabolicField; - private int parabolicRadius; - - public HorizonsNoiseGeneratorTerrain(Random rand) { - this.rand = rand; - - this.biomeHeightNoiseGen = new HorizonsNoiseOctaves(this.rand, 16); - this.blockModifierNoiseGen = new HorizonsNoiseOctaves(this.rand, 8); - this.blockNoiseGen1 = new HorizonsNoiseOctaves(this.rand, 16); - this.blockNoiseGen2 = new HorizonsNoiseOctaves(this.rand, 16); - } - - public double[] initializeNoiseField(double[] noiseArray, int posX, int posY, int posZ, int sizeX, int sizeY, int sizeZ, BiomeGenBase[] biomesForGeneration) { - if (noiseArray == null) { - noiseArray = new double[sizeX * sizeY * sizeZ]; - } - - //Parabolic field is used for smoothing between biomes - int parabolicDiameter = parabolicRadius * 2 + 1; - - if (this.parabolicField == null) { - this.parabolicField = new float[(int) Math.pow(parabolicDiameter, 2)]; - - for (int i = -parabolicRadius; i <= parabolicRadius; ++i) { - for (int k = -parabolicRadius; k <= parabolicRadius; ++k) { - float parabolicValue = 10.0F / MathHelper.sqrt_float((float)(i * i + k * k) + 0.2F); - this.parabolicField[i + parabolicRadius + (k + parabolicRadius) * parabolicDiameter] = parabolicValue; - } - } - } - - double octaveScalarXZ = 684.412D; - double octaveScalarY = 684.412D; - this.biomeHeightNoise = this.biomeHeightNoiseGen.generateNoiseOctaves(this.biomeHeightNoise, posX, posZ, sizeX, sizeZ, 200.0D, 200.0D, 0.5D); - this.blockModifierNoise = this.blockModifierNoiseGen.generateNoiseOctaves(this.blockModifierNoise, posX, posY, posZ, sizeX, sizeY, sizeZ, octaveScalarXZ / 80.0D, octaveScalarY / 160.0D, octaveScalarXZ / 80.0D); - this.blockNoise1 = this.blockNoiseGen1.generateNoiseOctaves(this.blockNoise1, posX, posY, posZ, sizeX, sizeY, sizeZ, octaveScalarXZ, octaveScalarY, octaveScalarXZ); - this.blockNoise2 = this.blockNoiseGen2.generateNoiseOctaves(this.blockNoise2, posX, posY, posZ, sizeX, sizeY, sizeZ, octaveScalarXZ, octaveScalarY, octaveScalarXZ); - int biomeHeightNoiseIndex = 0; - int blockNoiseIndex = 0; - - //Iterates through the entire noise array for population - //Loops first through x and z, getting biome height data, then iterates through y values - for (int i = 0; i < sizeX; ++i) { - for (int k = 0; k < sizeZ; ++k) { - float biomeMaxHeightSample = 0.0F; - float biomeMinHeightSample = 0.0F; - float biomeModifierTotal = 0.0F; - BiomeGenBase biome = biomesForGeneration[i + parabolicRadius + (k + parabolicRadius) * (sizeX + parabolicDiameter)]; - - //Gets biome height values influenced by neighboring biomes - //Weights provided by the parabolic field - for (int c = -parabolicRadius; c <= parabolicRadius; ++c) { - for (int d = -parabolicRadius; d <= parabolicRadius; ++d) { - BiomeGenBase biomeNeighbor = biomesForGeneration[i + c + parabolicRadius + (k + d + parabolicRadius) * (sizeX + parabolicDiameter)]; - float biomeHeightModifierValue = this.parabolicField[c + parabolicRadius + (d + parabolicRadius) * parabolicDiameter] / (biomeNeighbor.minHeight + 2.0F); - - if (biomeNeighbor.minHeight > biome.minHeight) { - biomeHeightModifierValue /= 2.0F; - } - - biomeMaxHeightSample += biomeNeighbor.maxHeight * biomeHeightModifierValue; - biomeMinHeightSample += biomeNeighbor.minHeight * biomeHeightModifierValue; - biomeModifierTotal += biomeHeightModifierValue; - } - } - - biomeMaxHeightSample /= biomeModifierTotal; - biomeMinHeightSample /= biomeModifierTotal; - biomeMaxHeightSample = biomeMaxHeightSample * 0.9F + 0.1F; - biomeMinHeightSample = (biomeMinHeightSample * 4.0F - 1.0F) / 8.0F; - - //Gets the value from the biome noise array to modify the biome height values above - double biomeHeightNoiseModifier = this.biomeHeightNoise[biomeHeightNoiseIndex] / 8000.0D; - biomeHeightNoiseIndex++; - - if (biomeHeightNoiseModifier < 0.0D) { - biomeHeightNoiseModifier = -biomeHeightNoiseModifier * 0.3D; - } - - biomeHeightNoiseModifier = biomeHeightNoiseModifier * 3.0D - 2.0D; - - if (biomeHeightNoiseModifier < 0.0D) { - biomeHeightNoiseModifier /= 2.0D; - - if (biomeHeightNoiseModifier < -1.0D){ - biomeHeightNoiseModifier = -1.0D; - } - - biomeHeightNoiseModifier /= 2.8D; - } - else { - if (biomeHeightNoiseModifier > 1.0D) { - biomeHeightNoiseModifier = 1.0D; - } - - biomeHeightNoiseModifier /= 8.0D; - } - - //After biome height information has been processed, iterates through y values - for (int j = 0; j < sizeY; ++j) { - //Modifies biome height for x/z based on the current y value - double biomeMinHeightDouble = (double) biomeMinHeightSample; - double biomeMaxHeightDouble = (double) biomeMaxHeightSample; - biomeMinHeightDouble += biomeHeightNoiseModifier * 0.2D; - biomeMinHeightDouble = biomeMinHeightDouble * (double) sizeY / 16.0D; - double biomeMinHeightModified = (double) sizeY / 2.0D + biomeMinHeightDouble * 4.0D; - double noiseSample = 0.0D; - double biomeHeightValue = ((double) j - biomeMinHeightModified) * 12.0D / biomeMaxHeightDouble; - - if (biomeHeightValue < 0.0D) { - biomeHeightValue *= 4.0D; - } - - //Samples the noise fields at the current location - double blockNoiseModifierSample = (this.blockModifierNoise[blockNoiseIndex] / 10.0D + 1.0D) / 2.0D; - - double blockNoiseSample1 = this.blockNoise1[blockNoiseIndex] / 512.0D; - double blockNoiseSample2 = this.blockNoise2[blockNoiseIndex] / 512.0D; - - //Combines block noise fields depending on the value of the modifier sample - if (blockNoiseModifierSample < 0.0D) { - noiseSample = blockNoiseSample1; - } - else if (blockNoiseModifierSample > 1.0D) { - noiseSample = blockNoiseSample2; - } - else { - noiseSample = blockNoiseSample1 + (blockNoiseSample2 - blockNoiseSample1) * blockNoiseModifierSample; - } - - //Factors biome height calculations into final noise values - noiseSample -= biomeHeightValue; - - //Modifies noise at the top of the section - if (j > sizeY - 4) { - double sectionHeightModifier = (double)((float)(j - (sizeY - 4)) / 3.0F); - noiseSample = noiseSample * (1.0D - sectionHeightModifier) + -10.0D * sectionHeightModifier; - } - - noiseArray[blockNoiseIndex] = noiseSample; - blockNoiseIndex++; - } - } - } - - return noiseArray; - } -} diff --git a/minecraft_server/betterterrain/world/generate/noise/HorizonsNoiseOctaves.java b/minecraft_server/betterterrain/world/generate/noise/HorizonsNoiseOctaves.java deleted file mode 100644 index 0806846..0000000 --- a/minecraft_server/betterterrain/world/generate/noise/HorizonsNoiseOctaves.java +++ /dev/null @@ -1,79 +0,0 @@ -package betterterrain.world.generate.noise; - -import java.util.Random; - -import net.minecraft.src.MathHelper; -import net.minecraft.src.NoiseGenerator; - -public class HorizonsNoiseOctaves extends NoiseGenerator -{ - /** - * Collection of noise generation functions. Output is combined to produce different octaves of noise. - */ - private HorizonsNoisePerlin[] generatorCollection; - private int octaves; - - public HorizonsNoiseOctaves(Random rand, int numOctaves) - { - this.octaves = numOctaves; - this.generatorCollection = new HorizonsNoisePerlin[numOctaves]; - - for (int i = 0; i < numOctaves; ++i) - { - this.generatorCollection[i] = new HorizonsNoisePerlin(rand); - } - } - - /** - * pars:(par2,3,4=noiseOffset ; so that adjacent noise segments connect) (pars5,6,7=x,y,zArraySize),(pars8,10,12 = - * x,y,z noiseScale) - */ - public double[] generateNoiseOctaves(double[] noiseArray, int xOffset, int yOffset, int zOffset, int xSize, int ySize, int zSize, double xScale, double yScale, double zSacle) - { - //Resets noise array - if (noiseArray == null) - { - noiseArray = new double[xSize * ySize * zSize]; - } - else - { - for (int i = 0; i < noiseArray.length; ++i) - { - noiseArray[i] = 0.0D; - } - } - - double octaveScale = 1.0D; - - for (int i = 0; i < this.octaves; ++i) - { - double xOffsetOctave = (double)xOffset * octaveScale * xScale; - double yOffsetOctave = (double)yOffset * octaveScale * yScale; - double zOffsetOctave = (double)zOffset * octaveScale * zSacle; - - //Limits the integer part of the offset to be within 0 - 16777216 (Limit for 32-bit float) - long xOffsetIPart = MathHelper.floor_double_long(xOffsetOctave); - long zOffsetIPart = MathHelper.floor_double_long(zOffsetOctave); - xOffsetOctave -= (double)xOffsetIPart; - zOffsetOctave -= (double)zOffsetIPart; - xOffsetIPart %= 16777216L; - zOffsetIPart %= 16777216L; - xOffsetOctave += (double)xOffsetIPart; - zOffsetOctave += (double)zOffsetIPart; - - this.generatorCollection[i].populateNoiseArray(noiseArray, xOffsetOctave, yOffsetOctave, zOffsetOctave, xSize, ySize, zSize, xScale * octaveScale, yScale * octaveScale, zSacle * octaveScale, octaveScale); - octaveScale /= 2.0D; - } - - return noiseArray; - } - - /** - * Bouncer function to the main one with some default arguments. - */ - public double[] generateNoiseOctaves(double[] noiseArray, int xOffset, int zOffset, int xSize, int zSize, - double xScale, double zScale, double noiseScale) - { - return this.generateNoiseOctaves(noiseArray, xOffset, 10, zOffset, xSize, 1, zSize, xScale, 1.0D, zScale); - } -} diff --git a/minecraft_server/betterterrain/world/generate/noise/HorizonsNoisePerlin.java b/minecraft_server/betterterrain/world/generate/noise/HorizonsNoisePerlin.java deleted file mode 100644 index bbdd062..0000000 --- a/minecraft_server/betterterrain/world/generate/noise/HorizonsNoisePerlin.java +++ /dev/null @@ -1,173 +0,0 @@ -package betterterrain.world.generate.noise; - -import java.util.Random; - -import net.minecraft.src.NoiseGenerator; - -public class HorizonsNoisePerlin extends NoiseGenerator -{ - private int[] permutations; - public double xCoord; - public double yCoord; - public double zCoord; - - public HorizonsNoisePerlin() - { - this(new Random()); - } - - public HorizonsNoisePerlin(Random rand) { - this.permutations = new int[512]; - this.xCoord = rand.nextDouble() * 256.0D; - this.yCoord = rand.nextDouble() * 256.0D; - this.zCoord = rand.nextDouble() * 256.0D; - - for (int i = 0; i < 256; this.permutations[i] = i++) { - ; - } - - for (int i = 0; i < 256; ++i) { - int randIndex = rand.nextInt(256 - i) + i; - int oldValue = this.permutations[i]; - this.permutations[i] = this.permutations[randIndex]; - this.permutations[randIndex] = oldValue; - this.permutations[i + 256] = this.permutations[i]; - } - } - - public final double lerp(double par1, double par3, double par5) { - return par3 + par1 * (par5 - par3); - } - - public final double grad2d(int hash, double x, double z) { - int h = hash & 15; - double u = (double)(1 - ((h & 8) >> 3)) * x; - double v = h < 4 ? 0.0D : (h != 12 && h != 14 ? z : x); - return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v); - } - - public final double grad(int hash, double x, double y, double z) { - int h = hash & 15; - double u = h < 8 ? x : y; - double v = h < 4 ? y : (h != 12 && h != 14 ? z : x); - return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v); - } - - /** - * pars: noiseArray , xOffset , yOffset , zOffset , xSize , ySize , zSize , xScale, yScale , zScale , noiseScale. - * noiseArray should be xSize*ySize*zSize in size - */ - public void populateNoiseArray(double[] noiseArray, double xOffset, double yOffset, double zOffset, - int xSize, int ySize, int zSize, double xScale, double yScale, double zScale, double noiseScale) { - int noiseIndex = 0; - - if (ySize == 1) { - int c = 0; - double noiseScaleInverse = 1.0D / noiseScale; - - double x1 = 0.0D; - double x2 = 0.0D; - - for (int i = 0; i < xSize; ++i) { - double xDouble = xOffset + (double) i * xScale + this.xCoord; - int x = (int) xDouble; - - if (xDouble < (double) x) { - --x; - } - - int xLimited = x & 255; - xDouble -= (double) x; - double xFaded = xDouble * xDouble * xDouble * (xDouble * (xDouble * 6.0D - 15.0D) + 10.0D); - - for (int k = 0; k < zSize; ++k) { - double zDouble = zOffset + (double) k * zScale + this.zCoord; - int z = (int)zDouble; - - if (zDouble < (double) z) { - --z; - } - - int zLimited = z & 255; - zDouble -= (double) z; - double zFaded = zDouble * zDouble * zDouble * (zDouble * (zDouble * 6.0D - 15.0D) + 10.0D); - - int a = this.permutations[this.permutations[xLimited + 0]] + zLimited; - int b = this.permutations[this.permutations[xLimited + 1]] + zLimited; - x1 = this.lerp(xFaded, this.grad2d(this.permutations[a], xDouble, zDouble), this.grad(this.permutations[b], xDouble - 1.0D, 0.0D, zDouble)); - x2 = this.lerp(xFaded, this.grad(this.permutations[a + 1], xDouble, 0.0D, zDouble - 1.0D), this.grad(this.permutations[b + 1], xDouble - 1.0D, 0.0D, zDouble - 1.0D)); - double xz = this.lerp(zFaded, x1, x2); - noiseIndex = c++; - noiseArray[noiseIndex] += xz * noiseScaleInverse; - } - } - } - else { - double noiseScaleInverse = 1.0D / noiseScale; - int var22 = -1; - int c = 0; - - double x1 = 0.0D; - double x2 = 0.0D; - double x3 = 0.0D; - double x4 = 0.0D; - - for (int i = 0; i < xSize; ++i) { - double xDouble = xOffset + (double)i * xScale + this.xCoord; - int x = (int) xDouble; - - if (xDouble < (double) x) { - --x; - } - - int xLimited = x & 255; - xDouble -= (double)x; - double xFaded = xDouble * xDouble * xDouble * (xDouble * (xDouble * 6.0D - 15.0D) + 10.0D); - - for (int k = 0; k < zSize; ++k) { - double zDouble = zOffset + (double) k * zScale + this.zCoord; - int z = (int) zDouble; - - if (zDouble < (double) z) { - --z; - } - - int zLimited = z & 255; - zDouble -= (double)z; - double zFaded = zDouble * zDouble * zDouble * (zDouble * (zDouble * 6.0D - 15.0D) + 10.0D); - - for (int j = 0; j < ySize; ++j) { - double yDouble = yOffset + (double)j * yScale + this.yCoord; - int y = (int)yDouble; - - if (yDouble < (double)y) { - --y; - } - - int yLimited = y & 255; - yDouble -= (double)y; - double yFaded = yDouble * yDouble * yDouble * (yDouble * (yDouble * 6.0D - 15.0D) + 10.0D); - - if (j == 0 || yLimited != var22) { - var22 = yLimited; - int aa = this.permutations[this.permutations[xLimited + 0] + yLimited + 0] + zLimited; - int ab = this.permutations[this.permutations[xLimited + 0] + yLimited + 1] + zLimited; - int ba = this.permutations[this.permutations[xLimited + 1] + yLimited + 0] + zLimited; - int bb = this.permutations[this.permutations[xLimited + 1] + yLimited + 1] + zLimited; - x1 = this.lerp(xFaded, this.grad(this.permutations[aa], xDouble, yDouble, zDouble), this.grad(this.permutations[ba], xDouble - 1.0D, yDouble, zDouble)); - x2 = this.lerp(xFaded, this.grad(this.permutations[ab], xDouble, yDouble - 1.0D, zDouble), this.grad(this.permutations[bb], xDouble - 1.0D, yDouble - 1.0D, zDouble)); - x3 = this.lerp(xFaded, this.grad(this.permutations[aa + 1], xDouble, yDouble, zDouble - 1.0D), this.grad(this.permutations[ba + 1], xDouble - 1.0D, yDouble, zDouble - 1.0D)); - x4 = this.lerp(xFaded, this.grad(this.permutations[ab + 1], xDouble, yDouble - 1.0D, zDouble - 1.0D), this.grad(this.permutations[bb + 1], xDouble - 1.0D, yDouble - 1.0D, zDouble - 1.0D)); - } - - double xy1 = this.lerp(yFaded, x1, x2); - double xy2 = this.lerp(yFaded, x3, x4); - double xyz = this.lerp(zFaded, xy1, xy2); - noiseIndex = c++; - noiseArray[noiseIndex] += xyz * noiseScaleInverse; - } - } - } - } - } -} diff --git a/minecraft_server/betterterrain/world/generate/noise/OpenSimplexOctaves.java b/minecraft_server/betterterrain/world/generate/noise/OpenSimplexOctaves.java deleted file mode 100644 index 7d6fa22..0000000 --- a/minecraft_server/betterterrain/world/generate/noise/OpenSimplexOctaves.java +++ /dev/null @@ -1,146 +0,0 @@ -package betterterrain.world.generate.noise; - -import java.util.Map; -import java.util.Random; - -import opensimplex2.OpenSimplex2; -import opensimplex2.OpenSimplex2F; -import opensimplex2.OpenSimplex2S; - -public class OpenSimplexOctaves { - private OpenSimplex2F[] generators; - - //Cache for previously calculated noise values. - //All coordinates are local to their chunk - //1st dimension is x, 2nd is z, 3rd is y - //4th dimension holds cached information - // 1st entry is chunkX - // 2nd entry is chunkZ - // 3rd entry is noise value - private double[][][][] noiseCache = new double[16][16][256][3]; - private double lastXZScale = 0; - private double lastYScale = 0; - - public OpenSimplexOctaves(long seed, int numOctaves) { - Random rand = new Random(); - rand.setSeed(seed); - - this.generators = new OpenSimplex2F[numOctaves]; - - for (int i = 0; i < numOctaves; i++) { - this.generators[i] = new OpenSimplex2F(rand.nextLong()); - } - } - - //Included for legacy reasons - public double noise2(double x, double y) { - return this.noise2((int) x, (int) y, 1); - } - - public double noise2(int x, int y) { - return this.noise2(x, y, 1); - } - - public double noise2(int x, int y, double noiseScale) { - float octaveScale = 1; - double noise = 0; - - for (int i = 0; i < generators.length; i++) { - noise += generators[i].noise2(x * noiseScale / octaveScale, y * noiseScale / octaveScale) * octaveScale; - octaveScale /= 2; - } - - return noise; - } - - public double noise3(int x, int y, int z, double noiseScale) { - return this.noise3(x, y, z, noiseScale, noiseScale, true); - } - - public double noise3(int x, int y, int z, double noiseScaleXZ, double noiseScaleY) { - return this.noise3(x, y, z, noiseScaleXZ, noiseScaleY, true); - } - - public double noise3(int x, int y, int z, double noiseScale, boolean useCache) { - return this.noise3(x, y, z, noiseScale, noiseScale, true); - } - - public double noise3(int x, int y, int z, double noiseScaleXZ, double noiseScaleY, boolean useCache) { - float octaveScale = 1; - double noise = 0; - - //Cache is invalid if parameters change - if (lastXZScale != noiseScaleXZ || lastYScale != noiseScaleY) { - flushCache(); - - lastXZScale = noiseScaleXZ; - lastYScale = noiseScaleY; - } - - if (isValueCached(x, y, z) && useCache) { - noise = this.getCachedValue(x, y, z); - } - else { - for (int i = 0; i < generators.length; i++) { - noise += generators[i].noise3_XZBeforeY(x * noiseScaleXZ / octaveScale, y * noiseScaleY / octaveScale, z * noiseScaleXZ / octaveScale) * octaveScale; - octaveScale /= 2; - } - - if (useCache) - cacheValue(x, y, z, noise); - } - - return noise; - } - - private boolean isValueCached(int x, int y, int z) { - int i = modIgnoreNegative(x, 16); - int k = modIgnoreNegative(z, 16); - - double[] cacheMap = noiseCache[i][k][y]; - - int chunkX = x < 0 ? x / 16 - 1 : x / 16; - int chunkZ = z < 0 ? z / 16 - 1 : z / 16; - - return cacheMap[0] == chunkX && cacheMap[1] == chunkZ; - } - - private void cacheValue(int x, int y, int z, double noise) { - int i = modIgnoreNegative(x, 16); - int k = modIgnoreNegative(z, 16); - - int chunkX = x < 0 ? x / 16 - 1 : x / 16; - int chunkZ = z < 0 ? z / 16 - 1 : z / 16; - - noiseCache[i][k][y] = new double[] {chunkX, chunkZ, noise}; - } - - private double getCachedValue(int x, int y, int z) { - int i = modIgnoreNegative(x, 16); - int k = modIgnoreNegative(z, 16); - - return noiseCache[i][k][y][2]; - } - - public void flushCache() { - for (int i = 0; i < 16; i++) { - for (int j = 0; j < 16; j++) { - for (int k = 0; k < 256; k++) { - for (int c = 0; c < 3; c++) { - noiseCache[i][j][k][c] = 0; - } - } - } - } - } - - /** - * Same as n % m except cannot produce negative numbers - * @param n - * @param m - * @return - */ - private int modIgnoreNegative(int n, int m) { - return (n % m + m) % m; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/generate/noise/OpenSimplexOctavesFast.java b/minecraft_server/betterterrain/world/generate/noise/OpenSimplexOctavesFast.java deleted file mode 100644 index 983a047..0000000 --- a/minecraft_server/betterterrain/world/generate/noise/OpenSimplexOctavesFast.java +++ /dev/null @@ -1,82 +0,0 @@ -package betterterrain.world.generate.noise; - -import java.util.Random; - -import opensimplex2.OpenSimplex2; -import opensimplex2.OpenSimplex2F; -import opensimplex2.OpenSimplex2S; - -public class OpenSimplexOctavesFast { - private OpenSimplex2F[] generators; - - public OpenSimplexOctavesFast(long seed, int numOctaves) { - Random rand = new Random(); - rand.setSeed(seed); - - this.generators = new OpenSimplex2F[numOctaves]; - - for (int i = 0; i < numOctaves; i++) { - this.generators[i] = new OpenSimplex2F(rand.nextLong()); - } - } - - public double noise2(double x, double y) { - float octaveScale = 1; - double noise = 0; - - for (int i = 0; i < generators.length; i++) { - noise += generators[i].noise2(x / octaveScale, y / octaveScale) * octaveScale; - octaveScale /= 2; - } - - return noise; - } - - public double noise2(double x, double y, double treeNoiseScale) { - float octaveScale = 1; - double noise = 0; - - for (int i = 0; i < generators.length; i++) { - noise += generators[i].noise2(x * treeNoiseScale / octaveScale, y * treeNoiseScale / octaveScale) * octaveScale; - octaveScale /= 2; - } - - return noise; - } - - public double noise3(double x, double y, double z) { - float octaveScale = 1; - double noise = 0; - - for (int i = 0; i < generators.length; i++) { - noise += generators[i].noise3_XZBeforeY(x / octaveScale, y / octaveScale, z / octaveScale) * octaveScale; - octaveScale /= 2; - } - - return noise; - } - - public double noise3(double x, double y, double z, double noiseScale) { - float octaveScale = 1; - double noise = 0; - - for (int i = 0; i < generators.length; i++) { - noise += generators[i].noise3_XZBeforeY(x * noiseScale / octaveScale, y * noiseScale / octaveScale, z * noiseScale / octaveScale) * octaveScale; - octaveScale /= 2; - } - - return noise; - } - - public double noise3(double x, double y, double z, double noiseScaleXZ, double noiseScaleY) { - float octaveScale = 1; - double noise = 0; - - for (int i = 0; i < generators.length; i++) { - noise += generators[i].noise3_XZBeforeY(x * noiseScaleXZ / octaveScale, y * noiseScaleY / octaveScale, z * noiseScaleXZ / octaveScale) * octaveScale; - octaveScale /= 2; - } - - return noise; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/generate/noise/OpenSimplexOctavesSmooth.java b/minecraft_server/betterterrain/world/generate/noise/OpenSimplexOctavesSmooth.java deleted file mode 100644 index 8ce5431..0000000 --- a/minecraft_server/betterterrain/world/generate/noise/OpenSimplexOctavesSmooth.java +++ /dev/null @@ -1,69 +0,0 @@ -package betterterrain.world.generate.noise; - -import java.util.Random; - -import opensimplex2.OpenSimplex2; -import opensimplex2.OpenSimplex2S; - -public class OpenSimplexOctavesSmooth { - private OpenSimplex2S[] generators; - - public OpenSimplexOctavesSmooth(long seed, int numOctaves) { - Random rand = new Random(); - rand.setSeed(seed); - - this.generators = new OpenSimplex2S[numOctaves]; - - for (int i = 0; i < numOctaves; i++) { - this.generators[i] = new OpenSimplex2S(rand.nextLong()); - } - } - - public double noise2(double x, double y) { - float octaveScale = 1; - double noise = 0; - - for (int i = 0; i < generators.length; i++) { - noise += generators[i].noise2(x / octaveScale, y / octaveScale) * octaveScale; - octaveScale /= 2; - } - - return noise; - } - - public double noise2(double x, double y, double noiseScale) { - float octaveScale = 1; - double noise = 0; - - for (int i = 0; i < generators.length; i++) { - noise += generators[i].noise2(x * noiseScale / octaveScale, y * noiseScale / octaveScale) * octaveScale; - octaveScale /= 2; - } - - return noise; - } - - public double noise3(double x, double y, double z) { - float octaveScale = 1; - double noise = 0; - - for (int i = 0; i < generators.length; i++) { - noise += generators[i].noise3_XZBeforeY(x / octaveScale, y / octaveScale, z / octaveScale) * octaveScale; - octaveScale /= 2; - } - - return noise; - } - - public double noise3(double x, double y, double z, double noiseScaleXZ, double noiseScaleY) { - float octaveScale = 1; - double noise = 0; - - for (int i = 0; i < generators.length; i++) { - noise += generators[i].noise3_XZBeforeY(x * noiseScaleXZ / octaveScale, y * noiseScaleY / octaveScale, z * noiseScaleXZ / octaveScale) * octaveScale; - octaveScale /= 2; - } - - return noise; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/generate/surface/IcyPeaksSurfaceBuilder.java b/minecraft_server/betterterrain/world/generate/surface/IcyPeaksSurfaceBuilder.java deleted file mode 100644 index 23a83ec..0000000 --- a/minecraft_server/betterterrain/world/generate/surface/IcyPeaksSurfaceBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -package betterterrain.world.generate.surface; - -import java.util.Random; - -import betterterrain.feature.tree.TaigaGen5; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenTaiga2; -import net.minecraft.src.WorldGenerator; - -public class IcyPeaksSurfaceBuilder extends SurfaceBuilder { - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random treeRand = new Random(seed + 3000); - - this.treeNoiseGen = new OpenSimplexOctaves(treeRand.nextLong(), 2); - - this.treeNoiseScale = 1/256D; - } - - public void generateTreesForBiome(World world, Random rand, WorldConfigurationInfo generatorInfo) { - int numTrees = 3; - - for (int i = 0; i < numTrees; ++i) - { - int x = this.chunkX + rand.nextInt(16) + 8; - int z = this.chunkZ + rand.nextInt(16) + 8; - - WorldGenerator gen; - - if (rand.nextInt(3) == 0) { - gen = new TaigaGen5(false); - } - else { - gen = new WorldGenTaiga2(false); - } - - if (this.treeNoiseGen.noise2(x, z, this.treeNoiseScale) + .5 > 0 && rand.nextInt(30) > 0) { - continue; - } - - gen.setScale(1.0D, 1.0D, 1.0D); - gen.generate(world, rand, x, world.getHeightValue(x, z), z); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/generate/surface/LegacySurfaceBuilder.java b/minecraft_server/betterterrain/world/generate/surface/LegacySurfaceBuilder.java deleted file mode 100644 index 3840696..0000000 --- a/minecraft_server/betterterrain/world/generate/surface/LegacySurfaceBuilder.java +++ /dev/null @@ -1,197 +0,0 @@ -package betterterrain.world.generate.surface; - -import java.util.Random; - -import betterbiomes.biome.BetterBiomesConfiguration; -import betterterrain.BTAVersion; -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.BetaNoiseOctaves; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.NoiseGeneratorOctaves; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; - -public class LegacySurfaceBuilder extends SurfaceBuilder { - private double[] sandNoiseLegacy = new double[256]; - private double[] gravelNoiseLegacy = new double[256]; - private double[] soilDepthNoiseLegacy = new double[256]; - private BetaNoiseOctaves sandNoiseGenLegacy; - private NoiseGeneratorOctaves soilDepthNoiseGenLegacy; - - public void init(Random rand, long seed) { - this.sandNoiseGenLegacy = new BetaNoiseOctaves(rand, 4); - this.soilDepthNoiseGenLegacy = new NoiseGeneratorOctaves(rand, 4); - } - - public void replaceBlocksForBiome(Random rand, int chunkX, int chunkZ, int[] blockArray, int[] metaArray, BiomeGenBase[] biomesForGeneration, WorldConfigurationInfo generatorInfo) { - byte seaLevel = 63; - double soilDepthNoiseScalar = 0.03125D; - this.sandNoiseLegacy = this.sandNoiseGenLegacy.generateNoiseOctaves(this.sandNoiseLegacy, (double)(chunkX * 16), (double)(chunkZ * 16), 0.0D, 16, 16, 1, soilDepthNoiseScalar, soilDepthNoiseScalar, 1.0D); - this.gravelNoiseLegacy = this.sandNoiseGenLegacy.generateNoiseOctaves(this.gravelNoiseLegacy, (double)(chunkX * 16), 109.0134D, (double)(chunkZ * 16), 16, 1, 16, soilDepthNoiseScalar, 1.0D, soilDepthNoiseScalar); - this.soilDepthNoiseLegacy = this.soilDepthNoiseGenLegacy.generateNoiseOctaves(this.soilDepthNoiseLegacy, chunkX * 16, chunkZ * 16, 0, 16, 16, 1, soilDepthNoiseScalar * 2.0D, soilDepthNoiseScalar * 2.0D, soilDepthNoiseScalar * 2.0D); - - for (int i = 0; i < 16; ++i) { - for (int k = 0; k < 16; ++k) { - BiomeGenBase biome = biomesForGeneration[k + i * 16]; - - float temperature = biome.getFloatTemperature(); - boolean useSand = this.sandNoiseLegacy[i + k * 16] + rand.nextDouble() * 0.2D > 0.0D; - boolean useGravel = this.gravelNoiseLegacy[i + k * 16] + rand.nextDouble() * 0.2D > 3.0D; - int soilDepthNoiseSample = (int)(this.soilDepthNoiseLegacy[i + k * 16] / 3.0D + 3.0D + rand.nextDouble() * 0.25D); - int remaingDepth = -1; - int topBlock; - int fillerBlock; - - if (biome instanceof BTABiome) { - topBlock = ((BTABiome) biome).topBlockExt; - fillerBlock = ((BTABiome) biome).fillerBlockExt; - } - else { - topBlock = biome.topBlock; - fillerBlock = biome.fillerBlock; - } - - for (int j = 127; j >= 0; --j) { - int index = (k * 16 + i) * 128 + j; - - if (j <= 0 + rand.nextInt(5)) { - blockArray[index] = (byte)Block.bedrock.blockID; - } - else { - int blockID = blockArray[index]; - - if (blockID == 0) { - remaingDepth = -1; - } - else if (blockID == Block.stone.blockID) { - if (remaingDepth == -1) { - if (soilDepthNoiseSample <= 0) { - topBlock = 0; - fillerBlock = (byte)Block.stone.blockID; - } - else if (j >= seaLevel - (8 + rand.nextInt(2)) && j <= seaLevel + 1) { - if(biome.biomeID == BetterBiomesConfiguration.oldValley.biomeID || biome.biomeID == BetterBiomesConfiguration.valleyMountains.biomeID || biome.biomeID == BetterBiomesConfiguration.valley.biomeID || - ((biome.biomeID == BetterBiomesConfiguration.tropics.biomeID || biome.biomeID == BetterBiomesConfiguration.tropicsEdge.biomeID || biome.biomeID == BetterBiomesConfiguration.tropicsRiver.biomeID) && generatorInfo.getBTAVersion().isVersionAtLeast(BTAVersion.V1_2_0))) { - topBlock = (byte)Block.sand.blockID; - fillerBlock = (byte)Block.sand.blockID; - } - else { - if (biome instanceof BTABiome) { - topBlock = ((BTABiome) biome).topBlockExt; - fillerBlock = ((BTABiome) biome).fillerBlockExt; - } - else { - topBlock = biome.topBlock; - fillerBlock = biome.fillerBlock; - } - } - - if (generatorInfo.generatePerlinBeaches() && biome instanceof BTABiome && !(((BTABiome) biome).getSurfaceBuilder() instanceof NoShorelineSurfaceBuilder)) { - if (useGravel) { - topBlock = 0; - fillerBlock = Block.gravel.blockID; - } - - if (useSand) { - if (biome == BetterBiomesConfiguration.badlands || biome == BetterBiomesConfiguration.badlandsPlateau || biome == BetterBiomesConfiguration.badlandsEdge || biome == BetterBiomesConfiguration.badlandsRiver || - biome == BetterBiomesConfiguration.outback || biome == BetterBiomesConfiguration.outbackRiver || biome == BetterBiomesConfiguration.redSandBeach) { - topBlock = DecoIntegration.redSand.blockID; - fillerBlock = DecoIntegration.redSand.blockID; - } - else { - topBlock = Block.sand.blockID; - fillerBlock = Block.sand.blockID; - } - } - } - } - else if (j >= seaLevel + 9) { - if (biome instanceof BTABiome) { - topBlock = ((BTABiome) biome).topBlockExt; - fillerBlock = ((BTABiome) biome).fillerBlockExt; - } - else { - topBlock = biome.topBlock; - fillerBlock = biome.fillerBlock; - } - } - - if (j < seaLevel && topBlock == 0) { - if (temperature < 0.15F) { - topBlock = (byte)Block.ice.blockID; - } - else { - topBlock = (byte)Block.waterStill.blockID; - } - } - - remaingDepth = soilDepthNoiseSample; - - if (biome.biomeID == BetterBiomesConfiguration.badlandsPlateau.biomeID) - remaingDepth += 10; - - if (j >= seaLevel - 1) { - blockArray[index] = topBlock; - } - else { - blockArray[index] = fillerBlock; - } - } - else if (remaingDepth > 0) { - --remaingDepth; - blockArray[index] = fillerBlock; - - if (remaingDepth == 0 && fillerBlock == Block.sand.blockID) { - remaingDepth = rand.nextInt(4); - fillerBlock = (byte)Block.sandStone.blockID; - } - else if (DecoIntegration.isDecoInstalled() && remaingDepth == 0 && fillerBlock == DecoIntegration.redSand.blockID) { - remaingDepth = rand.nextInt(4); - fillerBlock = DecoIntegration.redSandStone.blockID; - } - } - } - } - } - } - } - } - - protected void generateTreesForBiome(World world, Random rand, int chunkX, int chunkZ, BiomeGenBase biome, WorldConfigurationInfo generatorInfo) { - int numTrees; - - if (biome instanceof BTABiome) { - numTrees = ((BTABiome) biome).btaBiomeDecorator.treesPerChunk; - - if (rand.nextInt(((BTABiome) biome).btaBiomeDecorator.fractionalTreeChance) == 0) - numTrees++; - } - else { - numTrees = biome.theBiomeDecorator.treesPerChunk; - - if (rand.nextInt(10) == 0) - numTrees++; - } - - for (int i = 0; i < numTrees; ++i) - { - int x = chunkX + rand.nextInt(16) + 8; - int z = chunkZ + rand.nextInt(16) + 8; - - WorldGenerator gen; - - if (biome instanceof BTABiome) { - gen = ((BTABiome) biome).getRandomWorldGenForTrees(rand, generatorInfo, world.provider.terrainType); - } - else { - gen = biome.getRandomWorldGenForTrees(rand); - } - - gen.setScale(1.0D, 1.0D, 1.0D); - gen.generate(world, rand, x, world.getHeightValue(x, z), z); - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/generate/surface/NetherSurfaceBuilder.java b/minecraft_server/betterterrain/world/generate/surface/NetherSurfaceBuilder.java deleted file mode 100644 index f1e6dd6..0000000 --- a/minecraft_server/betterterrain/world/generate/surface/NetherSurfaceBuilder.java +++ /dev/null @@ -1,99 +0,0 @@ -package betterterrain.world.generate.surface; - -import java.util.Random; - -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceProcessingResult; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.WorldType; - -public class NetherSurfaceBuilder extends SurfaceBuilder { - @Override - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, boolean isReversed, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - int blockID = -1; - int metadata = 0; - - if (surfaceJ <= 64 && !isReversed) { - if (useSandAtLocation(i, k, rand)) { - blockID = Block.slowSand.blockID; - } - else if (surfaceJ > 58 && useGravelAtLocation(i, k, rand, generatorInfo)) { - if (surfaceType == SurfaceType.TOP) { - blockID = Block.gravel.blockID; - } - } - } - - if (blockID == -1) { - blockID = getDefaultSurfaceBlock(i, k, surfaceType, Block.netherrack.blockID); - } - - return new int[] {blockID, metadata}; - } - - @Override - protected void replaceBlocksForBiome(Random rand, int i, int k, int[] blockArray, int[] metaArray, BiomeGenBase[] biomesForGeneration, WorldConfigurationInfo generatorInfo, WorldType worldType, boolean isNether) { - byte seaLevel = 0; - - float temperature = biome.getFloatTemperature(); - - int soilDepth = getSoilDepth(i, k, rand, generatorInfo); - int remainingDepth = -1; - - boolean useSubfiller = false; - - int surfaceJ = 127; - - for (int j = 127; j >= 0; j--) { - if (j <= 0 + rand.nextInt(5) && !worldType.isSky()) { - setBlockValue(blockArray, i, j, k, Block.bedrock.blockID); - } - else { - SurfaceProcessingResult result = generateSurfaceAtLocation(blockArray, metaArray, i, j, k, surfaceJ, soilDepth, remainingDepth, useSubfiller, seaLevel, temperature, false, rand, generatorInfo, worldType); - remainingDepth = result.remainingDepth; - useSubfiller = result.useSubfiller; - surfaceJ = result.surfaceJ; - } - } - - surfaceJ = 0; - - for (int j = 0; j <= 127; j++) { - if (j >= 127 - rand.nextInt(5) && !worldType.isSky()) { - setBlockValue(blockArray, i, j, k, Block.bedrock.blockID); - } - else { - SurfaceProcessingResult result = generateSurfaceAtLocation(blockArray, metaArray, i, j, k, surfaceJ, soilDepth, remainingDepth, useSubfiller, seaLevel, temperature, true, rand, generatorInfo, worldType); - remainingDepth = result.remainingDepth; - useSubfiller = result.useSubfiller; - surfaceJ = result.surfaceJ; - } - } - } - - @Override - protected boolean useSandAtLocation(int i, int k, Random rand) { - double beachNoiseScale = 1/256D; - //k and i swapped because apparently I messed something up somewhere - return sandNoiseGenSimplex.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), beachNoiseScale) > 0.925; - } - - @Override - protected boolean useGravelAtLocation(int i, int k, Random rand, WorldConfigurationInfo generatorInfo) { - double beachNoiseScale = 1/384D; - //k and i swapped because apparently I messed something up somewhere - return gravelNoiseGenSimplex.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), beachNoiseScale) > 0.9625; - } - - @Override - protected int getSoilDepth(int i, int k, Random rand, WorldConfigurationInfo generatorInfo) { - return 3; - } - - @Override - protected int getSubsurfaceDepth(Random rand) { - return 0; - } -} diff --git a/minecraft_server/betterterrain/world/generate/surface/NoShorelineSurfaceBuilder.java b/minecraft_server/betterterrain/world/generate/surface/NoShorelineSurfaceBuilder.java deleted file mode 100644 index 03e247f..0000000 --- a/minecraft_server/betterterrain/world/generate/surface/NoShorelineSurfaceBuilder.java +++ /dev/null @@ -1,18 +0,0 @@ -package betterterrain.world.generate.surface; - -import java.util.Random; - -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; - -public class NoShorelineSurfaceBuilder extends SurfaceBuilder { - @Override - protected boolean useSandAtLocation(int i, int k, Random rand) { - return false; - } - - @Override - protected boolean useGravelAtLocation(int i, int k, Random rand, WorldConfigurationInfo generatorInfo) { - return false; - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/generate/surface/StonySurfaceBuilder.java b/minecraft_server/betterterrain/world/generate/surface/StonySurfaceBuilder.java deleted file mode 100644 index dca72d2e..0000000 --- a/minecraft_server/betterterrain/world/generate/surface/StonySurfaceBuilder.java +++ /dev/null @@ -1,145 +0,0 @@ -package betterterrain.world.generate.surface; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.WorldType; -import opensimplex2.OpenSimplex2F; - -public class StonySurfaceBuilder extends SurfaceBuilder { - protected static OpenSimplexOctaves stoneNoiseGenSimplex; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random stoneRand = new Random(seed + 1000); - - stoneNoiseGenSimplex = new OpenSimplexOctaves(stoneRand.nextLong(), 2); - } - - @Override - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - double stoneNoiseScale = 1/16D; - boolean useStone = stoneNoiseGenSimplex.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), stoneNoiseScale) - 0.625 > 0; - - boolean sandOrGravel = (this.useSandAtLocation(i, k, rand) || this.useGravelAtLocation(i, k, rand, generatorInfo)) && surfaceJ <= seaLevel + 1; - - if (useStone && DecoIntegration.isDecoInstalled() && worldType.isDeco() && !sandOrGravel) { - return new int[] {Block.stone.blockID, 0}; - } - else { - return super.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, surfaceType, seaLevel, rand, generatorInfo, worldType); - } - } - - public void replaceBlocksForBiome(Random rand, int i, int k, int[] blockArray, int[] metaArray, BiomeGenBase[] biomesForGeneration, WorldConfigurationInfo generatorInfo) { - byte seaLevel = 63; - - float temperature = biome.getFloatTemperature(); - - double sandNoiseScale = 1/256D; - //k and i swapped because apparently I messed something up somewhere - boolean useSand = sandNoiseGenSimplex.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), sandNoiseScale) + rand.nextDouble() * 0.2D > 0; - - double grassNoiseScale = 1/16D; - boolean useStone = stoneNoiseGenSimplex.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), grassNoiseScale) - 0.625 > 0; - - boolean useGravel = this.gravelNoise[i + k * 16] + rand.nextDouble() * 0.2D > 3.0D; - int soilDepthNoiseSample = (int)(this.soilDepthNoiseLegacy[i + k * 16] / 3.0D + 3.0D + rand.nextDouble() * 0.25D); - int remaingDepth = -1; - int topBlock; - int fillerBlock; - - topBlock = ((BTABiome) biome).topBlockExt; - fillerBlock = ((BTABiome) biome).fillerBlockExt; - - for (int j = 127; j >= 0; --j) { - int index = (k * 16 + i) * 128 + j; - - if (j <= 0 + rand.nextInt(5)) { - blockArray[index] = (byte)Block.bedrock.blockID; - } - else { - int blockID = blockArray[index]; - - if (blockID == 0) { - remaingDepth = -1; - } - else if (blockID == Block.stone.blockID) { - if (remaingDepth == -1) { - if (soilDepthNoiseSample <= 0) { - topBlock = 0; - fillerBlock = (byte)Block.stone.blockID; - } - else if (j >= seaLevel - (8 + rand.nextInt(2)) && j <= seaLevel + 1) { - if (generatorInfo.generatePerlinBeaches()) { - if (useGravel) { - topBlock = 0; - fillerBlock = Block.gravel.blockID; - } - - if (useSand) { - topBlock = Block.sand.blockID; - fillerBlock = Block.sand.blockID; - } - } - } - else if (j >= seaLevel + 9) { - if (biome instanceof BTABiome) { - topBlock = ((BTABiome) biome).topBlockExt; - fillerBlock = ((BTABiome) biome).fillerBlockExt; - } - else { - topBlock = biome.topBlock; - fillerBlock = biome.fillerBlock; - } - } - - if (useStone && topBlock == Block.grass.blockID && j >= seaLevel - 1) { - topBlock = Block.stone.blockID; - fillerBlock = Block.stone.blockID; - } - - if (j < seaLevel && topBlock == 0) { - if (temperature < 0.15F) { - topBlock = (byte)Block.ice.blockID; - } - else { - topBlock = (byte)Block.waterStill.blockID; - } - } - - remaingDepth = soilDepthNoiseSample; - - if (j >= seaLevel - 1) { - blockArray[index] = topBlock; - } - else { - blockArray[index] = fillerBlock; - } - } - else if (remaingDepth > 0) { - --remaingDepth; - blockArray[index] = fillerBlock; - - if (remaingDepth == 0 && fillerBlock == Block.sand.blockID) { - remaingDepth = rand.nextInt(4); - fillerBlock = (byte)Block.sandStone.blockID; - } - else if (DecoIntegration.isDecoInstalled() && remaingDepth == 0 && fillerBlock == DecoIntegration.redSand.blockID) { - remaingDepth = rand.nextInt(4); - fillerBlock = DecoIntegration.redSandStone.blockID; - } - } - } - } - } - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/generate/surface/SurfaceBuilder.java b/minecraft_server/betterterrain/world/generate/surface/SurfaceBuilder.java deleted file mode 100644 index 999e299..0000000 --- a/minecraft_server/betterterrain/world/generate/surface/SurfaceBuilder.java +++ /dev/null @@ -1,715 +0,0 @@ -package betterterrain.world.generate.surface; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Random; -import java.util.Set; - -import betterterrain.BTAVersion; -import betterterrain.DecoIntegration; -import betterterrain.BTAMod; -import betterterrain.biome.BTABiome; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.BiomeGenBase; -import net.minecraft.src.Block; -import net.minecraft.src.MathHelper; -import net.minecraft.src.NoiseGeneratorOctaves; -import net.minecraft.src.World; -import net.minecraft.src.WorldGenerator; -import net.minecraft.src.WorldType; -import opensimplex2.OpenSimplex2F; - -public class SurfaceBuilder { - protected static NoiseGeneratorOctaves blockModifierNoiseGen; - protected static NoiseGeneratorOctaves blockNoiseGen1; - protected static NoiseGeneratorOctaves blockNoiseGen2; - protected static NoiseGeneratorOctaves biomeHeightNoiseGen; - - protected static double[] blockModifierNoise; - protected static double[] blockNoise1; - protected static double[] blockNoise2; - protected static double[] biomeHeightNoise; - - protected static int parabolicRadius = 2; - protected static float[] parabolicField; - - protected static double[] gravelNoise = new double[256]; - protected static double[] soilDepthNoiseLegacy = new double[256]; - protected static NoiseGeneratorOctaves soilDepthNoiseGenLegacy; - - protected static OpenSimplexOctaves sandNoiseGenSimplex; - protected static OpenSimplexOctaves soilDepthNoiseGenSimplex; - protected static OpenSimplexOctaves gravelNoiseGenSimplex; - - protected static OpenSimplexOctaves snowHeightNoiseGenSimplex; - - protected BiomeGenBase biome; - public boolean hasBeenInit = false; - - protected int chunkX; - protected int chunkZ; - - protected double treeNoiseScale = 1/64D; - protected OpenSimplexOctaves treeNoiseGen; - - public static final SurfaceBuilder defaultBuilder = new SurfaceBuilder(); - public static final LegacySurfaceBuilder legacyBuilder = new LegacySurfaceBuilder(); - - //New 3D array format - public static void replaceSurface(Random rand, long seed, int chunkX, int chunkZ, int[][][] blockArray, int[][][] metaArray, BiomeGenBase[] biomesForGeneration, WorldConfigurationInfo generatorInfo, WorldType worldType) { - Set biomeSet = new HashSet(Arrays.asList(biomesForGeneration)); - - for (BiomeGenBase b : biomeSet) { - if (b instanceof BTABiome && ((BTABiome) b).getSurfaceBuilder() != null) { - if (!((BTABiome) b).getSurfaceBuilder().hasBeenInit) { - ((BTABiome) b).getSurfaceBuilder().init(rand, seed); - ((BTABiome) b).getSurfaceBuilder().hasBeenInit = true; - } - - ((BTABiome) b).getSurfaceBuilder().initForChunk(chunkX, chunkZ); - } - } - - if (!defaultBuilder.hasBeenInit) { - defaultBuilder.init(rand, seed); - defaultBuilder.hasBeenInit = true; - } - - defaultBuilder.initForChunk(chunkX, chunkZ); - - for (int i = 0; i < 16; i++) { - for (int k = 0; k < 16; k++) { - BiomeGenBase biome = biomesForGeneration[k + i*16]; - - if (biome instanceof BTABiome && ((BTABiome) biome).getSurfaceBuilder() != null) { - ((BTABiome) biome).getSurfaceBuilder().replaceBlocksForBiome(rand, k, i, blockArray, metaArray, biomesForGeneration, generatorInfo, worldType, ((BTABiome) biome).isNether()); - } - else { - defaultBuilder.setBiome(biome); - defaultBuilder.replaceBlocksForBiome(rand, k, i, blockArray, metaArray, biomesForGeneration, generatorInfo, worldType, false); - } - } - } - } - - //Old 1D array format - public static void replaceSurface(Random rand, long seed, int chunkX, int chunkZ, int[] blockArray, int[] metaArray, BiomeGenBase[] biomesForGeneration, WorldConfigurationInfo generatorInfo, WorldType worldType) { - if (generatorInfo.getBTAVersion().isVersionAtOrBelow(BTAVersion.V1_3_4)) { - if (!legacyBuilder.hasBeenInit) { - legacyBuilder.init(rand, seed); - legacyBuilder.hasBeenInit = true; - } - - legacyBuilder.replaceBlocksForBiome(rand, chunkX, chunkZ, blockArray, metaArray, biomesForGeneration, generatorInfo); - } - else { - Set biomeSet = new HashSet(Arrays.asList(biomesForGeneration)); - - for (BiomeGenBase b : biomeSet) { - if (b instanceof BTABiome && ((BTABiome) b).getSurfaceBuilder() != null) { - if (!((BTABiome) b).getSurfaceBuilder().hasBeenInit) { - ((BTABiome) b).getSurfaceBuilder().init(rand, seed); - ((BTABiome) b).getSurfaceBuilder().hasBeenInit = true; - } - - ((BTABiome) b).getSurfaceBuilder().initForChunk(chunkX, chunkZ); - } - } - - if (!defaultBuilder.hasBeenInit) { - defaultBuilder.init(rand, seed); - defaultBuilder.hasBeenInit = true; - } - - defaultBuilder.initForChunk(chunkX, chunkZ); - - for (int i = 0; i < 16; i++) { - for (int k = 0; k < 16; k++) { - BiomeGenBase biome = biomesForGeneration[k + i*16]; - - if (biome instanceof BTABiome && ((BTABiome) biome).getSurfaceBuilder() != null) { - ((BTABiome) biome).getSurfaceBuilder().replaceBlocksForBiome(rand, i, k, blockArray, metaArray, biomesForGeneration, generatorInfo, worldType, ((BTABiome) biome).isNether()); - } - else { - defaultBuilder.setBiome(biome); - defaultBuilder.replaceBlocksForBiome(rand, i, k, blockArray, metaArray, biomesForGeneration, generatorInfo, worldType, false); - } - } - } - } - } - - public static void generateTrees(World world, Random rand, long seed, WorldConfigurationInfo generatorInfo, int chunkX, int chunkZ, BTABiome biome) { - SurfaceBuilder builder = biome.getSurfaceBuilder(); - - if (generatorInfo.getBTAVersion().isVersionAtLeast(BTAVersion.V1_4_0)) { - if (builder != null) { - if (!builder.hasBeenInit) { - builder.init(rand, seed); - } - - builder.initForChunk(chunkX, chunkZ); - builder.generateTreesForBiome(world, rand, generatorInfo); - } - else { - defaultBuilder.setBiome(biome); - defaultBuilder.initForChunk(chunkX, chunkZ); - defaultBuilder.generateTreesForBiome(world, rand, generatorInfo); - } - } - else { - legacyBuilder.generateTreesForBiome(world, rand, chunkX, chunkZ, biome, generatorInfo); - } - } - - public static void initForNoiseField(long seed) { - Random rand = new Random(seed); - - blockNoiseGen1 = new NoiseGeneratorOctaves(rand, 16); - blockNoiseGen2 = new NoiseGeneratorOctaves(rand, 16); - blockModifierNoiseGen = new NoiseGeneratorOctaves(rand, 8); - soilDepthNoiseGenLegacy = new NoiseGeneratorOctaves(rand, 4); - biomeHeightNoiseGen = new NoiseGeneratorOctaves(rand, 16); - } - - public static double[] initializeNoiseField(Random rand, long seed, double[] noiseArray, int posX, int posY, int posZ, int sizeX, int sizeY, int sizeZ, BiomeGenBase[] biomesForGeneration) { - if (noiseArray == null) { - noiseArray = new double[sizeX * sizeY * sizeZ]; - } - - //Parabolic field is used for smoothing between biomes - int parabolicDiameter = parabolicRadius * 2 + 1; - - if (parabolicField == null) { - parabolicField = new float[(int) Math.pow(parabolicDiameter, 2)]; - - for (int i = -parabolicRadius; i <= parabolicRadius; ++i) { - for (int k = -parabolicRadius; k <= parabolicRadius; ++k) { - float parabolicValue = 10.0F / MathHelper.sqrt_float((float)(i * i + k * k) + 0.2F); - parabolicField[i + parabolicRadius + (k + parabolicRadius) * parabolicDiameter] = parabolicValue; - } - } - } - - double octaveScalarXZ = 684.412D; - double octaveScalarY = 684.412D; - biomeHeightNoise = biomeHeightNoiseGen.generateNoiseOctaves(biomeHeightNoise, posX, posZ, sizeX, sizeZ, 200.0D, 200.0D, 0.5D); - blockModifierNoise = blockModifierNoiseGen.generateNoiseOctaves(blockModifierNoise, posX, posY, posZ, sizeX, sizeY, sizeZ, octaveScalarXZ / 80.0D, octaveScalarY / 160.0D, octaveScalarXZ / 80.0D); - blockNoise1 = blockNoiseGen1.generateNoiseOctaves(blockNoise1, posX, posY, posZ, sizeX, sizeY, sizeZ, octaveScalarXZ, octaveScalarY, octaveScalarXZ); - blockNoise2 = blockNoiseGen2.generateNoiseOctaves(blockNoise2, posX, posY, posZ, sizeX, sizeY, sizeZ, octaveScalarXZ, octaveScalarY, octaveScalarXZ); - int biomeHeightNoiseIndex = 0; - int blockNoiseIndex = 0; - - //Iterates through the entire noise array for population - //Loops first through x and z, getting biome height data, then iterates through y values - for (int i = 0; i < sizeX; ++i) { - for (int k = 0; k < sizeZ; ++k) { - float biomeMaxHeightSample = 0.0F; - float biomeMinHeightSample = 0.0F; - float biomeModifierTotal = 0.0F; - BiomeGenBase biomeForNoise = biomesForGeneration[i + parabolicRadius + (k + parabolicRadius) * (sizeX + parabolicDiameter)]; - - //Gets biome height values influenced by neighboring biomes - //Weights provided by the parabolic field - for (int c = -parabolicRadius; c <= parabolicRadius; ++c) { - for (int d = -parabolicRadius; d <= parabolicRadius; ++d) { - BiomeGenBase biomeNeighbor = biomesForGeneration[i + c + parabolicRadius + (k + d + parabolicRadius) * (sizeX + parabolicDiameter)]; - float biomeHeightModifierValue = parabolicField[c + parabolicRadius + (d + parabolicRadius) * parabolicDiameter] / (biomeNeighbor.minHeight + 2.0F); - - if (biomeNeighbor.minHeight > biomeForNoise.minHeight) { - biomeHeightModifierValue /= 2.0F; - } - - if (biomeNeighbor instanceof BTABiome && ((BTABiome) biomeNeighbor).isPlateau()) { - biomeMaxHeightSample += 0.4 * biomeHeightModifierValue; - biomeMinHeightSample += 0.8 * biomeHeightModifierValue; - } - else { - biomeMaxHeightSample += biomeNeighbor.maxHeight * biomeHeightModifierValue; - biomeMinHeightSample += biomeNeighbor.minHeight * biomeHeightModifierValue; - } - biomeModifierTotal += biomeHeightModifierValue; - } - } - - //Gets the value from the biome noise array to modify the biome height values above - double biomeHeightNoiseModifier = biomeHeightNoise[biomeHeightNoiseIndex] / 8000.0D; - biomeHeightNoiseIndex++; - - if (biomeHeightNoiseModifier < 0.0D) { - biomeHeightNoiseModifier = -biomeHeightNoiseModifier * 0.3D; - } - - biomeHeightNoiseModifier = biomeHeightNoiseModifier * 3.0D - 2.0D; - - if (biomeHeightNoiseModifier < 0.0D) { - biomeHeightNoiseModifier /= 2.0D; - - if (biomeHeightNoiseModifier < -1.0D){ - biomeHeightNoiseModifier = -1.0D; - } - - biomeHeightNoiseModifier /= 2.8D; - } - else { - if (biomeHeightNoiseModifier > 1.0D) { - biomeHeightNoiseModifier = 1.0D; - } - - biomeHeightNoiseModifier /= 8.0D; - } - - biomeMaxHeightSample /= biomeModifierTotal; - biomeMinHeightSample /= biomeModifierTotal; - biomeMaxHeightSample = biomeMaxHeightSample * 0.9F + 0.1F; - - if (biomeForNoise instanceof BTABiome && ((BTABiome) biomeForNoise).isPlateau()) { - biomeMinHeightSample = biomeMinHeightSample * 1.5F - 0.5F; - } - else { - biomeMinHeightSample = (biomeMinHeightSample * 4.0F - 1.0F) / 8.0F; - } - - //After biome height information has been processed, iterates through y values - for (int j = 0; j < sizeY; ++j) { - //Modifies biome height for x/z based on the current y value - double biomeMinHeightDouble = (double) biomeMinHeightSample; - double biomeMaxHeightDouble = (double) biomeMaxHeightSample; - biomeMinHeightDouble += biomeHeightNoiseModifier * 0.2D; - biomeMinHeightDouble = biomeMinHeightDouble * (double) sizeY / 16.0D; - double biomeMinHeightModified = (double) sizeY / 2.0D + biomeMinHeightDouble * 4.0D; - double noiseSample = 0.0D; - double biomeHeightValue = ((double) j - biomeMinHeightModified) * 12.0D / biomeMaxHeightDouble; - - if (biomeHeightValue < 0.0D) { - biomeHeightValue *= 4.0D; - } - - //Samples the noise fields at the current location - double blockNoiseModifierSample = (blockModifierNoise[blockNoiseIndex] / 10.0D + 1.0D) / 2.0D; - - double blockNoiseSample1 = blockNoise1[blockNoiseIndex] / 512.0D; - double blockNoiseSample2 = blockNoise2[blockNoiseIndex] / 512.0D; - - //Combines block noise fields depending on the value of the modifier sample - if (blockNoiseModifierSample < 0.0D) { - noiseSample = blockNoiseSample1; - } - else if (blockNoiseModifierSample > 1.0D) { - noiseSample = blockNoiseSample2; - } - else { - noiseSample = blockNoiseSample1 + (blockNoiseSample2 - blockNoiseSample1) * blockNoiseModifierSample; - } - - //Factors biome height calculations into final noise values - noiseSample -= biomeHeightValue; - - //Modifies noise at the top of the section - if (j > sizeY - 4) { - double sectionHeightModifier = (double)((float)(j - (sizeY - 4)) / 3.0F); - noiseSample = noiseSample * (1.0D - sectionHeightModifier) + -10.0D * sectionHeightModifier; - } - - noiseArray[blockNoiseIndex] = noiseSample; - - blockNoiseIndex++; - } - } - } - - return noiseArray; - } - - public void init(Random rand, long seed) { - Random sandRand = new Random(seed - 1000); - - sandNoiseGenSimplex = new OpenSimplexOctaves(sandRand.nextLong(), 8); - gravelNoiseGenSimplex = new OpenSimplexOctaves(sandRand.nextLong(), 8); - snowHeightNoiseGenSimplex = new OpenSimplexOctaves(sandRand.nextLong(), 8); - } - - protected void initForChunk(int chunkX, int chunkZ) { - this.chunkX = chunkX; - this.chunkZ = chunkZ; - - double surfaceNoiseScalar = 0.03125D; - this.soilDepthNoiseLegacy = this.soilDepthNoiseGenLegacy.generateNoiseOctaves(this.soilDepthNoiseLegacy, chunkX * 16, chunkZ * 16, 0, 16, 16, 1, surfaceNoiseScalar * 2.0D, surfaceNoiseScalar * 2.0D, surfaceNoiseScalar * 2.0D); - } - - //New 3D array format - protected void replaceBlocksForBiome(Random rand, int i, int k, int[][][] blockArray, int[][][] metaArray, BiomeGenBase[] biomesForGeneration, WorldConfigurationInfo generatorInfo, WorldType worldType, boolean isNether) { - byte seaLevel = 100; - - float temperature = biome.getFloatTemperature(); - - int soilDepth = getSoilDepth(i, k, rand, generatorInfo); - int remainingDepth = -1; - - boolean useSubfiller = false; - - int surfaceJ = 127; - - for (int j = 127; j >= 0; --j) { - if (j <= 0 + rand.nextInt(5) && !worldType.isSky()) { - setBlockValue(blockArray, i, j, k, Block.bedrock.blockID); - } - else { - SurfaceProcessingResult result = generateSurfaceAtLocation(blockArray, metaArray, i, j, k, surfaceJ, soilDepth, remainingDepth, useSubfiller, seaLevel, temperature, false, rand, generatorInfo, worldType); - remainingDepth = result.remainingDepth; - useSubfiller = result.useSubfiller; - surfaceJ = result.surfaceJ; - } - } - } - - protected void replaceBlocksForBiome(Random rand, int i, int k, int[] blockArray, int[] metaArray, BiomeGenBase[] biomesForGeneration, WorldConfigurationInfo generatorInfo, WorldType worldType, boolean isNether) { - byte seaLevel = 63; - - if (worldType == BTAMod.BTAWorldTypeBeta || worldType == BTAMod.BTAWorldTypeBetaDeco) { - seaLevel = 64; - } - - if (worldType.isSky() || isNether) - seaLevel = 0; - - float temperature = biome.getFloatTemperature(); - - int soilDepth = getSoilDepth(i, k, rand, generatorInfo); - int remainingDepth = -1; - - boolean useSubfiller = false; - - int surfaceJ = 127; - - for (int j = 127; j >= 0; j--) { - if (j <= 0 + rand.nextInt(5) && !worldType.isSky()) { - setBlockValue(blockArray, i, j, k, Block.bedrock.blockID); - } - else { - SurfaceProcessingResult result = generateSurfaceAtLocation(blockArray, metaArray, i, j, k, surfaceJ, soilDepth, remainingDepth, useSubfiller, seaLevel, temperature, false, rand, generatorInfo, worldType); - remainingDepth = result.remainingDepth; - useSubfiller = result.useSubfiller; - surfaceJ = result.surfaceJ; - } - } - } - - protected SurfaceProcessingResult generateSurfaceAtLocation( - Object blockArray, Object metaArray, - int i, int j, int k, int surfaceJ, - int soilDepth, int remainingDepth, boolean useSubfiller, int seaLevel, float temperature, - boolean isReversed, - Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) - { - int blockID = getBlockValue(blockArray, i, j, k); - - if (blockID == 0) { - remainingDepth = -1; - useSubfiller = false; - } - else if (blockID == Block.stone.blockID || blockID == Block.netherrack.blockID) { - if (remainingDepth == -1) { - remainingDepth = soilDepth; - surfaceJ = j; - - int[] surfaceBlock = this.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, SurfaceType.TOP, seaLevel, isReversed, rand, generatorInfo, worldType); - - if (j < seaLevel && surfaceBlock[0] == 0) { - if (temperature < 0.15F) { - surfaceBlock[0] = Block.ice.blockID; - surfaceBlock[1] = 0; - } - else { - surfaceBlock[0] = Block.waterStill.blockID; - surfaceBlock[1] = 0; - } - } - - setBlockValue(blockArray, i, j, k, surfaceBlock[0]); - setBlockValue(metaArray, i, j, k, surfaceBlock[1]); - } - else if (remainingDepth > 0) { - remainingDepth--; - - SurfaceType surfaceType = useSubfiller ? SurfaceType.SUBFILLER : SurfaceType.FILLER; - - int[] fillerBlock = this.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, surfaceType, seaLevel, isReversed, rand, generatorInfo, worldType); - - setBlockValue(blockArray, i, j, k, fillerBlock[0]); - setBlockValue(metaArray, i, j, k, fillerBlock[1]); - - if (remainingDepth == 0 && !useSubfiller) { - int subfillerDepth = this.getSubsurfaceDepth(rand); - remainingDepth += subfillerDepth; - useSubfiller = true; - } - } - } - - return new SurfaceProcessingResult(remainingDepth, surfaceJ, useSubfiller); - } - - public static class SurfaceProcessingResult { - public int remainingDepth; - public int surfaceJ; - public boolean useSubfiller; - - public SurfaceProcessingResult(int remainingDepth, int surfaceJ, boolean useSubfiller) { - this.remainingDepth = remainingDepth; - this.surfaceJ = surfaceJ; - this.useSubfiller = useSubfiller; - } - } - - protected void generateTreesForBiome(World world, Random rand, WorldConfigurationInfo generatorInfo) { - int numTrees; - - if (biome instanceof BTABiome) { - numTrees = ((BTABiome) biome).btaBiomeDecorator.treesPerChunk; - - if (rand.nextInt(((BTABiome) biome).btaBiomeDecorator.fractionalTreeChance) == 0) - numTrees++; - } - else { - numTrees = biome.theBiomeDecorator.treesPerChunk; - - if (rand.nextInt(10) == 0) - numTrees++; - } - - for (int i = 0; i < numTrees; ++i) - { - int x = this.chunkX + rand.nextInt(16) + 8; - int z = this.chunkZ + rand.nextInt(16) + 8; - - WorldGenerator gen; - - if (biome instanceof BTABiome) { - gen = ((BTABiome) this.biome).getRandomWorldGenForTrees(rand, generatorInfo, world.provider.terrainType); - } - else { - gen = this.biome.getRandomWorldGenForTrees(rand); - } - - gen.setScale(1.0D, 1.0D, 1.0D); - gen.generate(world, rand, x, world.getHeightValue(x, z), z); - } - } - - public BiomeGenBase getBiome() { - return biome; - } - - public void setBiome(BiomeGenBase biome) { - this.biome = biome; - } - - /** - * Used to set the value on an array at the index provided for the given coordinates - * Can be used to set block id or metadata depending on which array is passed to it - * @param blockArray A 1D or 3D int array to store the data - * @param i Local x value for this chunk - * @param y Absolute y value - * @param k Local z value for this chunk - * @param id Block id or metadata to set - */ - protected void setBlockValue(Object blockArray, int i, int y, int k, int id) { - if (blockArray instanceof int[]) { - ((int[]) blockArray)[(k * 16 + i) * 128 + y] = id; - } - else if (blockArray instanceof int[][][]) { - ((int[][][]) blockArray)[i][k][y] = id; - } - else { - throw new IllegalArgumentException("blockArray must be of type int[] or int[][][]"); - } - } - - /** - * Used to set the value on an array at the index provided for the given coordinates - * Can be used to set block id or metadata depending on which array is passed to it - * @param blockArray A 1D or 3D int array to store the data - * @param i Local x value for this chunk - * @param y Absolute y value - * @param k Local z value for this chunk - * @param id Block id or metadata to set - */ - protected int getBlockValue(Object blockArray, int i, int y, int k) { - if (blockArray instanceof int[]) { - return ((int[]) blockArray)[(k * 16 + i) * 128 + y]; - } - else if (blockArray instanceof int[][][]) { - return ((int[][][]) blockArray)[i][k][y]; - } - else { - throw new IllegalArgumentException("blockArray must be of type int[] or int[][][]"); - } - } - - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, boolean isReversed, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - return this.getSurfaceBlock(i, j, k, surfaceJ, soilDepth, surfaceType, seaLevel, rand, generatorInfo, worldType); - } - - /** - * Gets the block to use for the surface layer for this biome - * @param i Local x value for this chunk - * @param y Absolute y value - * @param k Local z value for this chunk - * @param isTopBlock Whether to return the top block or the filler block - * @param rand - * @param generatorInfo - * @param worldType - * @return An int array of blockID, metadata - */ - protected int[] getSurfaceBlock(int i, int j, int k, int surfaceJ, int soilDepth, SurfaceType surfaceType, int seaLevel, Random rand, WorldConfigurationInfo generatorInfo, WorldType worldType) { - int blockID = -1; - int metadata = 0; - - if (generatorInfo.generatePerlinBeaches() && - surfaceJ >= seaLevel - (8 + rand.nextInt(2)) && - surfaceJ <= seaLevel + 1) { - if (useGravelAtLocation(i, k, rand, generatorInfo)) { - switch (surfaceType) { - case TOP: - blockID = 0; - break; - case FILLER: - blockID = Block.gravel.blockID; - break; - case SUBFILLER: - blockID = Block.stone.blockID; - } - } - else if (useSandAtLocation(i, k, rand)) { - if (surfaceType == SurfaceType.SUBFILLER) { - blockID = Block.sandStone.blockID; - } - else { - blockID = Block.sand.blockID; - } - } - } - - if (soilDepth <= 0) { - if (surfaceType == SurfaceType.TOP) { - blockID = 0; - } - else { - blockID = Block.stone.blockID; - } - } - - if (blockID == -1) { - if (j < seaLevel - 1 && surfaceType == surfaceType.TOP) { - surfaceType = SurfaceType.FILLER; - } - - blockID = getDefaultSurfaceBlock(i, k, surfaceType, Block.stone.blockID); - } - - return new int[] {blockID, metadata}; - } - - protected int getDefaultSurfaceBlock(int i, int k, SurfaceType surfaceType, int baseBlock) { - if (this.biome instanceof BTABiome) { - switch (surfaceType) { - case TOP: - return ((BTABiome) this.biome).topBlockExt; - case FILLER: - return ((BTABiome) this.biome).fillerBlockExt; - case SUBFILLER: - if (((BTABiome) this.biome).topBlockExt == Block.sand.blockID) { - return Block.sandStone.blockID; - } - else if (DecoIntegration.isDecoInstalled()) { - if (((BTABiome) this.biome).topBlockExt == DecoIntegration.redSand.blockID) { - return DecoIntegration.redSandStone.blockID; - } - else { - return baseBlock; - } - } - else { - return baseBlock; - } - } - } - else { - switch (surfaceType) { - case TOP: - return this.biome.topBlock; - case FILLER: - return this.biome.fillerBlock; - case SUBFILLER: - if (this.biome.topBlock == Block.sand.blockID) { - return Block.sandStone.blockID; - } - else { - return baseBlock; - } - } - } - - return baseBlock; - } - - protected boolean useSandAtLocation(int i, int k, Random rand) { - double beachNoiseScale = 1/256D; - //k and i swapped because apparently I messed something up somewhere - return sandNoiseGenSimplex.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), beachNoiseScale) + rand.nextDouble() * 0.2D > 0; - } - - protected boolean useGravelAtLocation(int i, int k, Random rand, WorldConfigurationInfo generatorInfo) { - if (generatorInfo.getBTAVersion().isVersionAtLeast(BTAVersion.V2_0_3)) { - double beachNoiseScale = 1/384D; - //k and i swapped because apparently I messed something up somewhere - return gravelNoiseGenSimplex.noise2((this.chunkX * 16 + k), (this.chunkZ * 16 + i), beachNoiseScale) > 0.925; - } - else { - return gravelNoise[k * 16 + i] + rand.nextDouble() * 0.2D > 3.0D; - } - } - - /** - * Used for post-generation processing - * It is generally better to use getSurfaceBlock() for better performance unless behavior depends on neighboring blocks - */ - public void decorateSurface(World world, Random rand, BTABiome biome, int chunkX, int chunkZ, WorldConfigurationInfo generatorOptions) {} - - protected int getSoilDepth(int i, int k, Random rand, WorldConfigurationInfo generatorInfo) { - int depth = (int) (soilDepthNoiseLegacy[k * 16 + i] / 3.0D + 3.0D + rand.nextDouble() * 0.25D); - - if (depth < 1) { - depth = 1; - } - - return depth; - } - - public int getSnowHeightOffset(int x, int z, Random rand) { - double snowNoiseScale = 1/96D; - int snowOffset = (int) (snowHeightNoiseGenSimplex.noise2(x, z, snowNoiseScale) * 5); - return snowOffset; - } - - protected int getSubsurfaceDepth(Random rand) { - return rand.nextInt(4); - } - - public boolean hasBeenInit() { - return this.hasBeenInit; - } - - public void setHasBeenInit(boolean hasBeenInit) { - this.hasBeenInit = hasBeenInit; - } - - public enum SurfaceType { - TOP, - FILLER, - SUBFILLER - } -} \ No newline at end of file diff --git a/minecraft_server/betterterrain/world/generate/surface/SwampSurfaceBuilder.java b/minecraft_server/betterterrain/world/generate/surface/SwampSurfaceBuilder.java deleted file mode 100644 index 76d9e3a..0000000 --- a/minecraft_server/betterterrain/world/generate/surface/SwampSurfaceBuilder.java +++ /dev/null @@ -1,135 +0,0 @@ -package betterterrain.world.generate.surface; - -import java.util.Random; - -import betterterrain.DecoIntegration; -import betterterrain.biome.BTABiome; -import betterterrain.feature.plant.DecoFlowerGen; -import betterterrain.feature.plant.TallGrassGen; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.generate.noise.OpenSimplexOctaves; -import betterterrain.world.generate.surface.SurfaceBuilder.SurfaceType; -import net.minecraft.src.Block; -import net.minecraft.src.DecoDefs; -import net.minecraft.src.Material; -import net.minecraft.src.World; -import net.minecraft.src.WorldType; - -public class SwampSurfaceBuilder extends NoShorelineSurfaceBuilder { - private DecoFlowerGen orchidGen; - private TallGrassGen fernGen; - - protected OpenSimplexOctaves waterNoiseGen; - - @Override - public void init(Random rand, long seed) { - super.init(rand, seed); - - Random noiseRand = new Random(seed + 3000); - - waterNoiseGen = new OpenSimplexOctaves(rand.nextLong(), 4); - - if (DecoIntegration.isDecoInstalled()) { - orchidGen = new DecoFlowerGen(DecoIntegration.flower.blockID, 8); - } - - fernGen = new TallGrassGen(Block.tallGrass.blockID, 2); - } - - @Override - public void decorateSurface(World world, Random rand, BTABiome biome, int chunkX, int chunkZ, WorldConfigurationInfo generatorOptions) { - double waterNoiseScale = 1/96D; - - for (int i = chunkX + 8; i < chunkX + 24; i++) { - for (int k = chunkZ + 8; k < chunkZ + 24; k++) { - if (world.getBiomeGenForCoords(i, k).biomeID != this.biome.biomeID) { - continue; - } - - double waterNoise = waterNoiseGen.noise2(i, k, waterNoiseScale); - - int j = 62; - - int previousBlockID = world.getBlockId(i, j - 1, k); - int thisBlockID = world.getBlockId(i, j, k); - int nextBlockID = world.getBlockId(i, j + 1, k); - - if (nextBlockID != 0 && Block.blocksList[nextBlockID].blockMaterial.isReplaceable() && Block.blocksList[nextBlockID].blockMaterial != Material.water) { - world.setBlockToAir(i, j + 1, k); - nextBlockID = 0; - } - - if (previousBlockID != 0 && previousBlockID != Block.waterStill.blockID && - (thisBlockID == biome.topBlockExt || thisBlockID == Block.blockClay.blockID || (DecoIntegration.isDecoInstalled() && thisBlockID == DecoDefs.podzol.blockID)) && - nextBlockID == 0) - { - if (waterNoise + rand.nextDouble() > 0.375) { - int numBlockNeighbors = 8; - - for (int offsetI = -1; offsetI <= 1; offsetI++) { - for (int offsetK = -1; offsetK <= 1; offsetK++) { - if (offsetI == 0 && offsetK == 0) { - continue; - } - - int neighborID = world.getBlockId(i + offsetI, j, k + offsetK); - int neighborAboveID = world.getBlockId(i + offsetI, j + 1, k + offsetK); - - if (neighborID == 0 || neighborAboveID != 0) { - numBlockNeighbors--; - } - } - } - - if (numBlockNeighbors == 8) { - world.setBlock(i, j, k, Block.waterStill.blockID); - - for (int offset = -1; offset <= 1; offset += 2) { - int blockID = world.getBlockId(i + offset, j, k); - - if (DecoIntegration.isDecoInstalled() && world.provider.terrainType.isDeco()) { - if (blockID != 0 && Block.blocksList[blockID].blockMaterial != Material.water) { - world.setBlock(i + offset, j, k, DecoIntegration.podzol.blockID); - } - - blockID = world.getBlockId(i, j, k + offset); - - if (blockID != 0 && Block.blocksList[blockID].blockMaterial != Material.water) { - world.setBlock(i, j, k + offset, DecoIntegration.podzol.blockID); - } - } - } - } - } - - if (DecoIntegration.isDecoInstalled() && world.provider.terrainType.isDeco() && - waterNoise + rand.nextDouble() * 0.1 > -0.5 - && world.getBlockId(i, j, k) != 0 && Block.blocksList[world.getBlockId(i, j, k)].blockMaterial != Material.water - && world.getBlockId(i, j + 1, k) == 0) - { - world.setBlock(i, j, k, DecoIntegration.podzol.blockID); - } - } - } - } - - int x = chunkX + 16; - int y = world.getTopSolidOrLiquidBlock(chunkX + 16, chunkZ + 16); - int z = chunkZ + 16; - - if (y == 63) - { - for (int i = 0; i < 5; i++) { - x = chunkX + rand.nextInt(16) + 8; - z = chunkZ + rand.nextInt(16) + 8; - this.fernGen.generate(world, rand, x, y, z); - } - } - - if (DecoIntegration.isDecoInstalled() && world.provider.terrainType.isDeco() && rand.nextInt(2) == 0) { - x = chunkX + rand.nextInt(16) + 8; - z = chunkZ + rand.nextInt(16) + 8; - this.orchidGen.generate(world, rand, x, y, z); - } - } -} diff --git a/minecraft_server/betterterrain/world/type/BTADefaultWorldType.java b/minecraft_server/betterterrain/world/type/BTADefaultWorldType.java deleted file mode 100644 index d805722..0000000 --- a/minecraft_server/betterterrain/world/type/BTADefaultWorldType.java +++ /dev/null @@ -1,103 +0,0 @@ -package betterterrain.world.type; - -import betterterrain.world.BTAWorldChunkManager; -import betterterrain.world.config.WorldConfigurationInfo; -import betterterrain.world.config.WorldConfigurationInfoLegacy; -import betterterrain.world.generate.BTADefaultChunkProvider; -import betterterrain.world.generate.EndChunkProvider; -import betterterrain.world.generate.NetherChunkProvider; -import betterterrain.world.generate.SimplexChunkProvider; -import betterterrain.world.generate.SimplexChunkProviderOld; -import betterterrain.world.generate.TerrainGenerator; -import net.minecraft.src.ChunkProviderHell; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.World; -import net.minecraft.src.WorldChunkManager; -import net.minecraft.src.WorldType; - -public class BTADefaultWorldType extends WorldType { - public BTADefaultWorldType(int par1, String par2Str) { - super(par1, par2Str); - } - - /** - * Gets the translation key for the name of this world type. - */ - public String getTranslateName() - { - return "Better Terrain"; - } - - @Override - public WorldChunkManager getChunkManager(World world, String generatorOptions) { - WorldConfigurationInfo info; - - if (generatorOptions.equals("")) { - info = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(this.isDeco()); - } - else { - info = WorldConfigurationInfo.createInfoFromString(generatorOptions); - } - - return new BTAWorldChunkManager(world, info); - } - - @Override - public IChunkProvider getChunkProviderOverworld(World world, long seed, boolean mapFeaturesEnabled, String generatorOptions) { - WorldConfigurationInfo info; - - if (generatorOptions.equals("")) { - info = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(this.isDeco()); - } - else { - info = WorldConfigurationInfo.createInfoFromString(generatorOptions); - } - - switch (info.getGenerator()) { - default: - case CLASSIC: - return new BTADefaultChunkProvider(world, seed, mapFeaturesEnabled, info); - case SIMPLEX: - return new SimplexChunkProvider(world, seed, mapFeaturesEnabled, info); - } - } - - @Override - public IChunkProvider getChunkProviderNether(World world, long seed, String generatorOptions) { - WorldConfigurationInfo info; - - if (generatorOptions.equals("")) { - info = WorldConfigurationInfoLegacy.createDefaultConfigurationLegacy(this.isDeco()); - } - else { - info = WorldConfigurationInfo.createInfoFromString(generatorOptions); - } - - if (this.isDeco()) { - return new NetherChunkProvider(world, seed, info); - } - else { - return new ChunkProviderHell(world, seed); - } - } - - @Override - public IChunkProvider getChunkProviderEnd(World world, long seed) { - return new EndChunkProvider(world, seed); - } - - @Override - public boolean hasDeco() { - return true; - } - - @Override - public boolean isBTA() { - return true; - } - - @Override - public int getColdBiomeSnowLevelModifier(WorldConfigurationInfo generatorInfo) { - return generatorInfo.getGenerator().equals(TerrainGenerator.SIMPLEX) ? 70 : 0; - } -} \ No newline at end of file diff --git a/minecraft_server/com/google/gson/ExclusionStrategy.java b/minecraft_server/com/google/gson/ExclusionStrategy.java deleted file mode 100644 index bc0dc74..0000000 --- a/minecraft_server/com/google/gson/ExclusionStrategy.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -/** - * A strategy (or policy) definition that is used to decide whether or not a field or top-level - * class should be serialized or deserialized as part of the JSON output/input. For serialization, - * if the {@link #shouldSkipClass(Class)} method returns true then that class or field type - * will not be part of the JSON output. For deserialization, if {@link #shouldSkipClass(Class)} - * returns true, then it will not be set as part of the Java object structure. - * - *

The following are a few examples that shows how you can use this exclusion mechanism. - * - *

Exclude fields and objects based on a particular class type: - *

- * private static class SpecificClassExclusionStrategy implements ExclusionStrategy {
- *   private final Class<?> excludedThisClass;
- *
- *   public SpecificClassExclusionStrategy(Class<?> excludedThisClass) {
- *     this.excludedThisClass = excludedThisClass;
- *   }
- *
- *   public boolean shouldSkipClass(Class<?> clazz) {
- *     return excludedThisClass.equals(clazz);
- *   }
- *
- *   public boolean shouldSkipField(FieldAttributes f) {
- *     return excludedThisClass.equals(f.getDeclaredClass());
- *   }
- * }
- * 
- * - *

Excludes fields and objects based on a particular annotation: - *

- * public @interface FooAnnotation {
- *   // some implementation here
- * }
- *
- * // Excludes any field (or class) that is tagged with an "@FooAnnotation"
- * private static class FooAnnotationExclusionStrategy implements ExclusionStrategy {
- *   public boolean shouldSkipClass(Class<?> clazz) {
- *     return clazz.getAnnotation(FooAnnotation.class) != null;
- *   }
- *
- *   public boolean shouldSkipField(FieldAttributes f) {
- *     return f.getAnnotation(FooAnnotation.class) != null;
- *   }
- * }
- * 
- * - *

Now if you want to configure {@code Gson} to use a user defined exclusion strategy, then - * the {@code GsonBuilder} is required. The following is an example of how you can use the - * {@code GsonBuilder} to configure Gson to use one of the above sample: - *

- * ExclusionStrategy excludeStrings = new UserDefinedExclusionStrategy(String.class);
- * Gson gson = new GsonBuilder()
- *     .setExclusionStrategies(excludeStrings)
- *     .create();
- * 
- * - *

For certain model classes, you may only want to serialize a field, but exclude it for - * deserialization. To do that, you can write an {@code ExclusionStrategy} as per normal; - * however, you would register it with the - * {@link GsonBuilder#addDeserializationExclusionStrategy(ExclusionStrategy)} method. - * For example: - *

- * ExclusionStrategy excludeStrings = new UserDefinedExclusionStrategy(String.class);
- * Gson gson = new GsonBuilder()
- *     .addDeserializationExclusionStrategy(excludeStrings)
- *     .create();
- * 
- * - * @author Inderjeet Singh - * @author Joel Leitch - * - * @see GsonBuilder#setExclusionStrategies(ExclusionStrategy...) - * @see GsonBuilder#addDeserializationExclusionStrategy(ExclusionStrategy) - * @see GsonBuilder#addSerializationExclusionStrategy(ExclusionStrategy) - * - * @since 1.4 - */ -public interface ExclusionStrategy { - - /** - * @param f the field object that is under test - * @return true if the field should be ignored; otherwise false - */ - public boolean shouldSkipField(FieldAttributes f); - - /** - * @param clazz the class object that is under test - * @return true if the class should be ignored; otherwise false - */ - public boolean shouldSkipClass(Class clazz); -} diff --git a/minecraft_server/com/google/gson/FieldAttributes.java b/minecraft_server/com/google/gson/FieldAttributes.java deleted file mode 100644 index 4ee906a..0000000 --- a/minecraft_server/com/google/gson/FieldAttributes.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import com.google.gson.internal.$Gson$Preconditions; -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.lang.reflect.Type; -import java.util.Arrays; -import java.util.Collection; - -/** - * A data object that stores attributes of a field. - * - *

This class is immutable; therefore, it can be safely shared across threads. - * - * @author Inderjeet Singh - * @author Joel Leitch - * - * @since 1.4 - */ -public final class FieldAttributes { - private final Field field; - - /** - * Constructs a Field Attributes object from the {@code f}. - * - * @param f the field to pull attributes from - */ - public FieldAttributes(Field f) { - $Gson$Preconditions.checkNotNull(f); - this.field = f; - } - - /** - * @return the declaring class that contains this field - */ - public Class getDeclaringClass() { - return field.getDeclaringClass(); - } - - /** - * @return the name of the field - */ - public String getName() { - return field.getName(); - } - - /** - *

For example, assume the following class definition: - *

-   * public class Foo {
-   *   private String bar;
-   *   private List<String> red;
-   * }
-   *
-   * Type listParameterizedType = new TypeToken<List<String>>() {}.getType();
-   * 
- * - *

This method would return {@code String.class} for the {@code bar} field and - * {@code listParameterizedType} for the {@code red} field. - * - * @return the specific type declared for this field - */ - public Type getDeclaredType() { - return field.getGenericType(); - } - - /** - * Returns the {@code Class} object that was declared for this field. - * - *

For example, assume the following class definition: - *

-   * public class Foo {
-   *   private String bar;
-   *   private List<String> red;
-   * }
-   * 
- * - *

This method would return {@code String.class} for the {@code bar} field and - * {@code List.class} for the {@code red} field. - * - * @return the specific class object that was declared for the field - */ - public Class getDeclaredClass() { - return field.getType(); - } - - /** - * Return the {@code T} annotation object from this field if it exist; otherwise returns - * {@code null}. - * - * @param annotation the class of the annotation that will be retrieved - * @return the annotation instance if it is bound to the field; otherwise {@code null} - */ - public T getAnnotation(Class annotation) { - return field.getAnnotation(annotation); - } - - /** - * Return the annotations that are present on this field. - * - * @return an array of all the annotations set on the field - * @since 1.4 - */ - public Collection getAnnotations() { - return Arrays.asList(field.getAnnotations()); - } - - /** - * Returns {@code true} if the field is defined with the {@code modifier}. - * - *

This method is meant to be called as: - *

-   * boolean hasPublicModifier = fieldAttribute.hasModifier(java.lang.reflect.Modifier.PUBLIC);
-   * 
- * - * @see java.lang.reflect.Modifier - */ - public boolean hasModifier(int modifier) { - return (field.getModifiers() & modifier) != 0; - } - - /** - * Returns the value of the field represented by this {@code Field}, on - * the specified object. The value is automatically wrapped in an - * object if it has a primitive type. - * - * @return the value of the represented field in object - * {@code obj}; primitive values are wrapped in an appropriate - * object before being returned - * @throws IllegalAccessException - * @throws IllegalArgumentException - */ - Object get(Object instance) throws IllegalAccessException { - return field.get(instance); - } - - /** - * This is exposed internally only for the removing synthetic fields from the JSON output. - * - * @return true if the field is synthetic; otherwise false - */ - boolean isSynthetic() { - return field.isSynthetic(); - } -} diff --git a/minecraft_server/com/google/gson/FieldNamingPolicy.java b/minecraft_server/com/google/gson/FieldNamingPolicy.java deleted file mode 100644 index ddb9a93..0000000 --- a/minecraft_server/com/google/gson/FieldNamingPolicy.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.lang.reflect.Field; -import java.util.Locale; - -/** - * An enumeration that defines a few standard naming conventions for JSON field names. - * This enumeration should be used in conjunction with {@link com.google.gson.GsonBuilder} - * to configure a {@link com.google.gson.Gson} instance to properly translate Java field - * names into the desired JSON field names. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public enum FieldNamingPolicy implements FieldNamingStrategy { - - /** - * Using this naming policy with Gson will ensure that the field name is - * unchanged. - */ - IDENTITY() { - @Override public String translateName(Field f) { - return f.getName(); - } - }, - - /** - * Using this naming policy with Gson will ensure that the first "letter" of the Java - * field name is capitalized when serialized to its JSON form. - * - *

Here's a few examples of the form "Java Field Name" ---> "JSON Field Name":

- *
    - *
  • someFieldName ---> SomeFieldName
  • - *
  • _someFieldName ---> _SomeFieldName
  • - *
- */ - UPPER_CAMEL_CASE() { - @Override public String translateName(Field f) { - return upperCaseFirstLetter(f.getName()); - } - }, - - /** - * Using this naming policy with Gson will ensure that the first "letter" of the Java - * field name is capitalized when serialized to its JSON form and the words will be - * separated by a space. - * - *

Here's a few examples of the form "Java Field Name" ---> "JSON Field Name":

- *
    - *
  • someFieldName ---> Some Field Name
  • - *
  • _someFieldName ---> _Some Field Name
  • - *
- * - * @since 1.4 - */ - UPPER_CAMEL_CASE_WITH_SPACES() { - @Override public String translateName(Field f) { - return upperCaseFirstLetter(separateCamelCase(f.getName(), " ")); - } - }, - - /** - * Using this naming policy with Gson will modify the Java Field name from its camel cased - * form to a lower case field name where each word is separated by an underscore (_). - * - *

Here's a few examples of the form "Java Field Name" ---> "JSON Field Name":

- *
    - *
  • someFieldName ---> some_field_name
  • - *
  • _someFieldName ---> _some_field_name
  • - *
  • aStringField ---> a_string_field
  • - *
  • aURL ---> a_u_r_l
  • - *
- */ - LOWER_CASE_WITH_UNDERSCORES() { - @Override public String translateName(Field f) { - return separateCamelCase(f.getName(), "_").toLowerCase(Locale.ENGLISH); - } - }, - - /** - * Using this naming policy with Gson will modify the Java Field name from its camel cased - * form to a lower case field name where each word is separated by a dash (-). - * - *

Here's a few examples of the form "Java Field Name" ---> "JSON Field Name":

- *
    - *
  • someFieldName ---> some-field-name
  • - *
  • _someFieldName ---> _some-field-name
  • - *
  • aStringField ---> a-string-field
  • - *
  • aURL ---> a-u-r-l
  • - *
- * Using dashes in JavaScript is not recommended since dash is also used for a minus sign in - * expressions. This requires that a field named with dashes is always accessed as a quoted - * property like {@code myobject['my-field']}. Accessing it as an object field - * {@code myobject.my-field} will result in an unintended javascript expression. - * @since 1.4 - */ - LOWER_CASE_WITH_DASHES() { - @Override public String translateName(Field f) { - return separateCamelCase(f.getName(), "-").toLowerCase(Locale.ENGLISH); - } - }, - - /** - * Using this naming policy with Gson will modify the Java Field name from its camel cased - * form to a lower case field name where each word is separated by a dot (.). - * - *

Here's a few examples of the form "Java Field Name" ---> "JSON Field Name":

- *
    - *
  • someFieldName ---> some.field.name
  • - *
  • _someFieldName ---> _some.field.name
  • - *
  • aStringField ---> a.string.field
  • - *
  • aURL ---> a.u.r.l
  • - *
- * Using dots in JavaScript is not recommended since dot is also used for a member sign in - * expressions. This requires that a field named with dots is always accessed as a quoted - * property like {@code myobject['my.field']}. Accessing it as an object field - * {@code myobject.my.field} will result in an unintended javascript expression. - * @since 2.8 - */ - LOWER_CASE_WITH_DOTS() { - @Override public String translateName(Field f) { - return separateCamelCase(f.getName(), ".").toLowerCase(Locale.ENGLISH); - } - }; - - /** - * Converts the field name that uses camel-case define word separation into - * separate words that are separated by the provided {@code separatorString}. - */ - static String separateCamelCase(String name, String separator) { - StringBuilder translation = new StringBuilder(); - for (int i = 0, length = name.length(); i < length; i++) { - char character = name.charAt(i); - if (Character.isUpperCase(character) && translation.length() != 0) { - translation.append(separator); - } - translation.append(character); - } - return translation.toString(); - } - - /** - * Ensures the JSON field names begins with an upper case letter. - */ - static String upperCaseFirstLetter(String name) { - int firstLetterIndex = 0; - int limit = name.length() - 1; - for(; !Character.isLetter(name.charAt(firstLetterIndex)) && firstLetterIndex < limit; ++firstLetterIndex); - - char firstLetter = name.charAt(firstLetterIndex); - if(Character.isUpperCase(firstLetter)) { //The letter is already uppercased, return the original - return name; - } - - char uppercased = Character.toUpperCase(firstLetter); - if(firstLetterIndex == 0) { //First character in the string is the first letter, saves 1 substring - return uppercased + name.substring(1); - } - - return name.substring(0, firstLetterIndex) + uppercased + name.substring(firstLetterIndex + 1); - } -} diff --git a/minecraft_server/com/google/gson/FieldNamingStrategy.java b/minecraft_server/com/google/gson/FieldNamingStrategy.java deleted file mode 100644 index f2f7c48..0000000 --- a/minecraft_server/com/google/gson/FieldNamingStrategy.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.lang.reflect.Field; - -/** - * A mechanism for providing custom field naming in Gson. This allows the client code to translate - * field names into a particular convention that is not supported as a normal Java field - * declaration rules. For example, Java does not support "-" characters in a field name. - * - * @author Inderjeet Singh - * @author Joel Leitch - * @since 1.3 - */ -public interface FieldNamingStrategy { - - /** - * Translates the field name into its JSON field name representation. - * - * @param f the field object that we are translating - * @return the translated field name. - * @since 1.3 - */ - public String translateName(Field f); -} diff --git a/minecraft_server/com/google/gson/Gson.java b/minecraft_server/com/google/gson/Gson.java deleted file mode 100644 index d2bd087..0000000 --- a/minecraft_server/com/google/gson/Gson.java +++ /dev/null @@ -1,1070 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.io.EOFException; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; -import java.lang.reflect.Type; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.text.DateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicLongArray; - -import com.google.gson.internal.ConstructorConstructor; -import com.google.gson.internal.Excluder; -import com.google.gson.internal.Primitives; -import com.google.gson.internal.Streams; -import com.google.gson.internal.bind.ArrayTypeAdapter; -import com.google.gson.internal.bind.CollectionTypeAdapterFactory; -import com.google.gson.internal.bind.DateTypeAdapter; -import com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory; -import com.google.gson.internal.bind.JsonTreeReader; -import com.google.gson.internal.bind.JsonTreeWriter; -import com.google.gson.internal.bind.MapTypeAdapterFactory; -import com.google.gson.internal.bind.NumberTypeAdapter; -import com.google.gson.internal.bind.ObjectTypeAdapter; -import com.google.gson.internal.bind.ReflectiveTypeAdapterFactory; -import com.google.gson.internal.bind.TypeAdapters; -import com.google.gson.internal.sql.SqlTypesSupport; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import com.google.gson.stream.MalformedJsonException; - -/** - * This is the main class for using Gson. Gson is typically used by first constructing a - * Gson instance and then invoking {@link #toJson(Object)} or {@link #fromJson(String, Class)} - * methods on it. Gson instances are Thread-safe so you can reuse them freely across multiple - * threads. - * - *

You can create a Gson instance by invoking {@code new Gson()} if the default configuration - * is all you need. You can also use {@link GsonBuilder} to build a Gson instance with various - * configuration options such as versioning support, pretty printing, custom - * {@link JsonSerializer}s, {@link JsonDeserializer}s, and {@link InstanceCreator}s.

- * - *

Here is an example of how Gson is used for a simple Class: - * - *

- * Gson gson = new Gson(); // Or use new GsonBuilder().create();
- * MyType target = new MyType();
- * String json = gson.toJson(target); // serializes target to Json
- * MyType target2 = gson.fromJson(json, MyType.class); // deserializes json into target2
- * 

- * - *

If the object that your are serializing/deserializing is a {@code ParameterizedType} - * (i.e. contains at least one type parameter and may be an array) then you must use the - * {@link #toJson(Object, Type)} or {@link #fromJson(String, Type)} method. Here is an - * example for serializing and deserializing a {@code ParameterizedType}: - * - *

- * Type listType = new TypeToken<List<String>>() {}.getType();
- * List<String> target = new LinkedList<String>();
- * target.add("blah");
- *
- * Gson gson = new Gson();
- * String json = gson.toJson(target, listType);
- * List<String> target2 = gson.fromJson(json, listType);
- * 

- * - *

See the Gson User Guide - * for a more complete set of examples.

- * - * @see com.google.gson.reflect.TypeToken - * - * @author Inderjeet Singh - * @author Joel Leitch - * @author Jesse Wilson - */ -public final class Gson { - static final boolean DEFAULT_JSON_NON_EXECUTABLE = false; - static final boolean DEFAULT_LENIENT = false; - static final boolean DEFAULT_PRETTY_PRINT = false; - static final boolean DEFAULT_ESCAPE_HTML = true; - static final boolean DEFAULT_SERIALIZE_NULLS = false; - static final boolean DEFAULT_COMPLEX_MAP_KEYS = false; - static final boolean DEFAULT_SPECIALIZE_FLOAT_VALUES = false; - - private static final TypeToken NULL_KEY_SURROGATE = TypeToken.get(Object.class); - private static final String JSON_NON_EXECUTABLE_PREFIX = ")]}'\n"; - - /** - * This thread local guards against reentrant calls to getAdapter(). In - * certain object graphs, creating an adapter for a type may recursively - * require an adapter for the same type! Without intervention, the recursive - * lookup would stack overflow. We cheat by returning a proxy type adapter. - * The proxy is wired up once the initial adapter has been created. - */ - private final ThreadLocal, FutureTypeAdapter>> calls - = new ThreadLocal, FutureTypeAdapter>>(); - - private final Map, TypeAdapter> typeTokenCache = new ConcurrentHashMap, TypeAdapter>(); - - private final ConstructorConstructor constructorConstructor; - private final JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory; - - final List factories; - - final Excluder excluder; - final FieldNamingStrategy fieldNamingStrategy; - final Map> instanceCreators; - final boolean serializeNulls; - final boolean complexMapKeySerialization; - final boolean generateNonExecutableJson; - final boolean htmlSafe; - final boolean prettyPrinting; - final boolean lenient; - final boolean serializeSpecialFloatingPointValues; - final String datePattern; - final int dateStyle; - final int timeStyle; - final LongSerializationPolicy longSerializationPolicy; - final List builderFactories; - final List builderHierarchyFactories; - final ToNumberStrategy objectToNumberStrategy; - final ToNumberStrategy numberToNumberStrategy; - - /** - * Constructs a Gson object with default configuration. The default configuration has the - * following settings: - *
    - *
  • The JSON generated by toJson methods is in compact representation. This - * means that all the unneeded white-space is removed. You can change this behavior with - * {@link GsonBuilder#setPrettyPrinting()}.
  • - *
  • The generated JSON omits all the fields that are null. Note that nulls in arrays are - * kept as is since an array is an ordered list. Moreover, if a field is not null, but its - * generated JSON is empty, the field is kept. You can configure Gson to serialize null values - * by setting {@link GsonBuilder#serializeNulls()}.
  • - *
  • Gson provides default serialization and deserialization for Enums, {@link Map}, - * {@link java.net.URL}, {@link java.net.URI}, {@link java.util.Locale}, {@link java.util.Date}, - * {@link java.math.BigDecimal}, and {@link java.math.BigInteger} classes. If you would prefer - * to change the default representation, you can do so by registering a type adapter through - * {@link GsonBuilder#registerTypeAdapter(Type, Object)}.
  • - *
  • The default Date format is same as {@link java.text.DateFormat#DEFAULT}. This format - * ignores the millisecond portion of the date during serialization. You can change - * this by invoking {@link GsonBuilder#setDateFormat(int)} or - * {@link GsonBuilder#setDateFormat(String)}.
  • - *
  • By default, Gson ignores the {@link com.google.gson.annotations.Expose} annotation. - * You can enable Gson to serialize/deserialize only those fields marked with this annotation - * through {@link GsonBuilder#excludeFieldsWithoutExposeAnnotation()}.
  • - *
  • By default, Gson ignores the {@link com.google.gson.annotations.Since} annotation. You - * can enable Gson to use this annotation through {@link GsonBuilder#setVersion(double)}.
  • - *
  • The default field naming policy for the output Json is same as in Java. So, a Java class - * field versionNumber will be output as "versionNumber" in - * Json. The same rules are applied for mapping incoming Json to the Java classes. You can - * change this policy through {@link GsonBuilder#setFieldNamingPolicy(FieldNamingPolicy)}.
  • - *
  • By default, Gson excludes transient or static fields from - * consideration for serialization and deserialization. You can change this behavior through - * {@link GsonBuilder#excludeFieldsWithModifiers(int...)}.
  • - *
- */ - public Gson() { - this(Excluder.DEFAULT, FieldNamingPolicy.IDENTITY, - Collections.>emptyMap(), DEFAULT_SERIALIZE_NULLS, - DEFAULT_COMPLEX_MAP_KEYS, DEFAULT_JSON_NON_EXECUTABLE, DEFAULT_ESCAPE_HTML, - DEFAULT_PRETTY_PRINT, DEFAULT_LENIENT, DEFAULT_SPECIALIZE_FLOAT_VALUES, - LongSerializationPolicy.DEFAULT, null, DateFormat.DEFAULT, DateFormat.DEFAULT, - Collections.emptyList(), Collections.emptyList(), - Collections.emptyList(), ToNumberPolicy.DOUBLE, ToNumberPolicy.LAZILY_PARSED_NUMBER); - } - - Gson(Excluder excluder, FieldNamingStrategy fieldNamingStrategy, - Map> instanceCreators, boolean serializeNulls, - boolean complexMapKeySerialization, boolean generateNonExecutableGson, boolean htmlSafe, - boolean prettyPrinting, boolean lenient, boolean serializeSpecialFloatingPointValues, - LongSerializationPolicy longSerializationPolicy, String datePattern, int dateStyle, - int timeStyle, List builderFactories, - List builderHierarchyFactories, - List factoriesToBeAdded, - ToNumberStrategy objectToNumberStrategy, ToNumberStrategy numberToNumberStrategy) { - this.excluder = excluder; - this.fieldNamingStrategy = fieldNamingStrategy; - this.instanceCreators = instanceCreators; - this.constructorConstructor = new ConstructorConstructor(instanceCreators); - this.serializeNulls = serializeNulls; - this.complexMapKeySerialization = complexMapKeySerialization; - this.generateNonExecutableJson = generateNonExecutableGson; - this.htmlSafe = htmlSafe; - this.prettyPrinting = prettyPrinting; - this.lenient = lenient; - this.serializeSpecialFloatingPointValues = serializeSpecialFloatingPointValues; - this.longSerializationPolicy = longSerializationPolicy; - this.datePattern = datePattern; - this.dateStyle = dateStyle; - this.timeStyle = timeStyle; - this.builderFactories = builderFactories; - this.builderHierarchyFactories = builderHierarchyFactories; - this.objectToNumberStrategy = objectToNumberStrategy; - this.numberToNumberStrategy = numberToNumberStrategy; - - List factories = new ArrayList(); - - // built-in type adapters that cannot be overridden - factories.add(TypeAdapters.JSON_ELEMENT_FACTORY); - factories.add(ObjectTypeAdapter.getFactory(objectToNumberStrategy)); - - // the excluder must precede all adapters that handle user-defined types - factories.add(excluder); - - // users' type adapters - factories.addAll(factoriesToBeAdded); - - // type adapters for basic platform types - factories.add(TypeAdapters.STRING_FACTORY); - factories.add(TypeAdapters.INTEGER_FACTORY); - factories.add(TypeAdapters.BOOLEAN_FACTORY); - factories.add(TypeAdapters.BYTE_FACTORY); - factories.add(TypeAdapters.SHORT_FACTORY); - TypeAdapter longAdapter = longAdapter(longSerializationPolicy); - factories.add(TypeAdapters.newFactory(long.class, Long.class, longAdapter)); - factories.add(TypeAdapters.newFactory(double.class, Double.class, - doubleAdapter(serializeSpecialFloatingPointValues))); - factories.add(TypeAdapters.newFactory(float.class, Float.class, - floatAdapter(serializeSpecialFloatingPointValues))); - factories.add(NumberTypeAdapter.getFactory(numberToNumberStrategy)); - factories.add(TypeAdapters.ATOMIC_INTEGER_FACTORY); - factories.add(TypeAdapters.ATOMIC_BOOLEAN_FACTORY); - factories.add(TypeAdapters.newFactory(AtomicLong.class, atomicLongAdapter(longAdapter))); - factories.add(TypeAdapters.newFactory(AtomicLongArray.class, atomicLongArrayAdapter(longAdapter))); - factories.add(TypeAdapters.ATOMIC_INTEGER_ARRAY_FACTORY); - factories.add(TypeAdapters.CHARACTER_FACTORY); - factories.add(TypeAdapters.STRING_BUILDER_FACTORY); - factories.add(TypeAdapters.STRING_BUFFER_FACTORY); - factories.add(TypeAdapters.newFactory(BigDecimal.class, TypeAdapters.BIG_DECIMAL)); - factories.add(TypeAdapters.newFactory(BigInteger.class, TypeAdapters.BIG_INTEGER)); - factories.add(TypeAdapters.URL_FACTORY); - factories.add(TypeAdapters.URI_FACTORY); - factories.add(TypeAdapters.UUID_FACTORY); - factories.add(TypeAdapters.CURRENCY_FACTORY); - factories.add(TypeAdapters.LOCALE_FACTORY); - factories.add(TypeAdapters.INET_ADDRESS_FACTORY); - factories.add(TypeAdapters.BIT_SET_FACTORY); - factories.add(DateTypeAdapter.FACTORY); - factories.add(TypeAdapters.CALENDAR_FACTORY); - - if (SqlTypesSupport.SUPPORTS_SQL_TYPES) { - factories.add(SqlTypesSupport.TIME_FACTORY); - factories.add(SqlTypesSupport.DATE_FACTORY); - factories.add(SqlTypesSupport.TIMESTAMP_FACTORY); - } - - factories.add(ArrayTypeAdapter.FACTORY); - factories.add(TypeAdapters.CLASS_FACTORY); - - // type adapters for composite and user-defined types - factories.add(new CollectionTypeAdapterFactory(constructorConstructor)); - factories.add(new MapTypeAdapterFactory(constructorConstructor, complexMapKeySerialization)); - this.jsonAdapterFactory = new JsonAdapterAnnotationTypeAdapterFactory(constructorConstructor); - factories.add(jsonAdapterFactory); - factories.add(TypeAdapters.ENUM_FACTORY); - factories.add(new ReflectiveTypeAdapterFactory( - constructorConstructor, fieldNamingStrategy, excluder, jsonAdapterFactory)); - - this.factories = Collections.unmodifiableList(factories); - } - - /** - * Returns a new GsonBuilder containing all custom factories and configuration used by the current - * instance. - * - * @return a GsonBuilder instance. - */ - public GsonBuilder newBuilder() { - return new GsonBuilder(this); - } - - /** - * @deprecated This method by accident exposes an internal Gson class; it might be removed in a - * future version. - */ - @Deprecated - public Excluder excluder() { - return excluder; - } - - /** - * Returns the field naming strategy used by this Gson instance. - * - * @see GsonBuilder#setFieldNamingStrategy(FieldNamingStrategy) - */ - public FieldNamingStrategy fieldNamingStrategy() { - return fieldNamingStrategy; - } - - /** - * Returns whether this Gson instance is serializing JSON object properties with - * {@code null} values, or just omits them. - * - * @see GsonBuilder#serializeNulls() - */ - public boolean serializeNulls() { - return serializeNulls; - } - - /** - * Returns whether this Gson instance produces JSON output which is - * HTML-safe, that means all HTML characters are escaped. - * - * @see GsonBuilder#disableHtmlEscaping() - */ - public boolean htmlSafe() { - return htmlSafe; - } - - private TypeAdapter doubleAdapter(boolean serializeSpecialFloatingPointValues) { - if (serializeSpecialFloatingPointValues) { - return TypeAdapters.DOUBLE; - } - return new TypeAdapter() { - @Override public Double read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return in.nextDouble(); - } - @Override public void write(JsonWriter out, Number value) throws IOException { - if (value == null) { - out.nullValue(); - return; - } - double doubleValue = value.doubleValue(); - checkValidFloatingPoint(doubleValue); - out.value(value); - } - }; - } - - private TypeAdapter floatAdapter(boolean serializeSpecialFloatingPointValues) { - if (serializeSpecialFloatingPointValues) { - return TypeAdapters.FLOAT; - } - return new TypeAdapter() { - @Override public Float read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return (float) in.nextDouble(); - } - @Override public void write(JsonWriter out, Number value) throws IOException { - if (value == null) { - out.nullValue(); - return; - } - float floatValue = value.floatValue(); - checkValidFloatingPoint(floatValue); - out.value(value); - } - }; - } - - static void checkValidFloatingPoint(double value) { - if (Double.isNaN(value) || Double.isInfinite(value)) { - throw new IllegalArgumentException(value - + " is not a valid double value as per JSON specification. To override this" - + " behavior, use GsonBuilder.serializeSpecialFloatingPointValues() method."); - } - } - - private static TypeAdapter longAdapter(LongSerializationPolicy longSerializationPolicy) { - if (longSerializationPolicy == LongSerializationPolicy.DEFAULT) { - return TypeAdapters.LONG; - } - return new TypeAdapter() { - @Override public Number read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return in.nextLong(); - } - @Override public void write(JsonWriter out, Number value) throws IOException { - if (value == null) { - out.nullValue(); - return; - } - out.value(value.toString()); - } - }; - } - - private static TypeAdapter atomicLongAdapter(final TypeAdapter longAdapter) { - return new TypeAdapter() { - @Override public void write(JsonWriter out, AtomicLong value) throws IOException { - longAdapter.write(out, value.get()); - } - @Override public AtomicLong read(JsonReader in) throws IOException { - Number value = longAdapter.read(in); - return new AtomicLong(value.longValue()); - } - }.nullSafe(); - } - - private static TypeAdapter atomicLongArrayAdapter(final TypeAdapter longAdapter) { - return new TypeAdapter() { - @Override public void write(JsonWriter out, AtomicLongArray value) throws IOException { - out.beginArray(); - for (int i = 0, length = value.length(); i < length; i++) { - longAdapter.write(out, value.get(i)); - } - out.endArray(); - } - @Override public AtomicLongArray read(JsonReader in) throws IOException { - List list = new ArrayList(); - in.beginArray(); - while (in.hasNext()) { - long value = longAdapter.read(in).longValue(); - list.add(value); - } - in.endArray(); - int length = list.size(); - AtomicLongArray array = new AtomicLongArray(length); - for (int i = 0; i < length; ++i) { - array.set(i, list.get(i)); - } - return array; - } - }.nullSafe(); - } - - /** - * Returns the type adapter for {@code} type. - * - * @throws IllegalArgumentException if this GSON cannot serialize and - * deserialize {@code type}. - */ - @SuppressWarnings("unchecked") - public TypeAdapter getAdapter(TypeToken type) { - TypeAdapter cached = typeTokenCache.get(type == null ? NULL_KEY_SURROGATE : type); - if (cached != null) { - return (TypeAdapter) cached; - } - - Map, FutureTypeAdapter> threadCalls = calls.get(); - boolean requiresThreadLocalCleanup = false; - if (threadCalls == null) { - threadCalls = new HashMap, FutureTypeAdapter>(); - calls.set(threadCalls); - requiresThreadLocalCleanup = true; - } - - // the key and value type parameters always agree - FutureTypeAdapter ongoingCall = (FutureTypeAdapter) threadCalls.get(type); - if (ongoingCall != null) { - return ongoingCall; - } - - try { - FutureTypeAdapter call = new FutureTypeAdapter(); - threadCalls.put(type, call); - - for (TypeAdapterFactory factory : factories) { - TypeAdapter candidate = factory.create(this, type); - if (candidate != null) { - call.setDelegate(candidate); - typeTokenCache.put(type, candidate); - return candidate; - } - } - throw new IllegalArgumentException("GSON cannot handle " + type); - } finally { - threadCalls.remove(type); - - if (requiresThreadLocalCleanup) { - calls.remove(); - } - } - } - - /** - * This method is used to get an alternate type adapter for the specified type. This is used - * to access a type adapter that is overridden by a {@link TypeAdapterFactory} that you - * may have registered. This features is typically used when you want to register a type - * adapter that does a little bit of work but then delegates further processing to the Gson - * default type adapter. Here is an example: - *

Let's say we want to write a type adapter that counts the number of objects being read - * from or written to JSON. We can achieve this by writing a type adapter factory that uses - * the getDelegateAdapter method: - *

 {@code
-   *  class StatsTypeAdapterFactory implements TypeAdapterFactory {
-   *    public int numReads = 0;
-   *    public int numWrites = 0;
-   *    public  TypeAdapter create(Gson gson, TypeToken type) {
-   *      final TypeAdapter delegate = gson.getDelegateAdapter(this, type);
-   *      return new TypeAdapter() {
-   *        public void write(JsonWriter out, T value) throws IOException {
-   *          ++numWrites;
-   *          delegate.write(out, value);
-   *        }
-   *        public T read(JsonReader in) throws IOException {
-   *          ++numReads;
-   *          return delegate.read(in);
-   *        }
-   *      };
-   *    }
-   *  }
-   *  } 
- * This factory can now be used like this: - *
 {@code
-   *  StatsTypeAdapterFactory stats = new StatsTypeAdapterFactory();
-   *  Gson gson = new GsonBuilder().registerTypeAdapterFactory(stats).create();
-   *  // Call gson.toJson() and fromJson methods on objects
-   *  System.out.println("Num JSON reads" + stats.numReads);
-   *  System.out.println("Num JSON writes" + stats.numWrites);
-   *  }
- * Note that this call will skip all factories registered before {@code skipPast}. In case of - * multiple TypeAdapterFactories registered it is up to the caller of this function to insure - * that the order of registration does not prevent this method from reaching a factory they - * would expect to reply from this call. - * Note that since you can not override type adapter factories for String and Java primitive - * types, our stats factory will not count the number of String or primitives that will be - * read or written. - * @param skipPast The type adapter factory that needs to be skipped while searching for - * a matching type adapter. In most cases, you should just pass this (the type adapter - * factory from where {@link #getDelegateAdapter} method is being invoked). - * @param type Type for which the delegate adapter is being searched for. - * - * @since 2.2 - */ - public TypeAdapter getDelegateAdapter(TypeAdapterFactory skipPast, TypeToken type) { - // Hack. If the skipPast factory isn't registered, assume the factory is being requested via - // our @JsonAdapter annotation. - if (!factories.contains(skipPast)) { - skipPast = jsonAdapterFactory; - } - - boolean skipPastFound = false; - for (TypeAdapterFactory factory : factories) { - if (!skipPastFound) { - if (factory == skipPast) { - skipPastFound = true; - } - continue; - } - - TypeAdapter candidate = factory.create(this, type); - if (candidate != null) { - return candidate; - } - } - throw new IllegalArgumentException("GSON cannot serialize " + type); - } - - /** - * Returns the type adapter for {@code} type. - * - * @throws IllegalArgumentException if this GSON cannot serialize and - * deserialize {@code type}. - */ - public TypeAdapter getAdapter(Class type) { - return getAdapter(TypeToken.get(type)); - } - - /** - * This method serializes the specified object into its equivalent representation as a tree of - * {@link JsonElement}s. This method should be used when the specified object is not a generic - * type. This method uses {@link Class#getClass()} to get the type for the specified object, but - * the {@code getClass()} loses the generic type information because of the Type Erasure feature - * of Java. Note that this method works fine if the any of the object fields are of generic type, - * just the object itself should not be of a generic type. If the object is of generic type, use - * {@link #toJsonTree(Object, Type)} instead. - * - * @param src the object for which Json representation is to be created setting for Gson - * @return Json representation of {@code src}. - * @since 1.4 - */ - public JsonElement toJsonTree(Object src) { - if (src == null) { - return JsonNull.INSTANCE; - } - return toJsonTree(src, src.getClass()); - } - - /** - * This method serializes the specified object, including those of generic types, into its - * equivalent representation as a tree of {@link JsonElement}s. This method must be used if the - * specified object is a generic type. For non-generic objects, use {@link #toJsonTree(Object)} - * instead. - * - * @param src the object for which JSON representation is to be created - * @param typeOfSrc The specific genericized type of src. You can obtain - * this type by using the {@link com.google.gson.reflect.TypeToken} class. For example, - * to get the type for {@code Collection}, you should use: - *
-   * Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
-   * 
- * @return Json representation of {@code src} - * @since 1.4 - */ - public JsonElement toJsonTree(Object src, Type typeOfSrc) { - JsonTreeWriter writer = new JsonTreeWriter(); - toJson(src, typeOfSrc, writer); - return writer.get(); - } - - /** - * This method serializes the specified object into its equivalent Json representation. - * This method should be used when the specified object is not a generic type. This method uses - * {@link Class#getClass()} to get the type for the specified object, but the - * {@code getClass()} loses the generic type information because of the Type Erasure feature - * of Java. Note that this method works fine if the any of the object fields are of generic type, - * just the object itself should not be of a generic type. If the object is of generic type, use - * {@link #toJson(Object, Type)} instead. If you want to write out the object to a - * {@link Writer}, use {@link #toJson(Object, Appendable)} instead. - * - * @param src the object for which Json representation is to be created setting for Gson - * @return Json representation of {@code src}. - */ - public String toJson(Object src) { - if (src == null) { - return toJson(JsonNull.INSTANCE); - } - return toJson(src, src.getClass()); - } - - /** - * This method serializes the specified object, including those of generic types, into its - * equivalent Json representation. This method must be used if the specified object is a generic - * type. For non-generic objects, use {@link #toJson(Object)} instead. If you want to write out - * the object to a {@link Appendable}, use {@link #toJson(Object, Type, Appendable)} instead. - * - * @param src the object for which JSON representation is to be created - * @param typeOfSrc The specific genericized type of src. You can obtain - * this type by using the {@link com.google.gson.reflect.TypeToken} class. For example, - * to get the type for {@code Collection}, you should use: - *
-   * Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
-   * 
- * @return Json representation of {@code src} - */ - public String toJson(Object src, Type typeOfSrc) { - StringWriter writer = new StringWriter(); - toJson(src, typeOfSrc, writer); - return writer.toString(); - } - - /** - * This method serializes the specified object into its equivalent Json representation. - * This method should be used when the specified object is not a generic type. This method uses - * {@link Class#getClass()} to get the type for the specified object, but the - * {@code getClass()} loses the generic type information because of the Type Erasure feature - * of Java. Note that this method works fine if the any of the object fields are of generic type, - * just the object itself should not be of a generic type. If the object is of generic type, use - * {@link #toJson(Object, Type, Appendable)} instead. - * - * @param src the object for which Json representation is to be created setting for Gson - * @param writer Writer to which the Json representation needs to be written - * @throws JsonIOException if there was a problem writing to the writer - * @since 1.2 - */ - public void toJson(Object src, Appendable writer) throws JsonIOException { - if (src != null) { - toJson(src, src.getClass(), writer); - } else { - toJson(JsonNull.INSTANCE, writer); - } - } - - /** - * This method serializes the specified object, including those of generic types, into its - * equivalent Json representation. This method must be used if the specified object is a generic - * type. For non-generic objects, use {@link #toJson(Object, Appendable)} instead. - * - * @param src the object for which JSON representation is to be created - * @param typeOfSrc The specific genericized type of src. You can obtain - * this type by using the {@link com.google.gson.reflect.TypeToken} class. For example, - * to get the type for {@code Collection}, you should use: - *
-   * Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
-   * 
- * @param writer Writer to which the Json representation of src needs to be written. - * @throws JsonIOException if there was a problem writing to the writer - * @since 1.2 - */ - public void toJson(Object src, Type typeOfSrc, Appendable writer) throws JsonIOException { - try { - JsonWriter jsonWriter = newJsonWriter(Streams.writerForAppendable(writer)); - toJson(src, typeOfSrc, jsonWriter); - } catch (IOException e) { - throw new JsonIOException(e); - } - } - - /** - * Writes the JSON representation of {@code src} of type {@code typeOfSrc} to - * {@code writer}. - * @throws JsonIOException if there was a problem writing to the writer - */ - @SuppressWarnings("unchecked") - public void toJson(Object src, Type typeOfSrc, JsonWriter writer) throws JsonIOException { - TypeAdapter adapter = getAdapter(TypeToken.get(typeOfSrc)); - boolean oldLenient = writer.isLenient(); - writer.setLenient(true); - boolean oldHtmlSafe = writer.isHtmlSafe(); - writer.setHtmlSafe(htmlSafe); - boolean oldSerializeNulls = writer.getSerializeNulls(); - writer.setSerializeNulls(serializeNulls); - try { - ((TypeAdapter) adapter).write(writer, src); - } catch (IOException e) { - throw new JsonIOException(e); - } catch (AssertionError e) { - AssertionError error = new AssertionError("AssertionError (GSON" + "): " + e.getMessage()); - error.initCause(e); - throw error; - } finally { - writer.setLenient(oldLenient); - writer.setHtmlSafe(oldHtmlSafe); - writer.setSerializeNulls(oldSerializeNulls); - } - } - - /** - * Converts a tree of {@link JsonElement}s into its equivalent JSON representation. - * - * @param jsonElement root of a tree of {@link JsonElement}s - * @return JSON String representation of the tree - * @since 1.4 - */ - public String toJson(JsonElement jsonElement) { - StringWriter writer = new StringWriter(); - toJson(jsonElement, writer); - return writer.toString(); - } - - /** - * Writes out the equivalent JSON for a tree of {@link JsonElement}s. - * - * @param jsonElement root of a tree of {@link JsonElement}s - * @param writer Writer to which the Json representation needs to be written - * @throws JsonIOException if there was a problem writing to the writer - * @since 1.4 - */ - public void toJson(JsonElement jsonElement, Appendable writer) throws JsonIOException { - try { - JsonWriter jsonWriter = newJsonWriter(Streams.writerForAppendable(writer)); - toJson(jsonElement, jsonWriter); - } catch (IOException e) { - throw new JsonIOException(e); - } - } - - /** - * Returns a new JSON writer configured for the settings on this Gson instance. - */ - public JsonWriter newJsonWriter(Writer writer) throws IOException { - if (generateNonExecutableJson) { - writer.write(JSON_NON_EXECUTABLE_PREFIX); - } - JsonWriter jsonWriter = new JsonWriter(writer); - if (prettyPrinting) { - jsonWriter.setIndent(" "); - } - jsonWriter.setSerializeNulls(serializeNulls); - return jsonWriter; - } - - /** - * Returns a new JSON reader configured for the settings on this Gson instance. - */ - public JsonReader newJsonReader(Reader reader) { - JsonReader jsonReader = new JsonReader(reader); - jsonReader.setLenient(lenient); - return jsonReader; - } - - /** - * Writes the JSON for {@code jsonElement} to {@code writer}. - * @throws JsonIOException if there was a problem writing to the writer - */ - public void toJson(JsonElement jsonElement, JsonWriter writer) throws JsonIOException { - boolean oldLenient = writer.isLenient(); - writer.setLenient(true); - boolean oldHtmlSafe = writer.isHtmlSafe(); - writer.setHtmlSafe(htmlSafe); - boolean oldSerializeNulls = writer.getSerializeNulls(); - writer.setSerializeNulls(serializeNulls); - try { - Streams.write(jsonElement, writer); - } catch (IOException e) { - throw new JsonIOException(e); - } catch (AssertionError e) { - AssertionError error = new AssertionError("AssertionError (GSON" + "): " + e.getMessage()); - error.initCause(e); - throw error; - } finally { - writer.setLenient(oldLenient); - writer.setHtmlSafe(oldHtmlSafe); - writer.setSerializeNulls(oldSerializeNulls); - } - } - - /** - * This method deserializes the specified Json into an object of the specified class. It is not - * suitable to use if the specified class is a generic type since it will not have the generic - * type information because of the Type Erasure feature of Java. Therefore, this method should not - * be used if the desired type is a generic type. Note that this method works fine if the any of - * the fields of the specified object are generics, just the object itself should not be a - * generic type. For the cases when the object is of generic type, invoke - * {@link #fromJson(String, Type)}. If you have the Json in a {@link Reader} instead of - * a String, use {@link #fromJson(Reader, Class)} instead. - * - * @param the type of the desired object - * @param json the string from which the object is to be deserialized - * @param classOfT the class of T - * @return an object of type T from the string. Returns {@code null} if {@code json} is {@code null} - * or if {@code json} is empty. - * @throws JsonSyntaxException if json is not a valid representation for an object of type - * classOfT - */ - public T fromJson(String json, Class classOfT) throws JsonSyntaxException { - Object object = fromJson(json, (Type) classOfT); - return Primitives.wrap(classOfT).cast(object); - } - - /** - * This method deserializes the specified Json into an object of the specified type. This method - * is useful if the specified object is a generic type. For non-generic objects, use - * {@link #fromJson(String, Class)} instead. If you have the Json in a {@link Reader} instead of - * a String, use {@link #fromJson(Reader, Type)} instead. - * - * @param the type of the desired object - * @param json the string from which the object is to be deserialized - * @param typeOfT The specific genericized type of src. You can obtain this type by using the - * {@link com.google.gson.reflect.TypeToken} class. For example, to get the type for - * {@code Collection}, you should use: - *
-   * Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
-   * 
- * @return an object of type T from the string. Returns {@code null} if {@code json} is {@code null} - * or if {@code json} is empty. - * @throws JsonParseException if json is not a valid representation for an object of type typeOfT - * @throws JsonSyntaxException if json is not a valid representation for an object of type - */ - @SuppressWarnings("unchecked") - public T fromJson(String json, Type typeOfT) throws JsonSyntaxException { - if (json == null) { - return null; - } - StringReader reader = new StringReader(json); - T target = (T) fromJson(reader, typeOfT); - return target; - } - - /** - * This method deserializes the Json read from the specified reader into an object of the - * specified class. It is not suitable to use if the specified class is a generic type since it - * will not have the generic type information because of the Type Erasure feature of Java. - * Therefore, this method should not be used if the desired type is a generic type. Note that - * this method works fine if the any of the fields of the specified object are generics, just the - * object itself should not be a generic type. For the cases when the object is of generic type, - * invoke {@link #fromJson(Reader, Type)}. If you have the Json in a String form instead of a - * {@link Reader}, use {@link #fromJson(String, Class)} instead. - * - * @param the type of the desired object - * @param json the reader producing the Json from which the object is to be deserialized. - * @param classOfT the class of T - * @return an object of type T from the string. Returns {@code null} if {@code json} is at EOF. - * @throws JsonIOException if there was a problem reading from the Reader - * @throws JsonSyntaxException if json is not a valid representation for an object of type - * @since 1.2 - */ - public T fromJson(Reader json, Class classOfT) throws JsonSyntaxException, JsonIOException { - JsonReader jsonReader = newJsonReader(json); - Object object = fromJson(jsonReader, classOfT); - assertFullConsumption(object, jsonReader); - return Primitives.wrap(classOfT).cast(object); - } - - /** - * This method deserializes the Json read from the specified reader into an object of the - * specified type. This method is useful if the specified object is a generic type. For - * non-generic objects, use {@link #fromJson(Reader, Class)} instead. If you have the Json in a - * String form instead of a {@link Reader}, use {@link #fromJson(String, Type)} instead. - * - * @param the type of the desired object - * @param json the reader producing Json from which the object is to be deserialized - * @param typeOfT The specific genericized type of src. You can obtain this type by using the - * {@link com.google.gson.reflect.TypeToken} class. For example, to get the type for - * {@code Collection}, you should use: - *
-   * Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
-   * 
- * @return an object of type T from the json. Returns {@code null} if {@code json} is at EOF. - * @throws JsonIOException if there was a problem reading from the Reader - * @throws JsonSyntaxException if json is not a valid representation for an object of type - * @since 1.2 - */ - @SuppressWarnings("unchecked") - public T fromJson(Reader json, Type typeOfT) throws JsonIOException, JsonSyntaxException { - JsonReader jsonReader = newJsonReader(json); - T object = (T) fromJson(jsonReader, typeOfT); - assertFullConsumption(object, jsonReader); - return object; - } - - private static void assertFullConsumption(Object obj, JsonReader reader) { - try { - if (obj != null && reader.peek() != JsonToken.END_DOCUMENT) { - throw new JsonIOException("JSON document was not fully consumed."); - } - } catch (MalformedJsonException e) { - throw new JsonSyntaxException(e); - } catch (IOException e) { - throw new JsonIOException(e); - } - } - - /** - * Reads the next JSON value from {@code reader} and convert it to an object - * of type {@code typeOfT}. Returns {@code null}, if the {@code reader} is at EOF. - * Since Type is not parameterized by T, this method is type unsafe and should be used carefully - * - * @throws JsonIOException if there was a problem writing to the Reader - * @throws JsonSyntaxException if json is not a valid representation for an object of type - */ - @SuppressWarnings("unchecked") - public T fromJson(JsonReader reader, Type typeOfT) throws JsonIOException, JsonSyntaxException { - boolean isEmpty = true; - boolean oldLenient = reader.isLenient(); - reader.setLenient(true); - try { - reader.peek(); - isEmpty = false; - TypeToken typeToken = (TypeToken) TypeToken.get(typeOfT); - TypeAdapter typeAdapter = getAdapter(typeToken); - T object = typeAdapter.read(reader); - return object; - } catch (EOFException e) { - /* - * For compatibility with JSON 1.5 and earlier, we return null for empty - * documents instead of throwing. - */ - if (isEmpty) { - return null; - } - throw new JsonSyntaxException(e); - } catch (IllegalStateException e) { - throw new JsonSyntaxException(e); - } catch (IOException e) { - // TODO(inder): Figure out whether it is indeed right to rethrow this as JsonSyntaxException - throw new JsonSyntaxException(e); - } catch (AssertionError e) { - AssertionError error = new AssertionError("AssertionError (GSON" + "): " + e.getMessage()); - error.initCause(e); - throw error; - } finally { - reader.setLenient(oldLenient); - } - } - - /** - * This method deserializes the Json read from the specified parse tree into an object of the - * specified type. It is not suitable to use if the specified class is a generic type since it - * will not have the generic type information because of the Type Erasure feature of Java. - * Therefore, this method should not be used if the desired type is a generic type. Note that - * this method works fine if the any of the fields of the specified object are generics, just the - * object itself should not be a generic type. For the cases when the object is of generic type, - * invoke {@link #fromJson(JsonElement, Type)}. - * @param the type of the desired object - * @param json the root of the parse tree of {@link JsonElement}s from which the object is to - * be deserialized - * @param classOfT The class of T - * @return an object of type T from the json. Returns {@code null} if {@code json} is {@code null} - * or if {@code json} is empty. - * @throws JsonSyntaxException if json is not a valid representation for an object of type typeOfT - * @since 1.3 - */ - public T fromJson(JsonElement json, Class classOfT) throws JsonSyntaxException { - Object object = fromJson(json, (Type) classOfT); - return Primitives.wrap(classOfT).cast(object); - } - - /** - * This method deserializes the Json read from the specified parse tree into an object of the - * specified type. This method is useful if the specified object is a generic type. For - * non-generic objects, use {@link #fromJson(JsonElement, Class)} instead. - * - * @param the type of the desired object - * @param json the root of the parse tree of {@link JsonElement}s from which the object is to - * be deserialized - * @param typeOfT The specific genericized type of src. You can obtain this type by using the - * {@link com.google.gson.reflect.TypeToken} class. For example, to get the type for - * {@code Collection}, you should use: - *
-   * Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
-   * 
- * @return an object of type T from the json. Returns {@code null} if {@code json} is {@code null} - * or if {@code json} is empty. - * @throws JsonSyntaxException if json is not a valid representation for an object of type typeOfT - * @since 1.3 - */ - @SuppressWarnings("unchecked") - public T fromJson(JsonElement json, Type typeOfT) throws JsonSyntaxException { - if (json == null) { - return null; - } - return (T) fromJson(new JsonTreeReader(json), typeOfT); - } - - static class FutureTypeAdapter extends TypeAdapter { - private TypeAdapter delegate; - - public void setDelegate(TypeAdapter typeAdapter) { - if (delegate != null) { - throw new AssertionError(); - } - delegate = typeAdapter; - } - - @Override public T read(JsonReader in) throws IOException { - if (delegate == null) { - throw new IllegalStateException(); - } - return delegate.read(in); - } - - @Override public void write(JsonWriter out, T value) throws IOException { - if (delegate == null) { - throw new IllegalStateException(); - } - delegate.write(out, value); - } - } - - @Override - public String toString() { - return new StringBuilder("{serializeNulls:") - .append(serializeNulls) - .append(",factories:").append(factories) - .append(",instanceCreators:").append(constructorConstructor) - .append("}") - .toString(); - } -} diff --git a/minecraft_server/com/google/gson/GsonBuilder.java b/minecraft_server/com/google/gson/GsonBuilder.java deleted file mode 100644 index b798604..0000000 --- a/minecraft_server/com/google/gson/GsonBuilder.java +++ /dev/null @@ -1,665 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.lang.reflect.Type; -import java.text.DateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.google.gson.internal.$Gson$Preconditions; -import com.google.gson.internal.Excluder; -import com.google.gson.internal.bind.DefaultDateTypeAdapter; -import com.google.gson.internal.bind.TreeTypeAdapter; -import com.google.gson.internal.bind.TypeAdapters; -import com.google.gson.internal.sql.SqlTypesSupport; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; - -import static com.google.gson.Gson.DEFAULT_COMPLEX_MAP_KEYS; -import static com.google.gson.Gson.DEFAULT_ESCAPE_HTML; -import static com.google.gson.Gson.DEFAULT_JSON_NON_EXECUTABLE; -import static com.google.gson.Gson.DEFAULT_LENIENT; -import static com.google.gson.Gson.DEFAULT_PRETTY_PRINT; -import static com.google.gson.Gson.DEFAULT_SERIALIZE_NULLS; -import static com.google.gson.Gson.DEFAULT_SPECIALIZE_FLOAT_VALUES; - -/** - *

Use this builder to construct a {@link Gson} instance when you need to set configuration - * options other than the default. For {@link Gson} with default configuration, it is simpler to - * use {@code new Gson()}. {@code GsonBuilder} is best used by creating it, and then invoking its - * various configuration methods, and finally calling create.

- * - *

The following is an example shows how to use the {@code GsonBuilder} to construct a Gson - * instance: - * - *

- * Gson gson = new GsonBuilder()
- *     .registerTypeAdapter(Id.class, new IdTypeAdapter())
- *     .enableComplexMapKeySerialization()
- *     .serializeNulls()
- *     .setDateFormat(DateFormat.LONG)
- *     .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)
- *     .setPrettyPrinting()
- *     .setVersion(1.0)
- *     .create();
- * 

- * - *

NOTES: - *

    - *
  • the order of invocation of configuration methods does not matter.
  • - *
  • The default serialization of {@link Date} and its subclasses in Gson does - * not contain time-zone information. So, if you are using date/time instances, - * use {@code GsonBuilder} and its {@code setDateFormat} methods.
  • - *
- *

- * - * @author Inderjeet Singh - * @author Joel Leitch - * @author Jesse Wilson - */ -public final class GsonBuilder { - private Excluder excluder = Excluder.DEFAULT; - private LongSerializationPolicy longSerializationPolicy = LongSerializationPolicy.DEFAULT; - private FieldNamingStrategy fieldNamingPolicy = FieldNamingPolicy.IDENTITY; - private final Map> instanceCreators - = new HashMap>(); - private final List factories = new ArrayList(); - /** tree-style hierarchy factories. These come after factories for backwards compatibility. */ - private final List hierarchyFactories = new ArrayList(); - private boolean serializeNulls = DEFAULT_SERIALIZE_NULLS; - private String datePattern; - private int dateStyle = DateFormat.DEFAULT; - private int timeStyle = DateFormat.DEFAULT; - private boolean complexMapKeySerialization = DEFAULT_COMPLEX_MAP_KEYS; - private boolean serializeSpecialFloatingPointValues = DEFAULT_SPECIALIZE_FLOAT_VALUES; - private boolean escapeHtmlChars = DEFAULT_ESCAPE_HTML; - private boolean prettyPrinting = DEFAULT_PRETTY_PRINT; - private boolean generateNonExecutableJson = DEFAULT_JSON_NON_EXECUTABLE; - private boolean lenient = DEFAULT_LENIENT; - private ToNumberStrategy objectToNumberStrategy = ToNumberPolicy.DOUBLE; - private ToNumberStrategy numberToNumberStrategy = ToNumberPolicy.LAZILY_PARSED_NUMBER; - - /** - * Creates a GsonBuilder instance that can be used to build Gson with various configuration - * settings. GsonBuilder follows the builder pattern, and it is typically used by first - * invoking various configuration methods to set desired options, and finally calling - * {@link #create()}. - */ - public GsonBuilder() { - } - - /** - * Constructs a GsonBuilder instance from a Gson instance. The newly constructed GsonBuilder - * has the same configuration as the previously built Gson instance. - * - * @param gson the gson instance whose configuration should by applied to a new GsonBuilder. - */ - GsonBuilder(Gson gson) { - this.excluder = gson.excluder; - this.fieldNamingPolicy = gson.fieldNamingStrategy; - this.instanceCreators.putAll(gson.instanceCreators); - this.serializeNulls = gson.serializeNulls; - this.complexMapKeySerialization = gson.complexMapKeySerialization; - this.generateNonExecutableJson = gson.generateNonExecutableJson; - this.escapeHtmlChars = gson.htmlSafe; - this.prettyPrinting = gson.prettyPrinting; - this.lenient = gson.lenient; - this.serializeSpecialFloatingPointValues = gson.serializeSpecialFloatingPointValues; - this.longSerializationPolicy = gson.longSerializationPolicy; - this.datePattern = gson.datePattern; - this.dateStyle = gson.dateStyle; - this.timeStyle = gson.timeStyle; - this.factories.addAll(gson.builderFactories); - this.hierarchyFactories.addAll(gson.builderHierarchyFactories); - this.objectToNumberStrategy = gson.objectToNumberStrategy; - this.numberToNumberStrategy = gson.numberToNumberStrategy; - } - - /** - * Configures Gson to enable versioning support. - * - * @param ignoreVersionsAfter any field or type marked with a version higher than this value - * are ignored during serialization or deserialization. - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - */ - public GsonBuilder setVersion(double ignoreVersionsAfter) { - excluder = excluder.withVersion(ignoreVersionsAfter); - return this; - } - - /** - * Configures Gson to excludes all class fields that have the specified modifiers. By default, - * Gson will exclude all fields marked transient or static. This method will override that - * behavior. - * - * @param modifiers the field modifiers. You must use the modifiers specified in the - * {@link java.lang.reflect.Modifier} class. For example, - * {@link java.lang.reflect.Modifier#TRANSIENT}, - * {@link java.lang.reflect.Modifier#STATIC}. - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - */ - public GsonBuilder excludeFieldsWithModifiers(int... modifiers) { - excluder = excluder.withModifiers(modifiers); - return this; - } - - /** - * Makes the output JSON non-executable in Javascript by prefixing the generated JSON with some - * special text. This prevents attacks from third-party sites through script sourcing. See - * Gson Issue 42 - * for details. - * - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.3 - */ - public GsonBuilder generateNonExecutableJson() { - this.generateNonExecutableJson = true; - return this; - } - - /** - * Configures Gson to exclude all fields from consideration for serialization or deserialization - * that do not have the {@link com.google.gson.annotations.Expose} annotation. - * - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - */ - public GsonBuilder excludeFieldsWithoutExposeAnnotation() { - excluder = excluder.excludeFieldsWithoutExposeAnnotation(); - return this; - } - - /** - * Configure Gson to serialize null fields. By default, Gson omits all fields that are null - * during serialization. - * - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.2 - */ - public GsonBuilder serializeNulls() { - this.serializeNulls = true; - return this; - } - - /** - * Enabling this feature will only change the serialized form if the map key is - * a complex type (i.e. non-primitive) in its serialized JSON - * form. The default implementation of map serialization uses {@code toString()} - * on the key; however, when this is called then one of the following cases - * apply: - * - *

Maps as JSON objects

- * For this case, assume that a type adapter is registered to serialize and - * deserialize some {@code Point} class, which contains an x and y coordinate, - * to/from the JSON Primitive string value {@code "(x,y)"}. The Java map would - * then be serialized as a {@link JsonObject}. - * - *

Below is an example: - *

  {@code
-   *   Gson gson = new GsonBuilder()
-   *       .register(Point.class, new MyPointTypeAdapter())
-   *       .enableComplexMapKeySerialization()
-   *       .create();
-   *
-   *   Map original = new LinkedHashMap();
-   *   original.put(new Point(5, 6), "a");
-   *   original.put(new Point(8, 8), "b");
-   *   System.out.println(gson.toJson(original, type));
-   * }
- * The above code prints this JSON object:
  {@code
-   *   {
-   *     "(5,6)": "a",
-   *     "(8,8)": "b"
-   *   }
-   * }
- * - *

Maps as JSON arrays

- * For this case, assume that a type adapter was NOT registered for some - * {@code Point} class, but rather the default Gson serialization is applied. - * In this case, some {@code new Point(2,3)} would serialize as {@code - * {"x":2,"y":5}}. - * - *

Given the assumption above, a {@code Map} will be - * serialize as an array of arrays (can be viewed as an entry set of pairs). - * - *

Below is an example of serializing complex types as JSON arrays: - *

 {@code
-   *   Gson gson = new GsonBuilder()
-   *       .enableComplexMapKeySerialization()
-   *       .create();
-   *
-   *   Map original = new LinkedHashMap();
-   *   original.put(new Point(5, 6), "a");
-   *   original.put(new Point(8, 8), "b");
-   *   System.out.println(gson.toJson(original, type));
-   * }
-   *
-   * The JSON output would look as follows:
-   * 
   {@code
-   *   [
-   *     [
-   *       {
-   *         "x": 5,
-   *         "y": 6
-   *       },
-   *       "a"
-   *     ],
-   *     [
-   *       {
-   *         "x": 8,
-   *         "y": 8
-   *       },
-   *       "b"
-   *     ]
-   *   ]
-   * }
- * - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.7 - */ - public GsonBuilder enableComplexMapKeySerialization() { - complexMapKeySerialization = true; - return this; - } - - /** - * Configures Gson to exclude inner classes during serialization. - * - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.3 - */ - public GsonBuilder disableInnerClassSerialization() { - excluder = excluder.disableInnerClassSerialization(); - return this; - } - - /** - * Configures Gson to apply a specific serialization policy for {@code Long} and {@code long} - * objects. - * - * @param serializationPolicy the particular policy to use for serializing longs. - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.3 - */ - public GsonBuilder setLongSerializationPolicy(LongSerializationPolicy serializationPolicy) { - this.longSerializationPolicy = serializationPolicy; - return this; - } - - /** - * Configures Gson to apply a specific naming policy to an object's field during serialization - * and deserialization. - * - * @param namingConvention the JSON field naming convention to use for serialization and - * deserialization. - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - */ - public GsonBuilder setFieldNamingPolicy(FieldNamingPolicy namingConvention) { - this.fieldNamingPolicy = namingConvention; - return this; - } - - /** - * Configures Gson to apply a specific naming policy strategy to an object's field during - * serialization and deserialization. - * - * @param fieldNamingStrategy the actual naming strategy to apply to the fields - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.3 - */ - public GsonBuilder setFieldNamingStrategy(FieldNamingStrategy fieldNamingStrategy) { - this.fieldNamingPolicy = fieldNamingStrategy; - return this; - } - - /** - * Configures Gson to apply a specific number strategy during deserialization of {@link Object}. - * - * @param objectToNumberStrategy the actual object-to-number strategy - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @see ToNumberPolicy#DOUBLE The default object-to-number strategy - */ - public GsonBuilder setObjectToNumberStrategy(ToNumberStrategy objectToNumberStrategy) { - this.objectToNumberStrategy = objectToNumberStrategy; - return this; - } - - /** - * Configures Gson to apply a specific number strategy during deserialization of {@link Number}. - * - * @param numberToNumberStrategy the actual number-to-number strategy - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @see ToNumberPolicy#LAZILY_PARSED_NUMBER The default number-to-number strategy - */ - public GsonBuilder setNumberToNumberStrategy(ToNumberStrategy numberToNumberStrategy) { - this.numberToNumberStrategy = numberToNumberStrategy; - return this; - } - - /** - * Configures Gson to apply a set of exclusion strategies during both serialization and - * deserialization. Each of the {@code strategies} will be applied as a disjunction rule. - * This means that if one of the {@code strategies} suggests that a field (or class) should be - * skipped then that field (or object) is skipped during serialization/deserialization. - * - * @param strategies the set of strategy object to apply during object (de)serialization. - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.4 - */ - public GsonBuilder setExclusionStrategies(ExclusionStrategy... strategies) { - for (ExclusionStrategy strategy : strategies) { - excluder = excluder.withExclusionStrategy(strategy, true, true); - } - return this; - } - - /** - * Configures Gson to apply the passed in exclusion strategy during serialization. - * If this method is invoked numerous times with different exclusion strategy objects - * then the exclusion strategies that were added will be applied as a disjunction rule. - * This means that if one of the added exclusion strategies suggests that a field (or - * class) should be skipped then that field (or object) is skipped during its - * serialization. - * - * @param strategy an exclusion strategy to apply during serialization. - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.7 - */ - public GsonBuilder addSerializationExclusionStrategy(ExclusionStrategy strategy) { - excluder = excluder.withExclusionStrategy(strategy, true, false); - return this; - } - - /** - * Configures Gson to apply the passed in exclusion strategy during deserialization. - * If this method is invoked numerous times with different exclusion strategy objects - * then the exclusion strategies that were added will be applied as a disjunction rule. - * This means that if one of the added exclusion strategies suggests that a field (or - * class) should be skipped then that field (or object) is skipped during its - * deserialization. - * - * @param strategy an exclusion strategy to apply during deserialization. - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.7 - */ - public GsonBuilder addDeserializationExclusionStrategy(ExclusionStrategy strategy) { - excluder = excluder.withExclusionStrategy(strategy, false, true); - return this; - } - - /** - * Configures Gson to output Json that fits in a page for pretty printing. This option only - * affects Json serialization. - * - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - */ - public GsonBuilder setPrettyPrinting() { - prettyPrinting = true; - return this; - } - - /** - * By default, Gson is strict and only accepts JSON as specified by - * RFC 4627. This option makes the parser - * liberal in what it accepts. - * - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @see JsonReader#setLenient(boolean) - */ - public GsonBuilder setLenient() { - lenient = true; - return this; - } - - /** - * By default, Gson escapes HTML characters such as < > etc. Use this option to configure - * Gson to pass-through HTML characters as is. - * - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.3 - */ - public GsonBuilder disableHtmlEscaping() { - this.escapeHtmlChars = false; - return this; - } - - /** - * Configures Gson to serialize {@code Date} objects according to the pattern provided. You can - * call this method or {@link #setDateFormat(int)} multiple times, but only the last invocation - * will be used to decide the serialization format. - * - *

The date format will be used to serialize and deserialize {@link java.util.Date} and in case - * the {@code java.sql} module is present, also {@link java.sql.Timestamp} and {@link java.sql.Date}. - * - *

Note that this pattern must abide by the convention provided by {@code SimpleDateFormat} - * class. See the documentation in {@link java.text.SimpleDateFormat} for more information on - * valid date and time patterns.

- * - * @param pattern the pattern that dates will be serialized/deserialized to/from - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.2 - */ - public GsonBuilder setDateFormat(String pattern) { - // TODO(Joel): Make this fail fast if it is an invalid date format - this.datePattern = pattern; - return this; - } - - /** - * Configures Gson to to serialize {@code Date} objects according to the style value provided. - * You can call this method or {@link #setDateFormat(String)} multiple times, but only the last - * invocation will be used to decide the serialization format. - * - *

Note that this style value should be one of the predefined constants in the - * {@code DateFormat} class. See the documentation in {@link java.text.DateFormat} for more - * information on the valid style constants.

- * - * @param style the predefined date style that date objects will be serialized/deserialized - * to/from - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.2 - */ - public GsonBuilder setDateFormat(int style) { - this.dateStyle = style; - this.datePattern = null; - return this; - } - - /** - * Configures Gson to to serialize {@code Date} objects according to the style value provided. - * You can call this method or {@link #setDateFormat(String)} multiple times, but only the last - * invocation will be used to decide the serialization format. - * - *

Note that this style value should be one of the predefined constants in the - * {@code DateFormat} class. See the documentation in {@link java.text.DateFormat} for more - * information on the valid style constants.

- * - * @param dateStyle the predefined date style that date objects will be serialized/deserialized - * to/from - * @param timeStyle the predefined style for the time portion of the date objects - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.2 - */ - public GsonBuilder setDateFormat(int dateStyle, int timeStyle) { - this.dateStyle = dateStyle; - this.timeStyle = timeStyle; - this.datePattern = null; - return this; - } - - /** - * Configures Gson for custom serialization or deserialization. This method combines the - * registration of an {@link TypeAdapter}, {@link InstanceCreator}, {@link JsonSerializer}, and a - * {@link JsonDeserializer}. It is best used when a single object {@code typeAdapter} implements - * all the required interfaces for custom serialization with Gson. If a type adapter was - * previously registered for the specified {@code type}, it is overwritten. - * - *

This registers the type specified and no other types: you must manually register related - * types! For example, applications registering {@code boolean.class} should also register {@code - * Boolean.class}. - * - * @param type the type definition for the type adapter being registered - * @param typeAdapter This object must implement at least one of the {@link TypeAdapter}, - * {@link InstanceCreator}, {@link JsonSerializer}, and a {@link JsonDeserializer} interfaces. - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - */ - @SuppressWarnings({"unchecked", "rawtypes"}) - public GsonBuilder registerTypeAdapter(Type type, Object typeAdapter) { - $Gson$Preconditions.checkArgument(typeAdapter instanceof JsonSerializer - || typeAdapter instanceof JsonDeserializer - || typeAdapter instanceof InstanceCreator - || typeAdapter instanceof TypeAdapter); - if (typeAdapter instanceof InstanceCreator) { - instanceCreators.put(type, (InstanceCreator) typeAdapter); - } - if (typeAdapter instanceof JsonSerializer || typeAdapter instanceof JsonDeserializer) { - TypeToken typeToken = TypeToken.get(type); - factories.add(TreeTypeAdapter.newFactoryWithMatchRawType(typeToken, typeAdapter)); - } - if (typeAdapter instanceof TypeAdapter) { - factories.add(TypeAdapters.newFactory(TypeToken.get(type), (TypeAdapter)typeAdapter)); - } - return this; - } - - /** - * Register a factory for type adapters. Registering a factory is useful when the type - * adapter needs to be configured based on the type of the field being processed. Gson - * is designed to handle a large number of factories, so you should consider registering - * them to be at par with registering an individual type adapter. - * - * @since 2.1 - */ - public GsonBuilder registerTypeAdapterFactory(TypeAdapterFactory factory) { - factories.add(factory); - return this; - } - - /** - * Configures Gson for custom serialization or deserialization for an inheritance type hierarchy. - * This method combines the registration of a {@link TypeAdapter}, {@link JsonSerializer} and - * a {@link JsonDeserializer}. If a type adapter was previously registered for the specified - * type hierarchy, it is overridden. If a type adapter is registered for a specific type in - * the type hierarchy, it will be invoked instead of the one registered for the type hierarchy. - * - * @param baseType the class definition for the type adapter being registered for the base class - * or interface - * @param typeAdapter This object must implement at least one of {@link TypeAdapter}, - * {@link JsonSerializer} or {@link JsonDeserializer} interfaces. - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.7 - */ - @SuppressWarnings({"unchecked", "rawtypes"}) - public GsonBuilder registerTypeHierarchyAdapter(Class baseType, Object typeAdapter) { - $Gson$Preconditions.checkArgument(typeAdapter instanceof JsonSerializer - || typeAdapter instanceof JsonDeserializer - || typeAdapter instanceof TypeAdapter); - if (typeAdapter instanceof JsonDeserializer || typeAdapter instanceof JsonSerializer) { - hierarchyFactories.add(TreeTypeAdapter.newTypeHierarchyFactory(baseType, typeAdapter)); - } - if (typeAdapter instanceof TypeAdapter) { - factories.add(TypeAdapters.newTypeHierarchyFactory(baseType, (TypeAdapter)typeAdapter)); - } - return this; - } - - /** - * Section 2.4 of JSON specification disallows - * special double values (NaN, Infinity, -Infinity). However, - * Javascript - * specification (see section 4.3.20, 4.3.22, 4.3.23) allows these values as valid Javascript - * values. Moreover, most JavaScript engines will accept these special values in JSON without - * problem. So, at a practical level, it makes sense to accept these values as valid JSON even - * though JSON specification disallows them. - * - *

Gson always accepts these special values during deserialization. However, it outputs - * strictly compliant JSON. Hence, if it encounters a float value {@link Float#NaN}, - * {@link Float#POSITIVE_INFINITY}, {@link Float#NEGATIVE_INFINITY}, or a double value - * {@link Double#NaN}, {@link Double#POSITIVE_INFINITY}, {@link Double#NEGATIVE_INFINITY}, it - * will throw an {@link IllegalArgumentException}. This method provides a way to override the - * default behavior when you know that the JSON receiver will be able to handle these special - * values. - * - * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern - * @since 1.3 - */ - public GsonBuilder serializeSpecialFloatingPointValues() { - this.serializeSpecialFloatingPointValues = true; - return this; - } - - /** - * Creates a {@link Gson} instance based on the current configuration. This method is free of - * side-effects to this {@code GsonBuilder} instance and hence can be called multiple times. - * - * @return an instance of Gson configured with the options currently set in this builder - */ - public Gson create() { - List factories = new ArrayList(this.factories.size() + this.hierarchyFactories.size() + 3); - factories.addAll(this.factories); - Collections.reverse(factories); - - List hierarchyFactories = new ArrayList(this.hierarchyFactories); - Collections.reverse(hierarchyFactories); - factories.addAll(hierarchyFactories); - - addTypeAdaptersForDate(datePattern, dateStyle, timeStyle, factories); - - return new Gson(excluder, fieldNamingPolicy, instanceCreators, - serializeNulls, complexMapKeySerialization, - generateNonExecutableJson, escapeHtmlChars, prettyPrinting, lenient, - serializeSpecialFloatingPointValues, longSerializationPolicy, - datePattern, dateStyle, timeStyle, - this.factories, this.hierarchyFactories, factories, objectToNumberStrategy, numberToNumberStrategy); - } - - private void addTypeAdaptersForDate(String datePattern, int dateStyle, int timeStyle, - List factories) { - TypeAdapterFactory dateAdapterFactory; - boolean sqlTypesSupported = SqlTypesSupport.SUPPORTS_SQL_TYPES; - TypeAdapterFactory sqlTimestampAdapterFactory = null; - TypeAdapterFactory sqlDateAdapterFactory = null; - - if (datePattern != null && !datePattern.trim().isEmpty()) { - dateAdapterFactory = DefaultDateTypeAdapter.DateType.DATE.createAdapterFactory(datePattern); - - if (sqlTypesSupported) { - sqlTimestampAdapterFactory = SqlTypesSupport.TIMESTAMP_DATE_TYPE.createAdapterFactory(datePattern); - sqlDateAdapterFactory = SqlTypesSupport.DATE_DATE_TYPE.createAdapterFactory(datePattern); - } - } else if (dateStyle != DateFormat.DEFAULT && timeStyle != DateFormat.DEFAULT) { - dateAdapterFactory = DefaultDateTypeAdapter.DateType.DATE.createAdapterFactory(dateStyle, timeStyle); - - if (sqlTypesSupported) { - sqlTimestampAdapterFactory = SqlTypesSupport.TIMESTAMP_DATE_TYPE.createAdapterFactory(dateStyle, timeStyle); - sqlDateAdapterFactory = SqlTypesSupport.DATE_DATE_TYPE.createAdapterFactory(dateStyle, timeStyle); - } - } else { - return; - } - - factories.add(dateAdapterFactory); - if (sqlTypesSupported) { - factories.add(sqlTimestampAdapterFactory); - factories.add(sqlDateAdapterFactory); - } - } -} diff --git a/minecraft_server/com/google/gson/InstanceCreator.java b/minecraft_server/com/google/gson/InstanceCreator.java deleted file mode 100644 index d5096a0..0000000 --- a/minecraft_server/com/google/gson/InstanceCreator.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.lang.reflect.Type; - -/** - * This interface is implemented to create instances of a class that does not define a no-args - * constructor. If you can modify the class, you should instead add a private, or public - * no-args constructor. However, that is not possible for library classes, such as JDK classes, or - * a third-party library that you do not have source-code of. In such cases, you should define an - * instance creator for the class. Implementations of this interface should be registered with - * {@link GsonBuilder#registerTypeAdapter(Type, Object)} method before Gson will be able to use - * them. - *

Let us look at an example where defining an InstanceCreator might be useful. The - * {@code Id} class defined below does not have a default no-args constructor.

- * - *
- * public class Id<T> {
- *   private final Class<T> clazz;
- *   private final long value;
- *   public Id(Class<T> clazz, long value) {
- *     this.clazz = clazz;
- *     this.value = value;
- *   }
- * }
- * 
- * - *

If Gson encounters an object of type {@code Id} during deserialization, it will throw an - * exception. The easiest way to solve this problem will be to add a (public or private) no-args - * constructor as follows:

- * - *
- * private Id() {
- *   this(Object.class, 0L);
- * }
- * 
- * - *

However, let us assume that the developer does not have access to the source-code of the - * {@code Id} class, or does not want to define a no-args constructor for it. The developer - * can solve this problem by defining an {@code InstanceCreator} for {@code Id}:

- * - *
- * class IdInstanceCreator implements InstanceCreator<Id> {
- *   public Id createInstance(Type type) {
- *     return new Id(Object.class, 0L);
- *   }
- * }
- * 
- * - *

Note that it does not matter what the fields of the created instance contain since Gson will - * overwrite them with the deserialized values specified in Json. You should also ensure that a - * new object is returned, not a common object since its fields will be overwritten. - * The developer will need to register {@code IdInstanceCreator} with Gson as follows:

- * - *
- * Gson gson = new GsonBuilder().registerTypeAdapter(Id.class, new IdInstanceCreator()).create();
- * 
- * - * @param the type of object that will be created by this implementation. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public interface InstanceCreator { - - /** - * Gson invokes this call-back method during deserialization to create an instance of the - * specified type. The fields of the returned instance are overwritten with the data present - * in the Json. Since the prior contents of the object are destroyed and overwritten, do not - * return an instance that is useful elsewhere. In particular, do not return a common instance, - * always use {@code new} to create a new instance. - * - * @param type the parameterized T represented as a {@link Type}. - * @return a default object instance of type T. - */ - public T createInstance(Type type); -} diff --git a/minecraft_server/com/google/gson/JsonArray.java b/minecraft_server/com/google/gson/JsonArray.java deleted file mode 100644 index 4b61a90..0000000 --- a/minecraft_server/com/google/gson/JsonArray.java +++ /dev/null @@ -1,393 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * A class representing an array type in Json. An array is a list of {@link JsonElement}s each of - * which can be of a different type. This is an ordered list, meaning that the order in which - * elements are added is preserved. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public final class JsonArray extends JsonElement implements Iterable { - private final List elements; - - /** - * Creates an empty JsonArray. - */ - public JsonArray() { - elements = new ArrayList(); - } - - public JsonArray(int capacity) { - elements = new ArrayList(capacity); - } - - /** - * Creates a deep copy of this element and all its children - * @since 2.8.2 - */ - @Override - public JsonArray deepCopy() { - if (!elements.isEmpty()) { - JsonArray result = new JsonArray(elements.size()); - for (JsonElement element : elements) { - result.add(element.deepCopy()); - } - return result; - } - return new JsonArray(); - } - - /** - * Adds the specified boolean to self. - * - * @param bool the boolean that needs to be added to the array. - */ - public void add(Boolean bool) { - elements.add(bool == null ? JsonNull.INSTANCE : new JsonPrimitive(bool)); - } - - /** - * Adds the specified character to self. - * - * @param character the character that needs to be added to the array. - */ - public void add(Character character) { - elements.add(character == null ? JsonNull.INSTANCE : new JsonPrimitive(character)); - } - - /** - * Adds the specified number to self. - * - * @param number the number that needs to be added to the array. - */ - public void add(Number number) { - elements.add(number == null ? JsonNull.INSTANCE : new JsonPrimitive(number)); - } - - /** - * Adds the specified string to self. - * - * @param string the string that needs to be added to the array. - */ - public void add(String string) { - elements.add(string == null ? JsonNull.INSTANCE : new JsonPrimitive(string)); - } - - /** - * Adds the specified element to self. - * - * @param element the element that needs to be added to the array. - */ - public void add(JsonElement element) { - if (element == null) { - element = JsonNull.INSTANCE; - } - elements.add(element); - } - - /** - * Adds all the elements of the specified array to self. - * - * @param array the array whose elements need to be added to the array. - */ - public void addAll(JsonArray array) { - elements.addAll(array.elements); - } - - /** - * Replaces the element at the specified position in this array with the specified element. - * Element can be null. - * @param index index of the element to replace - * @param element element to be stored at the specified position - * @return the element previously at the specified position - * @throws IndexOutOfBoundsException if the specified index is outside the array bounds - */ - public JsonElement set(int index, JsonElement element) { - return elements.set(index, element); - } - - /** - * Removes the first occurrence of the specified element from this array, if it is present. - * If the array does not contain the element, it is unchanged. - * @param element element to be removed from this array, if present - * @return true if this array contained the specified element, false otherwise - * @since 2.3 - */ - public boolean remove(JsonElement element) { - return elements.remove(element); - } - - /** - * Removes the element at the specified position in this array. Shifts any subsequent elements - * to the left (subtracts one from their indices). Returns the element that was removed from - * the array. - * @param index index the index of the element to be removed - * @return the element previously at the specified position - * @throws IndexOutOfBoundsException if the specified index is outside the array bounds - * @since 2.3 - */ - public JsonElement remove(int index) { - return elements.remove(index); - } - - /** - * Returns true if this array contains the specified element. - * @return true if this array contains the specified element. - * @param element whose presence in this array is to be tested - * @since 2.3 - */ - public boolean contains(JsonElement element) { - return elements.contains(element); - } - - /** - * Returns the number of elements in the array. - * - * @return the number of elements in the array. - */ - public int size() { - return elements.size(); - } - - /** - * Returns true if the array is empty - * - * @return true if the array is empty - */ - public boolean isEmpty() { - return elements.isEmpty(); - } - - /** - * Returns an iterator to navigate the elements of the array. Since the array is an ordered list, - * the iterator navigates the elements in the order they were inserted. - * - * @return an iterator to navigate the elements of the array. - */ - public Iterator iterator() { - return elements.iterator(); - } - - /** - * Returns the ith element of the array. - * - * @param i the index of the element that is being sought. - * @return the element present at the ith index. - * @throws IndexOutOfBoundsException if i is negative or greater than or equal to the - * {@link #size()} of the array. - */ - public JsonElement get(int i) { - return elements.get(i); - } - - /** - * convenience method to get this array as a {@link Number} if it contains a single element. - * - * @return get this element as a number if it is single element array. - * @throws ClassCastException if the element in the array is of not a {@link JsonPrimitive} and - * is not a valid Number. - * @throws IllegalStateException if the array has more than one element. - */ - @Override - public Number getAsNumber() { - if (elements.size() == 1) { - return elements.get(0).getAsNumber(); - } - throw new IllegalStateException(); - } - - /** - * convenience method to get this array as a {@link String} if it contains a single element. - * - * @return get this element as a String if it is single element array. - * @throws ClassCastException if the element in the array is of not a {@link JsonPrimitive} and - * is not a valid String. - * @throws IllegalStateException if the array has more than one element. - */ - @Override - public String getAsString() { - if (elements.size() == 1) { - return elements.get(0).getAsString(); - } - throw new IllegalStateException(); - } - - /** - * convenience method to get this array as a double if it contains a single element. - * - * @return get this element as a double if it is single element array. - * @throws ClassCastException if the element in the array is of not a {@link JsonPrimitive} and - * is not a valid double. - * @throws IllegalStateException if the array has more than one element. - */ - @Override - public double getAsDouble() { - if (elements.size() == 1) { - return elements.get(0).getAsDouble(); - } - throw new IllegalStateException(); - } - - /** - * convenience method to get this array as a {@link BigDecimal} if it contains a single element. - * - * @return get this element as a {@link BigDecimal} if it is single element array. - * @throws ClassCastException if the element in the array is of not a {@link JsonPrimitive}. - * @throws NumberFormatException if the element at index 0 is not a valid {@link BigDecimal}. - * @throws IllegalStateException if the array has more than one element. - * @since 1.2 - */ - @Override - public BigDecimal getAsBigDecimal() { - if (elements.size() == 1) { - return elements.get(0).getAsBigDecimal(); - } - throw new IllegalStateException(); - } - - /** - * convenience method to get this array as a {@link BigInteger} if it contains a single element. - * - * @return get this element as a {@link BigInteger} if it is single element array. - * @throws ClassCastException if the element in the array is of not a {@link JsonPrimitive}. - * @throws NumberFormatException if the element at index 0 is not a valid {@link BigInteger}. - * @throws IllegalStateException if the array has more than one element. - * @since 1.2 - */ - @Override - public BigInteger getAsBigInteger() { - if (elements.size() == 1) { - return elements.get(0).getAsBigInteger(); - } - throw new IllegalStateException(); - } - - /** - * convenience method to get this array as a float if it contains a single element. - * - * @return get this element as a float if it is single element array. - * @throws ClassCastException if the element in the array is of not a {@link JsonPrimitive} and - * is not a valid float. - * @throws IllegalStateException if the array has more than one element. - */ - @Override - public float getAsFloat() { - if (elements.size() == 1) { - return elements.get(0).getAsFloat(); - } - throw new IllegalStateException(); - } - - /** - * convenience method to get this array as a long if it contains a single element. - * - * @return get this element as a long if it is single element array. - * @throws ClassCastException if the element in the array is of not a {@link JsonPrimitive} and - * is not a valid long. - * @throws IllegalStateException if the array has more than one element. - */ - @Override - public long getAsLong() { - if (elements.size() == 1) { - return elements.get(0).getAsLong(); - } - throw new IllegalStateException(); - } - - /** - * convenience method to get this array as an integer if it contains a single element. - * - * @return get this element as an integer if it is single element array. - * @throws ClassCastException if the element in the array is of not a {@link JsonPrimitive} and - * is not a valid integer. - * @throws IllegalStateException if the array has more than one element. - */ - @Override - public int getAsInt() { - if (elements.size() == 1) { - return elements.get(0).getAsInt(); - } - throw new IllegalStateException(); - } - - @Override - public byte getAsByte() { - if (elements.size() == 1) { - return elements.get(0).getAsByte(); - } - throw new IllegalStateException(); - } - - @Override - public char getAsCharacter() { - if (elements.size() == 1) { - return elements.get(0).getAsCharacter(); - } - throw new IllegalStateException(); - } - - /** - * convenience method to get this array as a primitive short if it contains a single element. - * - * @return get this element as a primitive short if it is single element array. - * @throws ClassCastException if the element in the array is of not a {@link JsonPrimitive} and - * is not a valid short. - * @throws IllegalStateException if the array has more than one element. - */ - @Override - public short getAsShort() { - if (elements.size() == 1) { - return elements.get(0).getAsShort(); - } - throw new IllegalStateException(); - } - - /** - * convenience method to get this array as a boolean if it contains a single element. - * - * @return get this element as a boolean if it is single element array. - * @throws ClassCastException if the element in the array is of not a {@link JsonPrimitive} and - * is not a valid boolean. - * @throws IllegalStateException if the array has more than one element. - */ - @Override - public boolean getAsBoolean() { - if (elements.size() == 1) { - return elements.get(0).getAsBoolean(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object o) { - return (o == this) || (o instanceof JsonArray && ((JsonArray) o).elements.equals(elements)); - } - - @Override - public int hashCode() { - return elements.hashCode(); - } -} diff --git a/minecraft_server/com/google/gson/JsonDeserializationContext.java b/minecraft_server/com/google/gson/JsonDeserializationContext.java deleted file mode 100644 index 00c7505..0000000 --- a/minecraft_server/com/google/gson/JsonDeserializationContext.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.lang.reflect.Type; - -/** - * Context for deserialization that is passed to a custom deserializer during invocation of its - * {@link JsonDeserializer#deserialize(JsonElement, Type, JsonDeserializationContext)} - * method. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public interface JsonDeserializationContext { - - /** - * Invokes default deserialization on the specified object. It should never be invoked on - * the element received as a parameter of the - * {@link JsonDeserializer#deserialize(JsonElement, Type, JsonDeserializationContext)} method. Doing - * so will result in an infinite loop since Gson will in-turn call the custom deserializer again. - * - * @param json the parse tree. - * @param typeOfT type of the expected return value. - * @param The type of the deserialized object. - * @return An object of type typeOfT. - * @throws JsonParseException if the parse tree does not contain expected data. - */ - public T deserialize(JsonElement json, Type typeOfT) throws JsonParseException; -} \ No newline at end of file diff --git a/minecraft_server/com/google/gson/JsonDeserializer.java b/minecraft_server/com/google/gson/JsonDeserializer.java deleted file mode 100644 index 0589eb2..0000000 --- a/minecraft_server/com/google/gson/JsonDeserializer.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.lang.reflect.Type; - -/** - *

Interface representing a custom deserializer for Json. You should write a custom - * deserializer, if you are not happy with the default deserialization done by Gson. You will - * also need to register this deserializer through - * {@link GsonBuilder#registerTypeAdapter(Type, Object)}.

- * - *

Let us look at example where defining a deserializer will be useful. The {@code Id} class - * defined below has two fields: {@code clazz} and {@code value}.

- * - *
- * public class Id<T> {
- *   private final Class<T> clazz;
- *   private final long value;
- *   public Id(Class<T> clazz, long value) {
- *     this.clazz = clazz;
- *     this.value = value;
- *   }
- *   public long getValue() {
- *     return value;
- *   }
- * }
- * 
- * - *

The default deserialization of {@code Id(com.foo.MyObject.class, 20L)} will require the - * Json string to be {"clazz":com.foo.MyObject,"value":20}. Suppose, you already know - * the type of the field that the {@code Id} will be deserialized into, and hence just want to - * deserialize it from a Json string {@code 20}. You can achieve that by writing a custom - * deserializer:

- * - *
- * class IdDeserializer implements JsonDeserializer<Id>() {
- *   public Id deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
- *       throws JsonParseException {
- *     return new Id((Class)typeOfT, id.getValue());
- *   }
- * 
- * - *

You will also need to register {@code IdDeserializer} with Gson as follows:

- * - *
- * Gson gson = new GsonBuilder().registerTypeAdapter(Id.class, new IdDeserializer()).create();
- * 
- * - *

New applications should prefer {@link TypeAdapter}, whose streaming API - * is more efficient than this interface's tree API. - * - * @author Inderjeet Singh - * @author Joel Leitch - * - * @param type for which the deserializer is being registered. It is possible that a - * deserializer may be asked to deserialize a specific generic type of the T. - */ -public interface JsonDeserializer { - - /** - * Gson invokes this call-back method during deserialization when it encounters a field of the - * specified type. - *

In the implementation of this call-back method, you should consider invoking - * {@link JsonDeserializationContext#deserialize(JsonElement, Type)} method to create objects - * for any non-trivial field of the returned object. However, you should never invoke it on the - * the same type passing {@code json} since that will cause an infinite loop (Gson will call your - * call-back method again). - * - * @param json The Json data being deserialized - * @param typeOfT The type of the Object to deserialize to - * @return a deserialized object of the specified type typeOfT which is a subclass of {@code T} - * @throws JsonParseException if json is not in the expected format of {@code typeofT} - */ - public T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException; -} diff --git a/minecraft_server/com/google/gson/JsonElement.java b/minecraft_server/com/google/gson/JsonElement.java deleted file mode 100644 index 2ab1a16..0000000 --- a/minecraft_server/com/google/gson/JsonElement.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.io.StringWriter; -import java.math.BigDecimal; -import java.math.BigInteger; - -/** - * A class representing an element of Json. It could either be a {@link JsonObject}, a - * {@link JsonArray}, a {@link JsonPrimitive} or a {@link JsonNull}. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public abstract class JsonElement { - /** - * Returns a deep copy of this element. Immutable elements like primitives - * and nulls are not copied. - * @since 2.8.2 - */ - public abstract JsonElement deepCopy(); - - /** - * provides check for verifying if this element is an array or not. - * - * @return true if this element is of type {@link JsonArray}, false otherwise. - */ - public boolean isJsonArray() { - return this instanceof JsonArray; - } - - /** - * provides check for verifying if this element is a Json object or not. - * - * @return true if this element is of type {@link JsonObject}, false otherwise. - */ - public boolean isJsonObject() { - return this instanceof JsonObject; - } - - /** - * provides check for verifying if this element is a primitive or not. - * - * @return true if this element is of type {@link JsonPrimitive}, false otherwise. - */ - public boolean isJsonPrimitive() { - return this instanceof JsonPrimitive; - } - - /** - * provides check for verifying if this element represents a null value or not. - * - * @return true if this element is of type {@link JsonNull}, false otherwise. - * @since 1.2 - */ - public boolean isJsonNull() { - return this instanceof JsonNull; - } - - /** - * convenience method to get this element as a {@link JsonObject}. If the element is of some - * other type, a {@link IllegalStateException} will result. Hence it is best to use this method - * after ensuring that this element is of the desired type by calling {@link #isJsonObject()} - * first. - * - * @return get this element as a {@link JsonObject}. - * @throws IllegalStateException if the element is of another type. - */ - public JsonObject getAsJsonObject() { - if (isJsonObject()) { - return (JsonObject) this; - } - throw new IllegalStateException("Not a JSON Object: " + this); - } - - /** - * convenience method to get this element as a {@link JsonArray}. If the element is of some - * other type, a {@link IllegalStateException} will result. Hence it is best to use this method - * after ensuring that this element is of the desired type by calling {@link #isJsonArray()} - * first. - * - * @return get this element as a {@link JsonArray}. - * @throws IllegalStateException if the element is of another type. - */ - public JsonArray getAsJsonArray() { - if (isJsonArray()) { - return (JsonArray) this; - } - throw new IllegalStateException("Not a JSON Array: " + this); - } - - /** - * convenience method to get this element as a {@link JsonPrimitive}. If the element is of some - * other type, a {@link IllegalStateException} will result. Hence it is best to use this method - * after ensuring that this element is of the desired type by calling {@link #isJsonPrimitive()} - * first. - * - * @return get this element as a {@link JsonPrimitive}. - * @throws IllegalStateException if the element is of another type. - */ - public JsonPrimitive getAsJsonPrimitive() { - if (isJsonPrimitive()) { - return (JsonPrimitive) this; - } - throw new IllegalStateException("Not a JSON Primitive: " + this); - } - - /** - * convenience method to get this element as a {@link JsonNull}. If the element is of some - * other type, a {@link IllegalStateException} will result. Hence it is best to use this method - * after ensuring that this element is of the desired type by calling {@link #isJsonNull()} - * first. - * - * @return get this element as a {@link JsonNull}. - * @throws IllegalStateException if the element is of another type. - * @since 1.2 - */ - public JsonNull getAsJsonNull() { - if (isJsonNull()) { - return (JsonNull) this; - } - throw new IllegalStateException("Not a JSON Null: " + this); - } - - /** - * convenience method to get this element as a boolean value. - * - * @return get this element as a primitive boolean value. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive} and is not a valid - * boolean value. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - */ - public boolean getAsBoolean() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * convenience method to get this element as a {@link Number}. - * - * @return get this element as a {@link Number}. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive} and is not a valid - * number. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - */ - public Number getAsNumber() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * convenience method to get this element as a string value. - * - * @return get this element as a string value. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive} and is not a valid - * string value. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - */ - public String getAsString() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * convenience method to get this element as a primitive double value. - * - * @return get this element as a primitive double value. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive} and is not a valid - * double value. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - */ - public double getAsDouble() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * convenience method to get this element as a primitive float value. - * - * @return get this element as a primitive float value. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive} and is not a valid - * float value. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - */ - public float getAsFloat() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * convenience method to get this element as a primitive long value. - * - * @return get this element as a primitive long value. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive} and is not a valid - * long value. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - */ - public long getAsLong() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * convenience method to get this element as a primitive integer value. - * - * @return get this element as a primitive integer value. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive} and is not a valid - * integer value. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - */ - public int getAsInt() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * convenience method to get this element as a primitive byte value. - * - * @return get this element as a primitive byte value. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive} and is not a valid - * byte value. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - * @since 1.3 - */ - public byte getAsByte() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * convenience method to get the first character of this element as a string or the first - * character of this array's first element as a string. - * - * @return the first character of the string. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive} and is not a valid - * string value. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - * @since 1.3 - * @deprecated This method is misleading, as it does not get this element as a char but rather as - * a string's first character. - */ - @Deprecated - public char getAsCharacter() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * convenience method to get this element as a {@link BigDecimal}. - * - * @return get this element as a {@link BigDecimal}. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive}. - * * @throws NumberFormatException if the element is not a valid {@link BigDecimal}. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - * @since 1.2 - */ - public BigDecimal getAsBigDecimal() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * convenience method to get this element as a {@link BigInteger}. - * - * @return get this element as a {@link BigInteger}. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive}. - * @throws NumberFormatException if the element is not a valid {@link BigInteger}. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - * @since 1.2 - */ - public BigInteger getAsBigInteger() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * convenience method to get this element as a primitive short value. - * - * @return get this element as a primitive short value. - * @throws ClassCastException if the element is of not a {@link JsonPrimitive} and is not a valid - * short value. - * @throws IllegalStateException if the element is of the type {@link JsonArray} but contains - * more than a single element. - */ - public short getAsShort() { - throw new UnsupportedOperationException(getClass().getSimpleName()); - } - - /** - * Returns a String representation of this element. - */ - @Override - public String toString() { - try { - StringWriter stringWriter = new StringWriter(); - JsonWriter jsonWriter = new JsonWriter(stringWriter); - jsonWriter.setLenient(true); - Streams.write(this, jsonWriter); - return stringWriter.toString(); - } catch (IOException e) { - throw new AssertionError(e); - } - } -} diff --git a/minecraft_server/com/google/gson/JsonIOException.java b/minecraft_server/com/google/gson/JsonIOException.java deleted file mode 100644 index dfeccd8..0000000 --- a/minecraft_server/com/google/gson/JsonIOException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.gson; - -/** - * This exception is raised when Gson was unable to read an input stream - * or write to one. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public final class JsonIOException extends JsonParseException { - private static final long serialVersionUID = 1L; - - public JsonIOException(String msg) { - super(msg); - } - - public JsonIOException(String msg, Throwable cause) { - super(msg, cause); - } - - /** - * Creates exception with the specified cause. Consider using - * {@link #JsonIOException(String, Throwable)} instead if you can describe what happened. - * - * @param cause root exception that caused this exception to be thrown. - */ - public JsonIOException(Throwable cause) { - super(cause); - } -} diff --git a/minecraft_server/com/google/gson/JsonNull.java b/minecraft_server/com/google/gson/JsonNull.java deleted file mode 100644 index dcc10a7..0000000 --- a/minecraft_server/com/google/gson/JsonNull.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -/** - * A class representing a Json {@code null} value. - * - * @author Inderjeet Singh - * @author Joel Leitch - * @since 1.2 - */ -public final class JsonNull extends JsonElement { - /** - * singleton for JsonNull - * - * @since 1.8 - */ - public static final JsonNull INSTANCE = new JsonNull(); - - /** - * Creates a new JsonNull object. - * Deprecated since Gson version 1.8. Use {@link #INSTANCE} instead - */ - @Deprecated - public JsonNull() { - // Do nothing - } - - /** - * Returns the same instance since it is an immutable value - * @since 2.8.2 - */ - @Override - public JsonNull deepCopy() { - return INSTANCE; - } - - /** - * All instances of JsonNull have the same hash code since they are indistinguishable - */ - @Override - public int hashCode() { - return JsonNull.class.hashCode(); - } - - /** - * All instances of JsonNull are the same - */ - @Override - public boolean equals(Object other) { - return this == other || other instanceof JsonNull; - } -} diff --git a/minecraft_server/com/google/gson/JsonObject.java b/minecraft_server/com/google/gson/JsonObject.java deleted file mode 100644 index d4feb96..0000000 --- a/minecraft_server/com/google/gson/JsonObject.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import com.google.gson.internal.LinkedTreeMap; - -import java.util.Map; -import java.util.Set; - -/** - * A class representing an object type in Json. An object consists of name-value pairs where names - * are strings, and values are any other type of {@link JsonElement}. This allows for a creating a - * tree of JsonElements. The member elements of this object are maintained in order they were added. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public final class JsonObject extends JsonElement { - private final LinkedTreeMap members = - new LinkedTreeMap(); - - /** - * Creates a deep copy of this element and all its children - * @since 2.8.2 - */ - @Override - public JsonObject deepCopy() { - JsonObject result = new JsonObject(); - for (Map.Entry entry : members.entrySet()) { - result.add(entry.getKey(), entry.getValue().deepCopy()); - } - return result; - } - - /** - * Adds a member, which is a name-value pair, to self. The name must be a String, but the value - * can be an arbitrary JsonElement, thereby allowing you to build a full tree of JsonElements - * rooted at this node. - * - * @param property name of the member. - * @param value the member object. - */ - public void add(String property, JsonElement value) { - members.put(property, value == null ? JsonNull.INSTANCE : value); - } - - /** - * Removes the {@code property} from this {@link JsonObject}. - * - * @param property name of the member that should be removed. - * @return the {@link JsonElement} object that is being removed. - * @since 1.3 - */ - public JsonElement remove(String property) { - return members.remove(property); - } - - /** - * Convenience method to add a primitive member. The specified value is converted to a - * JsonPrimitive of String. - * - * @param property name of the member. - * @param value the string value associated with the member. - */ - public void addProperty(String property, String value) { - add(property, value == null ? JsonNull.INSTANCE : new JsonPrimitive(value)); - } - - /** - * Convenience method to add a primitive member. The specified value is converted to a - * JsonPrimitive of Number. - * - * @param property name of the member. - * @param value the number value associated with the member. - */ - public void addProperty(String property, Number value) { - add(property, value == null ? JsonNull.INSTANCE : new JsonPrimitive(value)); - } - - /** - * Convenience method to add a boolean member. The specified value is converted to a - * JsonPrimitive of Boolean. - * - * @param property name of the member. - * @param value the number value associated with the member. - */ - public void addProperty(String property, Boolean value) { - add(property, value == null ? JsonNull.INSTANCE : new JsonPrimitive(value)); - } - - /** - * Convenience method to add a char member. The specified value is converted to a - * JsonPrimitive of Character. - * - * @param property name of the member. - * @param value the number value associated with the member. - */ - public void addProperty(String property, Character value) { - add(property, value == null ? JsonNull.INSTANCE : new JsonPrimitive(value)); - } - - /** - * Returns a set of members of this object. The set is ordered, and the order is in which the - * elements were added. - * - * @return a set of members of this object. - */ - public Set> entrySet() { - return members.entrySet(); - } - - /** - * Returns a set of members key values. - * - * @return a set of member keys as Strings - * @since 2.8.1 - */ - public Set keySet() { - return members.keySet(); - } - - /** - * Returns the number of key/value pairs in the object. - * - * @return the number of key/value pairs in the object. - */ - public int size() { - return members.size(); - } - - /** - * Convenience method to check if a member with the specified name is present in this object. - * - * @param memberName name of the member that is being checked for presence. - * @return true if there is a member with the specified name, false otherwise. - */ - public boolean has(String memberName) { - return members.containsKey(memberName); - } - - /** - * Returns the member with the specified name. - * - * @param memberName name of the member that is being requested. - * @return the member matching the name. Null if no such member exists. - */ - public JsonElement get(String memberName) { - return members.get(memberName); - } - - /** - * Convenience method to get the specified member as a JsonPrimitive element. - * - * @param memberName name of the member being requested. - * @return the JsonPrimitive corresponding to the specified member. - */ - public JsonPrimitive getAsJsonPrimitive(String memberName) { - return (JsonPrimitive) members.get(memberName); - } - - /** - * Convenience method to get the specified member as a JsonArray. - * - * @param memberName name of the member being requested. - * @return the JsonArray corresponding to the specified member. - */ - public JsonArray getAsJsonArray(String memberName) { - return (JsonArray) members.get(memberName); - } - - /** - * Convenience method to get the specified member as a JsonObject. - * - * @param memberName name of the member being requested. - * @return the JsonObject corresponding to the specified member. - */ - public JsonObject getAsJsonObject(String memberName) { - return (JsonObject) members.get(memberName); - } - - @Override - public boolean equals(Object o) { - return (o == this) || (o instanceof JsonObject - && ((JsonObject) o).members.equals(members)); - } - - @Override - public int hashCode() { - return members.hashCode(); - } -} diff --git a/minecraft_server/com/google/gson/JsonParseException.java b/minecraft_server/com/google/gson/JsonParseException.java deleted file mode 100644 index c1f264d..0000000 --- a/minecraft_server/com/google/gson/JsonParseException.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -/** - * This exception is raised if there is a serious issue that occurs during parsing of a Json - * string. One of the main usages for this class is for the Gson infrastructure. If the incoming - * Json is bad/malicious, an instance of this exception is raised. - * - *

This exception is a {@link RuntimeException} because it is exposed to the client. Using a - * {@link RuntimeException} avoids bad coding practices on the client side where they catch the - * exception and do nothing. It is often the case that you want to blow up if there is a parsing - * error (i.e. often clients do not know how to recover from a {@link JsonParseException}.

- * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public class JsonParseException extends RuntimeException { - static final long serialVersionUID = -4086729973971783390L; - - /** - * Creates exception with the specified message. If you are wrapping another exception, consider - * using {@link #JsonParseException(String, Throwable)} instead. - * - * @param msg error message describing a possible cause of this exception. - */ - public JsonParseException(String msg) { - super(msg); - } - - /** - * Creates exception with the specified message and cause. - * - * @param msg error message describing what happened. - * @param cause root exception that caused this exception to be thrown. - */ - public JsonParseException(String msg, Throwable cause) { - super(msg, cause); - } - - /** - * Creates exception with the specified cause. Consider using - * {@link #JsonParseException(String, Throwable)} instead if you can describe what happened. - * - * @param cause root exception that caused this exception to be thrown. - */ - public JsonParseException(Throwable cause) { - super(cause); - } -} diff --git a/minecraft_server/com/google/gson/JsonParser.java b/minecraft_server/com/google/gson/JsonParser.java deleted file mode 100644 index 5f7dd1f..0000000 --- a/minecraft_server/com/google/gson/JsonParser.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.gson; - -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; - -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.MalformedJsonException; - -/** - * A parser to parse Json into a parse tree of {@link JsonElement}s - * - * @author Inderjeet Singh - * @author Joel Leitch - * @since 1.3 - */ -public final class JsonParser { - /** @deprecated No need to instantiate this class, use the static methods instead. */ - @Deprecated - public JsonParser() {} - - /** - * Parses the specified JSON string into a parse tree - * - * @param json JSON text - * @return a parse tree of {@link JsonElement}s corresponding to the specified JSON - * @throws JsonParseException if the specified text is not valid JSON - */ - public static JsonElement parseString(String json) throws JsonSyntaxException { - return parseReader(new StringReader(json)); - } - - /** - * Parses the specified JSON string into a parse tree - * - * @param reader JSON text - * @return a parse tree of {@link JsonElement}s corresponding to the specified JSON - * @throws JsonParseException if the specified text is not valid JSON - */ - public static JsonElement parseReader(Reader reader) throws JsonIOException, JsonSyntaxException { - try { - JsonReader jsonReader = new JsonReader(reader); - JsonElement element = parseReader(jsonReader); - if (!element.isJsonNull() && jsonReader.peek() != JsonToken.END_DOCUMENT) { - throw new JsonSyntaxException("Did not consume the entire document."); - } - return element; - } catch (MalformedJsonException e) { - throw new JsonSyntaxException(e); - } catch (IOException e) { - throw new JsonIOException(e); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - - /** - * Returns the next value from the JSON stream as a parse tree. - * - * @throws JsonParseException if there is an IOException or if the specified - * text is not valid JSON - */ - public static JsonElement parseReader(JsonReader reader) - throws JsonIOException, JsonSyntaxException { - boolean lenient = reader.isLenient(); - reader.setLenient(true); - try { - return Streams.parse(reader); - } catch (StackOverflowError e) { - throw new JsonParseException("Failed parsing JSON source: " + reader + " to Json", e); - } catch (OutOfMemoryError e) { - throw new JsonParseException("Failed parsing JSON source: " + reader + " to Json", e); - } finally { - reader.setLenient(lenient); - } - } - - /** @deprecated Use {@link JsonParser#parseString} */ - @Deprecated - public JsonElement parse(String json) throws JsonSyntaxException { - return parseString(json); - } - - /** @deprecated Use {@link JsonParser#parseReader(Reader)} */ - @Deprecated - public JsonElement parse(Reader json) throws JsonIOException, JsonSyntaxException { - return parseReader(json); - } - - /** @deprecated Use {@link JsonParser#parseReader(JsonReader)} */ - @Deprecated - public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException { - return parseReader(json); - } -} diff --git a/minecraft_server/com/google/gson/JsonPrimitive.java b/minecraft_server/com/google/gson/JsonPrimitive.java deleted file mode 100644 index 5e95d5a..0000000 --- a/minecraft_server/com/google/gson/JsonPrimitive.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import com.google.gson.internal.$Gson$Preconditions; -import java.math.BigDecimal; -import java.math.BigInteger; - -import com.google.gson.internal.LazilyParsedNumber; - -/** - * A class representing a Json primitive value. A primitive value - * is either a String, a Java primitive, or a Java primitive - * wrapper type. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public final class JsonPrimitive extends JsonElement { - - private final Object value; - - /** - * Create a primitive containing a boolean value. - * - * @param bool the value to create the primitive with. - */ - public JsonPrimitive(Boolean bool) { - value = $Gson$Preconditions.checkNotNull(bool); - } - - /** - * Create a primitive containing a {@link Number}. - * - * @param number the value to create the primitive with. - */ - public JsonPrimitive(Number number) { - value = $Gson$Preconditions.checkNotNull(number); - } - - /** - * Create a primitive containing a String value. - * - * @param string the value to create the primitive with. - */ - public JsonPrimitive(String string) { - value = $Gson$Preconditions.checkNotNull(string); - } - - /** - * Create a primitive containing a character. The character is turned into a one character String - * since Json only supports String. - * - * @param c the value to create the primitive with. - */ - public JsonPrimitive(Character c) { - // convert characters to strings since in JSON, characters are represented as a single - // character string - value = $Gson$Preconditions.checkNotNull(c).toString(); - } - - /** - * Returns the same value as primitives are immutable. - * @since 2.8.2 - */ - @Override - public JsonPrimitive deepCopy() { - return this; - } - - /** - * Check whether this primitive contains a boolean value. - * - * @return true if this primitive contains a boolean value, false otherwise. - */ - public boolean isBoolean() { - return value instanceof Boolean; - } - - /** - * convenience method to get this element as a boolean value. - * - * @return get this element as a primitive boolean value. - */ - @Override - public boolean getAsBoolean() { - if (isBoolean()) { - return ((Boolean) value).booleanValue(); - } - // Check to see if the value as a String is "true" in any case. - return Boolean.parseBoolean(getAsString()); - } - - /** - * Check whether this primitive contains a Number. - * - * @return true if this primitive contains a Number, false otherwise. - */ - public boolean isNumber() { - return value instanceof Number; - } - - /** - * convenience method to get this element as a Number. - * - * @return get this element as a Number. - * @throws NumberFormatException if the value contained is not a valid Number. - */ - @Override - public Number getAsNumber() { - return value instanceof String ? new LazilyParsedNumber((String) value) : (Number) value; - } - - /** - * Check whether this primitive contains a String value. - * - * @return true if this primitive contains a String value, false otherwise. - */ - public boolean isString() { - return value instanceof String; - } - - /** - * convenience method to get this element as a String. - * - * @return get this element as a String. - */ - @Override - public String getAsString() { - if (isNumber()) { - return getAsNumber().toString(); - } else if (isBoolean()) { - return ((Boolean) value).toString(); - } else { - return (String) value; - } - } - - /** - * convenience method to get this element as a primitive double. - * - * @return get this element as a primitive double. - * @throws NumberFormatException if the value contained is not a valid double. - */ - @Override - public double getAsDouble() { - return isNumber() ? getAsNumber().doubleValue() : Double.parseDouble(getAsString()); - } - - /** - * convenience method to get this element as a {@link BigDecimal}. - * - * @return get this element as a {@link BigDecimal}. - * @throws NumberFormatException if the value contained is not a valid {@link BigDecimal}. - */ - @Override - public BigDecimal getAsBigDecimal() { - return value instanceof BigDecimal ? (BigDecimal) value : new BigDecimal(value.toString()); - } - - /** - * convenience method to get this element as a {@link BigInteger}. - * - * @return get this element as a {@link BigInteger}. - * @throws NumberFormatException if the value contained is not a valid {@link BigInteger}. - */ - @Override - public BigInteger getAsBigInteger() { - return value instanceof BigInteger ? - (BigInteger) value : new BigInteger(value.toString()); - } - - /** - * convenience method to get this element as a float. - * - * @return get this element as a float. - * @throws NumberFormatException if the value contained is not a valid float. - */ - @Override - public float getAsFloat() { - return isNumber() ? getAsNumber().floatValue() : Float.parseFloat(getAsString()); - } - - /** - * convenience method to get this element as a primitive long. - * - * @return get this element as a primitive long. - * @throws NumberFormatException if the value contained is not a valid long. - */ - @Override - public long getAsLong() { - return isNumber() ? getAsNumber().longValue() : Long.parseLong(getAsString()); - } - - /** - * convenience method to get this element as a primitive short. - * - * @return get this element as a primitive short. - * @throws NumberFormatException if the value contained is not a valid short value. - */ - @Override - public short getAsShort() { - return isNumber() ? getAsNumber().shortValue() : Short.parseShort(getAsString()); - } - - /** - * convenience method to get this element as a primitive integer. - * - * @return get this element as a primitive integer. - * @throws NumberFormatException if the value contained is not a valid integer. - */ - @Override - public int getAsInt() { - return isNumber() ? getAsNumber().intValue() : Integer.parseInt(getAsString()); - } - - @Override - public byte getAsByte() { - return isNumber() ? getAsNumber().byteValue() : Byte.parseByte(getAsString()); - } - - @Override - public char getAsCharacter() { - return getAsString().charAt(0); - } - - @Override - public int hashCode() { - if (value == null) { - return 31; - } - // Using recommended hashing algorithm from Effective Java for longs and doubles - if (isIntegral(this)) { - long value = getAsNumber().longValue(); - return (int) (value ^ (value >>> 32)); - } - if (value instanceof Number) { - long value = Double.doubleToLongBits(getAsNumber().doubleValue()); - return (int) (value ^ (value >>> 32)); - } - return value.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - JsonPrimitive other = (JsonPrimitive)obj; - if (value == null) { - return other.value == null; - } - if (isIntegral(this) && isIntegral(other)) { - return getAsNumber().longValue() == other.getAsNumber().longValue(); - } - if (value instanceof Number && other.value instanceof Number) { - double a = getAsNumber().doubleValue(); - // Java standard types other than double return true for two NaN. So, need - // special handling for double. - double b = other.getAsNumber().doubleValue(); - return a == b || (Double.isNaN(a) && Double.isNaN(b)); - } - return value.equals(other.value); - } - - /** - * Returns true if the specified number is an integral type - * (Long, Integer, Short, Byte, BigInteger) - */ - private static boolean isIntegral(JsonPrimitive primitive) { - if (primitive.value instanceof Number) { - Number number = (Number) primitive.value; - return number instanceof BigInteger || number instanceof Long || number instanceof Integer - || number instanceof Short || number instanceof Byte; - } - return false; - } -} diff --git a/minecraft_server/com/google/gson/JsonSerializationContext.java b/minecraft_server/com/google/gson/JsonSerializationContext.java deleted file mode 100644 index ca3ec4f..0000000 --- a/minecraft_server/com/google/gson/JsonSerializationContext.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.lang.reflect.Type; - -/** - * Context for serialization that is passed to a custom serializer during invocation of its - * {@link JsonSerializer#serialize(Object, Type, JsonSerializationContext)} method. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public interface JsonSerializationContext { - - /** - * Invokes default serialization on the specified object. - * - * @param src the object that needs to be serialized. - * @return a tree of {@link JsonElement}s corresponding to the serialized form of {@code src}. - */ - public JsonElement serialize(Object src); - - /** - * Invokes default serialization on the specified object passing the specific type information. - * It should never be invoked on the element received as a parameter of the - * {@link JsonSerializer#serialize(Object, Type, JsonSerializationContext)} method. Doing - * so will result in an infinite loop since Gson will in-turn call the custom serializer again. - * - * @param src the object that needs to be serialized. - * @param typeOfSrc the actual genericized type of src object. - * @return a tree of {@link JsonElement}s corresponding to the serialized form of {@code src}. - */ - public JsonElement serialize(Object src, Type typeOfSrc); -} diff --git a/minecraft_server/com/google/gson/JsonSerializer.java b/minecraft_server/com/google/gson/JsonSerializer.java deleted file mode 100644 index a605003..0000000 --- a/minecraft_server/com/google/gson/JsonSerializer.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.lang.reflect.Type; - -/** - * Interface representing a custom serializer for Json. You should write a custom serializer, if - * you are not happy with the default serialization done by Gson. You will also need to register - * this serializer through {@link com.google.gson.GsonBuilder#registerTypeAdapter(Type, Object)}. - * - *

Let us look at example where defining a serializer will be useful. The {@code Id} class - * defined below has two fields: {@code clazz} and {@code value}.

- * - *

- * public class Id<T> {
- *   private final Class<T> clazz;
- *   private final long value;
- *
- *   public Id(Class<T> clazz, long value) {
- *     this.clazz = clazz;
- *     this.value = value;
- *   }
- *
- *   public long getValue() {
- *     return value;
- *   }
- * }
- * 

- * - *

The default serialization of {@code Id(com.foo.MyObject.class, 20L)} will be - * {"clazz":com.foo.MyObject,"value":20}. Suppose, you just want the output to be - * the value instead, which is {@code 20} in this case. You can achieve that by writing a custom - * serializer:

- * - *

- * class IdSerializer implements JsonSerializer<Id>() {
- *   public JsonElement serialize(Id id, Type typeOfId, JsonSerializationContext context) {
- *     return new JsonPrimitive(id.getValue());
- *   }
- * }
- * 

- * - *

You will also need to register {@code IdSerializer} with Gson as follows:

- *
- * Gson gson = new GsonBuilder().registerTypeAdapter(Id.class, new IdSerializer()).create();
- * 
- * - *

New applications should prefer {@link TypeAdapter}, whose streaming API - * is more efficient than this interface's tree API. - * - * @author Inderjeet Singh - * @author Joel Leitch - * - * @param type for which the serializer is being registered. It is possible that a serializer - * may be asked to serialize a specific generic type of the T. - */ -public interface JsonSerializer { - - /** - * Gson invokes this call-back method during serialization when it encounters a field of the - * specified type. - * - *

In the implementation of this call-back method, you should consider invoking - * {@link JsonSerializationContext#serialize(Object, Type)} method to create JsonElements for any - * non-trivial field of the {@code src} object. However, you should never invoke it on the - * {@code src} object itself since that will cause an infinite loop (Gson will call your - * call-back method again).

- * - * @param src the object that needs to be converted to Json. - * @param typeOfSrc the actual type (fully genericized version) of the source object. - * @return a JsonElement corresponding to the specified object. - */ - public JsonElement serialize(T src, Type typeOfSrc, JsonSerializationContext context); -} diff --git a/minecraft_server/com/google/gson/JsonStreamParser.java b/minecraft_server/com/google/gson/JsonStreamParser.java deleted file mode 100644 index 3707550..0000000 --- a/minecraft_server/com/google/gson/JsonStreamParser.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.gson; - -import java.io.EOFException; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.util.Iterator; -import java.util.NoSuchElementException; - -import com.google.gson.internal.Streams; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.MalformedJsonException; - -/** - * A streaming parser that allows reading of multiple {@link JsonElement}s from the specified reader - * asynchronously. The JSON data is parsed in lenient mode, see also - * {@link JsonReader#setLenient(boolean)}. - * - *

This class is conditionally thread-safe (see Item 70, Effective Java second edition). To - * properly use this class across multiple threads, you will need to add some external - * synchronization. For example: - * - *

- * JsonStreamParser parser = new JsonStreamParser("['first'] {'second':10} 'third'");
- * JsonElement element;
- * synchronized (parser) {  // synchronize on an object shared by threads
- *   if (parser.hasNext()) {
- *     element = parser.next();
- *   }
- * }
- * 
- * - * @author Inderjeet Singh - * @author Joel Leitch - * @since 1.4 - */ -public final class JsonStreamParser implements Iterator { - private final JsonReader parser; - private final Object lock; - - /** - * @param json The string containing JSON elements concatenated to each other. - * @since 1.4 - */ - public JsonStreamParser(String json) { - this(new StringReader(json)); - } - - /** - * @param reader The data stream containing JSON elements concatenated to each other. - * @since 1.4 - */ - public JsonStreamParser(Reader reader) { - parser = new JsonReader(reader); - parser.setLenient(true); - lock = new Object(); - } - - /** - * Returns the next available {@link JsonElement} on the reader. Throws a - * {@link NoSuchElementException} if no element is available. - * - * @return the next available {@code JsonElement} on the reader. - * @throws JsonSyntaxException if the incoming stream is malformed JSON. - * @throws NoSuchElementException if no {@code JsonElement} is available. - * @since 1.4 - */ - public JsonElement next() throws JsonParseException { - if (!hasNext()) { - throw new NoSuchElementException(); - } - - try { - return Streams.parse(parser); - } catch (StackOverflowError e) { - throw new JsonParseException("Failed parsing JSON source to Json", e); - } catch (OutOfMemoryError e) { - throw new JsonParseException("Failed parsing JSON source to Json", e); - } catch (JsonParseException e) { - throw e.getCause() instanceof EOFException ? new NoSuchElementException() : e; - } - } - - /** - * Returns true if a {@link JsonElement} is available on the input for consumption - * @return true if a {@link JsonElement} is available on the input, false otherwise - * @throws JsonSyntaxException if the incoming stream is malformed JSON. - * @since 1.4 - */ - public boolean hasNext() { - synchronized (lock) { - try { - return parser.peek() != JsonToken.END_DOCUMENT; - } catch (MalformedJsonException e) { - throw new JsonSyntaxException(e); - } catch (IOException e) { - throw new JsonIOException(e); - } - } - } - - /** - * This optional {@link Iterator} method is not relevant for stream parsing and hence is not - * implemented. - * @since 1.4 - */ - public void remove() { - throw new UnsupportedOperationException(); - } -} diff --git a/minecraft_server/com/google/gson/JsonSyntaxException.java b/minecraft_server/com/google/gson/JsonSyntaxException.java deleted file mode 100644 index 17c1d3d..0000000 --- a/minecraft_server/com/google/gson/JsonSyntaxException.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.gson; - -/** - * This exception is raised when Gson attempts to read (or write) a malformed - * JSON element. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public final class JsonSyntaxException extends JsonParseException { - - private static final long serialVersionUID = 1L; - - public JsonSyntaxException(String msg) { - super(msg); - } - - public JsonSyntaxException(String msg, Throwable cause) { - super(msg, cause); - } - - /** - * Creates exception with the specified cause. Consider using - * {@link #JsonSyntaxException(String, Throwable)} instead if you can - * describe what actually happened. - * - * @param cause root exception that caused this exception to be thrown. - */ - public JsonSyntaxException(Throwable cause) { - super(cause); - } -} diff --git a/minecraft_server/com/google/gson/LongSerializationPolicy.java b/minecraft_server/com/google/gson/LongSerializationPolicy.java deleted file mode 100644 index 3cc9c72..0000000 --- a/minecraft_server/com/google/gson/LongSerializationPolicy.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -/** - * Defines the expected format for a {@code long} or {@code Long} type when it is serialized. - * - * @since 1.3 - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public enum LongSerializationPolicy { - /** - * This is the "default" serialization policy that will output a {@code Long} object as a JSON - * number. For example, assume an object has a long field named "f" then the serialized output - * would be: - * {@code {"f":123}} - * - *

A {@code null} value is serialized as {@link JsonNull}. - */ - DEFAULT() { - @Override public JsonElement serialize(Long value) { - if (value == null) { - return JsonNull.INSTANCE; - } - return new JsonPrimitive(value); - } - }, - - /** - * Serializes a long value as a quoted string. For example, assume an object has a long field - * named "f" then the serialized output would be: - * {@code {"f":"123"}} - * - *

A {@code null} value is serialized as {@link JsonNull}. - */ - STRING() { - @Override public JsonElement serialize(Long value) { - if (value == null) { - return JsonNull.INSTANCE; - } - return new JsonPrimitive(value.toString()); - } - }; - - /** - * Serialize this {@code value} using this serialization policy. - * - * @param value the long value to be serialized into a {@link JsonElement} - * @return the serialized version of {@code value} - */ - public abstract JsonElement serialize(Long value); -} diff --git a/minecraft_server/com/google/gson/ToNumberPolicy.java b/minecraft_server/com/google/gson/ToNumberPolicy.java deleted file mode 100644 index e7f91c9..0000000 --- a/minecraft_server/com/google/gson/ToNumberPolicy.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.io.IOException; -import java.math.BigDecimal; - -import com.google.gson.internal.LazilyParsedNumber; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.MalformedJsonException; - -/** - * An enumeration that defines two standard number reading strategies and a couple of - * strategies to overcome some historical Gson limitations while deserializing numbers as - * {@link Object} and {@link Number}. - * - * @see ToNumberStrategy - */ -public enum ToNumberPolicy implements ToNumberStrategy { - - /** - * Using this policy will ensure that numbers will be read as {@link Double} values. - * This is the default strategy used during deserialization of numbers as {@link Object}. - */ - DOUBLE { - @Override public Double readNumber(JsonReader in) throws IOException { - return in.nextDouble(); - } - }, - - /** - * Using this policy will ensure that numbers will be read as a lazily parsed number backed - * by a string. This is the default strategy used during deserialization of numbers as - * {@link Number}. - */ - LAZILY_PARSED_NUMBER { - @Override public Number readNumber(JsonReader in) throws IOException { - return new LazilyParsedNumber(in.nextString()); - } - }, - - /** - * Using this policy will ensure that numbers will be read as {@link Long} or {@link Double} - * values depending on how JSON numbers are represented: {@code Long} if the JSON number can - * be parsed as a {@code Long} value, or otherwise {@code Double} if it can be parsed as a - * {@code Double} value. If the parsed double-precision number results in a positive or negative - * infinity ({@link Double#isInfinite()}) or a NaN ({@link Double#isNaN()}) value and the - * {@code JsonReader} is not {@link JsonReader#isLenient() lenient}, a {@link MalformedJsonException} - * is thrown. - */ - LONG_OR_DOUBLE { - @Override public Number readNumber(JsonReader in) throws IOException, JsonParseException { - String value = in.nextString(); - try { - return Long.parseLong(value); - } catch (NumberFormatException longE) { - try { - Double d = Double.valueOf(value); - if ((d.isInfinite() || d.isNaN()) && !in.isLenient()) { - throw new MalformedJsonException("JSON forbids NaN and infinities: " + d + "; at path " + in.getPath()); - } - return d; - } catch (NumberFormatException doubleE) { - throw new JsonParseException("Cannot parse " + value + "; at path " + in.getPath(), doubleE); - } - } - } - }, - - /** - * Using this policy will ensure that numbers will be read as numbers of arbitrary length - * using {@link BigDecimal}. - */ - BIG_DECIMAL { - @Override public BigDecimal readNumber(JsonReader in) throws IOException { - String value = in.nextString(); - try { - return new BigDecimal(value); - } catch (NumberFormatException e) { - throw new JsonParseException("Cannot parse " + value + "; at path " + in.getPath(), e); - } - } - } - -} diff --git a/minecraft_server/com/google/gson/ToNumberStrategy.java b/minecraft_server/com/google/gson/ToNumberStrategy.java deleted file mode 100644 index db42a4e..0000000 --- a/minecraft_server/com/google/gson/ToNumberStrategy.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import java.io.IOException; - -import com.google.gson.stream.JsonReader; - -/** - * A strategy that is used to control how numbers should be deserialized for {@link Object} and {@link Number} - * when a concrete type of the deserialized number is unknown in advance. By default, Gson uses the following - * deserialization strategies: - * - *

    - *
  • {@link Double} values are returned for JSON numbers if the deserialization type is declared as - * {@code Object}, see {@link ToNumberPolicy#DOUBLE};
  • - *
  • Lazily parsed number values are returned if the deserialization type is declared as {@code Number}, - * see {@link ToNumberPolicy#LAZILY_PARSED_NUMBER}.
  • - *
- * - *

For historical reasons, Gson does not support deserialization of arbitrary-length numbers for - * {@code Object} and {@code Number} by default, potentially causing precision loss. However, - * RFC 8259 permits this: - * - *

- *   This specification allows implementations to set limits on the range
- *   and precision of numbers accepted.  Since software that implements
- *   IEEE 754 binary64 (double precision) numbers [IEEE754] is generally
- *   available and widely used, good interoperability can be achieved by
- *   implementations that expect no more precision or range than these
- *   provide, in the sense that implementations will approximate JSON
- *   numbers within the expected precision.  A JSON number such as 1E400
- *   or 3.141592653589793238462643383279 may indicate potential
- *   interoperability problems, since it suggests that the software that
- *   created it expects receiving software to have greater capabilities
- *   for numeric magnitude and precision than is widely available.
- * 
- * - *

To overcome the precision loss, use for example {@link ToNumberPolicy#LONG_OR_DOUBLE} or - * {@link ToNumberPolicy#BIG_DECIMAL}.

- * - * @see ToNumberPolicy - * @see GsonBuilder#setObjectToNumberStrategy(ToNumberStrategy) - * @see GsonBuilder#setNumberToNumberStrategy(ToNumberStrategy) - */ -public interface ToNumberStrategy { - - /** - * Reads a number from the given JSON reader. A strategy is supposed to read a single value from the - * reader, and the read value is guaranteed never to be {@code null}. - * - * @param in JSON reader to read a number from - * @return number read from the JSON reader. - * @throws IOException - */ - public Number readNumber(JsonReader in) throws IOException; -} diff --git a/minecraft_server/com/google/gson/TypeAdapter.java b/minecraft_server/com/google/gson/TypeAdapter.java deleted file mode 100644 index 4646d27..0000000 --- a/minecraft_server/com/google/gson/TypeAdapter.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import com.google.gson.internal.bind.JsonTreeWriter; -import com.google.gson.internal.bind.JsonTreeReader; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; - -/** - * Converts Java objects to and from JSON. - * - *

Defining a type's JSON form

- * By default Gson converts application classes to JSON using its built-in type - * adapters. If Gson's default JSON conversion isn't appropriate for a type, - * extend this class to customize the conversion. Here's an example of a type - * adapter for an (X,Y) coordinate point:
   {@code
- *
- *   public class PointAdapter extends TypeAdapter {
- *     public Point read(JsonReader reader) throws IOException {
- *       if (reader.peek() == JsonToken.NULL) {
- *         reader.nextNull();
- *         return null;
- *       }
- *       String xy = reader.nextString();
- *       String[] parts = xy.split(",");
- *       int x = Integer.parseInt(parts[0]);
- *       int y = Integer.parseInt(parts[1]);
- *       return new Point(x, y);
- *     }
- *     public void write(JsonWriter writer, Point value) throws IOException {
- *       if (value == null) {
- *         writer.nullValue();
- *         return;
- *       }
- *       String xy = value.getX() + "," + value.getY();
- *       writer.value(xy);
- *     }
- *   }}
- * With this type adapter installed, Gson will convert {@code Points} to JSON as - * strings like {@code "5,8"} rather than objects like {@code {"x":5,"y":8}}. In - * this case the type adapter binds a rich Java class to a compact JSON value. - * - *

The {@link #read(JsonReader) read()} method must read exactly one value - * and {@link #write(JsonWriter,Object) write()} must write exactly one value. - * For primitive types this is means readers should make exactly one call to - * {@code nextBoolean()}, {@code nextDouble()}, {@code nextInt()}, {@code - * nextLong()}, {@code nextString()} or {@code nextNull()}. Writers should make - * exactly one call to one of value() or nullValue(). - * For arrays, type adapters should start with a call to {@code beginArray()}, - * convert all elements, and finish with a call to {@code endArray()}. For - * objects, they should start with {@code beginObject()}, convert the object, - * and finish with {@code endObject()}. Failing to convert a value or converting - * too many values may cause the application to crash. - * - *

Type adapters should be prepared to read null from the stream and write it - * to the stream. Alternatively, they should use {@link #nullSafe()} method while - * registering the type adapter with Gson. If your {@code Gson} instance - * has been configured to {@link GsonBuilder#serializeNulls()}, these nulls will be - * written to the final document. Otherwise the value (and the corresponding name - * when writing to a JSON object) will be omitted automatically. In either case - * your type adapter must handle null. - * - *

To use a custom type adapter with Gson, you must register it with a - * {@link GsonBuilder}:

   {@code
- *
- *   GsonBuilder builder = new GsonBuilder();
- *   builder.registerTypeAdapter(Point.class, new PointAdapter());
- *   // if PointAdapter didn't check for nulls in its read/write methods, you should instead use
- *   // builder.registerTypeAdapter(Point.class, new PointAdapter().nullSafe());
- *   ...
- *   Gson gson = builder.create();
- * }
- * - * @since 2.1 - */ -// non-Javadoc: -// -//

JSON Conversion

-//

A type adapter registered with Gson is automatically invoked while serializing -// or deserializing JSON. However, you can also use type adapters directly to serialize -// and deserialize JSON. Here is an example for deserialization:

   {@code
-//
-//   String json = "{'origin':'0,0','points':['1,2','3,4']}";
-//   TypeAdapter graphAdapter = gson.getAdapter(Graph.class);
-//   Graph graph = graphAdapter.fromJson(json);
-// }
-// And an example for serialization:
   {@code
-//
-//   Graph graph = new Graph(...);
-//   TypeAdapter graphAdapter = gson.getAdapter(Graph.class);
-//   String json = graphAdapter.toJson(graph);
-// }
-// -//

Type adapters are type-specific. For example, a {@code -// TypeAdapter} can convert {@code Date} instances to JSON and JSON to -// instances of {@code Date}, but cannot convert any other types. -// -public abstract class TypeAdapter { - - /** - * Writes one JSON value (an array, object, string, number, boolean or null) - * for {@code value}. - * - * @param value the Java object to write. May be null. - */ - public abstract void write(JsonWriter out, T value) throws IOException; - - /** - * Converts {@code value} to a JSON document and writes it to {@code out}. - * Unlike Gson's similar {@link Gson#toJson(JsonElement, Appendable) toJson} - * method, this write is strict. Create a {@link - * JsonWriter#setLenient(boolean) lenient} {@code JsonWriter} and call - * {@link #write(com.google.gson.stream.JsonWriter, Object)} for lenient - * writing. - * - * @param value the Java object to convert. May be null. - * @since 2.2 - */ - public final void toJson(Writer out, T value) throws IOException { - JsonWriter writer = new JsonWriter(out); - write(writer, value); - } - - /** - * This wrapper method is used to make a type adapter null tolerant. In general, a - * type adapter is required to handle nulls in write and read methods. Here is how this - * is typically done:
- *

   {@code
-   *
-   * Gson gson = new GsonBuilder().registerTypeAdapter(Foo.class,
-   *   new TypeAdapter() {
-   *     public Foo read(JsonReader in) throws IOException {
-   *       if (in.peek() == JsonToken.NULL) {
-   *         in.nextNull();
-   *         return null;
-   *       }
-   *       // read a Foo from in and return it
-   *     }
-   *     public void write(JsonWriter out, Foo src) throws IOException {
-   *       if (src == null) {
-   *         out.nullValue();
-   *         return;
-   *       }
-   *       // write src as JSON to out
-   *     }
-   *   }).create();
-   * }
- * You can avoid this boilerplate handling of nulls by wrapping your type adapter with - * this method. Here is how we will rewrite the above example: - *
   {@code
-   *
-   * Gson gson = new GsonBuilder().registerTypeAdapter(Foo.class,
-   *   new TypeAdapter() {
-   *     public Foo read(JsonReader in) throws IOException {
-   *       // read a Foo from in and return it
-   *     }
-   *     public void write(JsonWriter out, Foo src) throws IOException {
-   *       // write src as JSON to out
-   *     }
-   *   }.nullSafe()).create();
-   * }
- * Note that we didn't need to check for nulls in our type adapter after we used nullSafe. - */ - public final TypeAdapter nullSafe() { - return new TypeAdapter() { - @Override public void write(JsonWriter out, T value) throws IOException { - if (value == null) { - out.nullValue(); - } else { - TypeAdapter.this.write(out, value); - } - } - @Override public T read(JsonReader reader) throws IOException { - if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); - return null; - } - return TypeAdapter.this.read(reader); - } - }; - } - - /** - * Converts {@code value} to a JSON document. Unlike Gson's similar {@link - * Gson#toJson(Object) toJson} method, this write is strict. Create a {@link - * JsonWriter#setLenient(boolean) lenient} {@code JsonWriter} and call - * {@link #write(com.google.gson.stream.JsonWriter, Object)} for lenient - * writing. - * - * @param value the Java object to convert. May be null. - * @since 2.2 - */ - public final String toJson(T value) { - StringWriter stringWriter = new StringWriter(); - try { - toJson(stringWriter, value); - } catch (IOException e) { - throw new AssertionError(e); // No I/O writing to a StringWriter. - } - return stringWriter.toString(); - } - - /** - * Converts {@code value} to a JSON tree. - * - * @param value the Java object to convert. May be null. - * @return the converted JSON tree. May be {@link JsonNull}. - * @since 2.2 - */ - public final JsonElement toJsonTree(T value) { - try { - JsonTreeWriter jsonWriter = new JsonTreeWriter(); - write(jsonWriter, value); - return jsonWriter.get(); - } catch (IOException e) { - throw new JsonIOException(e); - } - } - - /** - * Reads one JSON value (an array, object, string, number, boolean or null) - * and converts it to a Java object. Returns the converted object. - * - * @return the converted Java object. May be null. - */ - public abstract T read(JsonReader in) throws IOException; - - /** - * Converts the JSON document in {@code in} to a Java object. Unlike Gson's - * similar {@link Gson#fromJson(java.io.Reader, Class) fromJson} method, this - * read is strict. Create a {@link JsonReader#setLenient(boolean) lenient} - * {@code JsonReader} and call {@link #read(JsonReader)} for lenient reading. - * - * @return the converted Java object. May be null. - * @since 2.2 - */ - public final T fromJson(Reader in) throws IOException { - JsonReader reader = new JsonReader(in); - return read(reader); - } - - /** - * Converts the JSON document in {@code json} to a Java object. Unlike Gson's - * similar {@link Gson#fromJson(String, Class) fromJson} method, this read is - * strict. Create a {@link JsonReader#setLenient(boolean) lenient} {@code - * JsonReader} and call {@link #read(JsonReader)} for lenient reading. - * - * @return the converted Java object. May be null. - * @since 2.2 - */ - public final T fromJson(String json) throws IOException { - return fromJson(new StringReader(json)); - } - - /** - * Converts {@code jsonTree} to a Java object. - * - * @param jsonTree the Java object to convert. May be {@link JsonNull}. - * @since 2.2 - */ - public final T fromJsonTree(JsonElement jsonTree) { - try { - JsonReader jsonReader = new JsonTreeReader(jsonTree); - return read(jsonReader); - } catch (IOException e) { - throw new JsonIOException(e); - } - } -} diff --git a/minecraft_server/com/google/gson/TypeAdapterFactory.java b/minecraft_server/com/google/gson/TypeAdapterFactory.java deleted file mode 100644 index e12a72d..0000000 --- a/minecraft_server/com/google/gson/TypeAdapterFactory.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson; - -import com.google.gson.reflect.TypeToken; - -/** - * Creates type adapters for set of related types. Type adapter factories are - * most useful when several types share similar structure in their JSON form. - * - *

Example: Converting enums to lowercase

- * In this example, we implement a factory that creates type adapters for all - * enums. The type adapters will write enums in lowercase, despite the fact - * that they're defined in {@code CONSTANT_CASE} in the corresponding Java - * model:
   {@code
- *
- *   public class LowercaseEnumTypeAdapterFactory implements TypeAdapterFactory {
- *     public  TypeAdapter create(Gson gson, TypeToken type) {
- *       Class rawType = (Class) type.getRawType();
- *       if (!rawType.isEnum()) {
- *         return null;
- *       }
- *
- *       final Map lowercaseToConstant = new HashMap();
- *       for (T constant : rawType.getEnumConstants()) {
- *         lowercaseToConstant.put(toLowercase(constant), constant);
- *       }
- *
- *       return new TypeAdapter() {
- *         public void write(JsonWriter out, T value) throws IOException {
- *           if (value == null) {
- *             out.nullValue();
- *           } else {
- *             out.value(toLowercase(value));
- *           }
- *         }
- *
- *         public T read(JsonReader reader) throws IOException {
- *           if (reader.peek() == JsonToken.NULL) {
- *             reader.nextNull();
- *             return null;
- *           } else {
- *             return lowercaseToConstant.get(reader.nextString());
- *           }
- *         }
- *       };
- *     }
- *
- *     private String toLowercase(Object o) {
- *       return o.toString().toLowerCase(Locale.US);
- *     }
- *   }
- * }
- * - *

Type adapter factories select which types they provide type adapters - * for. If a factory cannot support a given type, it must return null when - * that type is passed to {@link #create}. Factories should expect {@code - * create()} to be called on them for many types and should return null for - * most of those types. In the above example the factory returns null for - * calls to {@code create()} where {@code type} is not an enum. - * - *

A factory is typically called once per type, but the returned type - * adapter may be used many times. It is most efficient to do expensive work - * like reflection in {@code create()} so that the type adapter's {@code - * read()} and {@code write()} methods can be very fast. In this example the - * mapping from lowercase name to enum value is computed eagerly. - * - *

As with type adapters, factories must be registered with a {@link - * com.google.gson.GsonBuilder} for them to take effect:

   {@code
- *
- *  GsonBuilder builder = new GsonBuilder();
- *  builder.registerTypeAdapterFactory(new LowercaseEnumTypeAdapterFactory());
- *  ...
- *  Gson gson = builder.create();
- * }
- * If multiple factories support the same type, the factory registered earlier - * takes precedence. - * - *

Example: composing other type adapters

- * In this example we implement a factory for Guava's {@code Multiset} - * collection type. The factory can be used to create type adapters for - * multisets of any element type: the type adapter for {@code - * Multiset} is different from the type adapter for {@code - * Multiset}. - * - *

The type adapter delegates to another type adapter for the - * multiset elements. It figures out the element type by reflecting on the - * multiset's type token. A {@code Gson} is passed in to {@code create} for - * just this purpose:

   {@code
- *
- *   public class MultisetTypeAdapterFactory implements TypeAdapterFactory {
- *     public  TypeAdapter create(Gson gson, TypeToken typeToken) {
- *       Type type = typeToken.getType();
- *       if (typeToken.getRawType() != Multiset.class
- *           || !(type instanceof ParameterizedType)) {
- *         return null;
- *       }
- *
- *       Type elementType = ((ParameterizedType) type).getActualTypeArguments()[0];
- *       TypeAdapter elementAdapter = gson.getAdapter(TypeToken.get(elementType));
- *       return (TypeAdapter) newMultisetAdapter(elementAdapter);
- *     }
- *
- *     private  TypeAdapter> newMultisetAdapter(
- *         final TypeAdapter elementAdapter) {
- *       return new TypeAdapter>() {
- *         public void write(JsonWriter out, Multiset value) throws IOException {
- *           if (value == null) {
- *             out.nullValue();
- *             return;
- *           }
- *
- *           out.beginArray();
- *           for (Multiset.Entry entry : value.entrySet()) {
- *             out.value(entry.getCount());
- *             elementAdapter.write(out, entry.getElement());
- *           }
- *           out.endArray();
- *         }
- *
- *         public Multiset read(JsonReader in) throws IOException {
- *           if (in.peek() == JsonToken.NULL) {
- *             in.nextNull();
- *             return null;
- *           }
- *
- *           Multiset result = LinkedHashMultiset.create();
- *           in.beginArray();
- *           while (in.hasNext()) {
- *             int count = in.nextInt();
- *             E element = elementAdapter.read(in);
- *             result.add(element, count);
- *           }
- *           in.endArray();
- *           return result;
- *         }
- *       };
- *     }
- *   }
- * }
- * Delegating from one type adapter to another is extremely powerful; it's - * the foundation of how Gson converts Java objects and collections. Whenever - * possible your factory should retrieve its delegate type adapter in the - * {@code create()} method; this ensures potentially-expensive type adapter - * creation happens only once. - * - * @since 2.1 - */ -public interface TypeAdapterFactory { - - /** - * Returns a type adapter for {@code type}, or null if this factory doesn't - * support {@code type}. - */ - TypeAdapter create(Gson gson, TypeToken type); -} diff --git a/minecraft_server/com/google/gson/annotations/Expose.java b/minecraft_server/com/google/gson/annotations/Expose.java deleted file mode 100644 index 19a9297..0000000 --- a/minecraft_server/com/google/gson/annotations/Expose.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * An annotation that indicates this member should be exposed for JSON - * serialization or deserialization. - * - *

This annotation has no effect unless you build {@link com.google.gson.Gson} - * with a {@link com.google.gson.GsonBuilder} and invoke - * {@link com.google.gson.GsonBuilder#excludeFieldsWithoutExposeAnnotation()} - * method.

- * - *

Here is an example of how this annotation is meant to be used: - *

- * public class User {
- *   @Expose private String firstName;
- *   @Expose(serialize = false) private String lastName;
- *   @Expose (serialize = false, deserialize = false) private String emailAddress;
- *   private String password;
- * }
- * 

- * If you created Gson with {@code new Gson()}, the {@code toJson()} and {@code fromJson()} - * methods will use the {@code password} field along-with {@code firstName}, {@code lastName}, - * and {@code emailAddress} for serialization and deserialization. However, if you created Gson - * with {@code Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create()} - * then the {@code toJson()} and {@code fromJson()} methods of Gson will exclude the - * {@code password} field. This is because the {@code password} field is not marked with the - * {@code @Expose} annotation. Gson will also exclude {@code lastName} and {@code emailAddress} - * from serialization since {@code serialize} is set to {@code false}. Similarly, Gson will - * exclude {@code emailAddress} from deserialization since {@code deserialize} is set to false. - * - *

Note that another way to achieve the same effect would have been to just mark the - * {@code password} field as {@code transient}, and Gson would have excluded it even with default - * settings. The {@code @Expose} annotation is useful in a style of programming where you want to - * explicitly specify all fields that should get considered for serialization or deserialization. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface Expose { - - /** - * If {@code true}, the field marked with this annotation is written out in the JSON while - * serializing. If {@code false}, the field marked with this annotation is skipped from the - * serialized output. Defaults to {@code true}. - * @since 1.4 - */ - public boolean serialize() default true; - - /** - * If {@code true}, the field marked with this annotation is deserialized from the JSON. - * If {@code false}, the field marked with this annotation is skipped during deserialization. - * Defaults to {@code true}. - * @since 1.4 - */ - public boolean deserialize() default true; -} diff --git a/minecraft_server/com/google/gson/annotations/JsonAdapter.java b/minecraft_server/com/google/gson/annotations/JsonAdapter.java deleted file mode 100644 index a01d77a..0000000 --- a/minecraft_server/com/google/gson/annotations/JsonAdapter.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2014 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.annotations; - -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonSerializer; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * An annotation that indicates the Gson {@link TypeAdapter} to use with a class - * or field. - * - *

Here is an example of how this annotation is used:

- *
- * @JsonAdapter(UserJsonAdapter.class)
- * public class User {
- *   public final String firstName, lastName;
- *   private User(String firstName, String lastName) {
- *     this.firstName = firstName;
- *     this.lastName = lastName;
- *   }
- * }
- * public class UserJsonAdapter extends TypeAdapter<User> {
- *   @Override public void write(JsonWriter out, User user) throws IOException {
- *     // implement write: combine firstName and lastName into name
- *     out.beginObject();
- *     out.name("name");
- *     out.value(user.firstName + " " + user.lastName);
- *     out.endObject();
- *     // implement the write method
- *   }
- *   @Override public User read(JsonReader in) throws IOException {
- *     // implement read: split name into firstName and lastName
- *     in.beginObject();
- *     in.nextName();
- *     String[] nameParts = in.nextString().split(" ");
- *     in.endObject();
- *     return new User(nameParts[0], nameParts[1]);
- *   }
- * }
- * 
- * - * Since User class specified UserJsonAdapter.class in @JsonAdapter annotation, it - * will automatically be invoked to serialize/deserialize User instances.
- * - *

Here is an example of how to apply this annotation to a field. - *

- * private static final class Gadget {
- *   @JsonAdapter(UserJsonAdapter2.class)
- *   final User user;
- *   Gadget(User user) {
- *     this.user = user;
- *   }
- * }
- * 
- * - * It's possible to specify different type adapters on a field, that - * field's type, and in the {@link com.google.gson.GsonBuilder}. Field - * annotations take precedence over {@code GsonBuilder}-registered type - * adapters, which in turn take precedence over annotated types. - * - *

The class referenced by this annotation must be either a {@link - * TypeAdapter} or a {@link TypeAdapterFactory}, or must implement one - * or both of {@link JsonDeserializer} or {@link JsonSerializer}. - * Using {@link TypeAdapterFactory} makes it possible to delegate - * to the enclosing {@code Gson} instance. - * - * @since 2.3 - * - * @author Inderjeet Singh - * @author Joel Leitch - * @author Jesse Wilson - */ -// Note that the above example is taken from AdaptAnnotationTest. -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE, ElementType.FIELD}) -public @interface JsonAdapter { - - /** Either a {@link TypeAdapter} or {@link TypeAdapterFactory}, or one or both of {@link JsonDeserializer} or {@link JsonSerializer}. */ - Class value(); - - /** false, to be able to handle {@code null} values within the adapter, default value is true. */ - boolean nullSafe() default true; - -} diff --git a/minecraft_server/com/google/gson/annotations/SerializedName.java b/minecraft_server/com/google/gson/annotations/SerializedName.java deleted file mode 100644 index e50ad55..0000000 --- a/minecraft_server/com/google/gson/annotations/SerializedName.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * An annotation that indicates this member should be serialized to JSON with - * the provided name value as its field name. - * - *

This annotation will override any {@link com.google.gson.FieldNamingPolicy}, including - * the default field naming policy, that may have been set on the {@link com.google.gson.Gson} - * instance. A different naming policy can set using the {@code GsonBuilder} class. See - * {@link com.google.gson.GsonBuilder#setFieldNamingPolicy(com.google.gson.FieldNamingPolicy)} - * for more information.

- * - *

Here is an example of how this annotation is meant to be used:

- *
- * public class MyClass {
- *   @SerializedName("name") String a;
- *   @SerializedName(value="name1", alternate={"name2", "name3"}) String b;
- *   String c;
- *
- *   public MyClass(String a, String b, String c) {
- *     this.a = a;
- *     this.b = b;
- *     this.c = c;
- *   }
- * }
- * 
- * - *

The following shows the output that is generated when serializing an instance of the - * above example class:

- *
- * MyClass target = new MyClass("v1", "v2", "v3");
- * Gson gson = new Gson();
- * String json = gson.toJson(target);
- * System.out.println(json);
- *
- * ===== OUTPUT =====
- * {"name":"v1","name1":"v2","c":"v3"}
- * 
- * - *

NOTE: The value you specify in this annotation must be a valid JSON field name.

- * While deserializing, all values specified in the annotation will be deserialized into the field. - * For example: - *
- *   MyClass target = gson.fromJson("{'name1':'v1'}", MyClass.class);
- *   assertEquals("v1", target.b);
- *   target = gson.fromJson("{'name2':'v2'}", MyClass.class);
- *   assertEquals("v2", target.b);
- *   target = gson.fromJson("{'name3':'v3'}", MyClass.class);
- *   assertEquals("v3", target.b);
- * 
- * Note that MyClass.b is now deserialized from either name1, name2 or name3. - * - * @see com.google.gson.FieldNamingPolicy - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD, ElementType.METHOD}) -public @interface SerializedName { - - /** - * @return the desired name of the field when it is serialized or deserialized - */ - String value(); - /** - * @return the alternative names of the field when it is deserialized - */ - String[] alternate() default {}; -} diff --git a/minecraft_server/com/google/gson/annotations/Since.java b/minecraft_server/com/google/gson/annotations/Since.java deleted file mode 100644 index e23b6ec..0000000 --- a/minecraft_server/com/google/gson/annotations/Since.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * An annotation that indicates the version number since a member or a type has been present. - * This annotation is useful to manage versioning of your Json classes for a web-service. - * - *

- * This annotation has no effect unless you build {@link com.google.gson.Gson} with a - * {@link com.google.gson.GsonBuilder} and invoke - * {@link com.google.gson.GsonBuilder#setVersion(double)} method. - * - *

Here is an example of how this annotation is meant to be used:

- *
- * public class User {
- *   private String firstName;
- *   private String lastName;
- *   @Since(1.0) private String emailAddress;
- *   @Since(1.0) private String password;
- *   @Since(1.1) private Address address;
- * }
- * 
- * - *

If you created Gson with {@code new Gson()}, the {@code toJson()} and {@code fromJson()} - * methods will use all the fields for serialization and deserialization. However, if you created - * Gson with {@code Gson gson = new GsonBuilder().setVersion(1.0).create()} then the - * {@code toJson()} and {@code fromJson()} methods of Gson will exclude the {@code address} field - * since it's version number is set to {@code 1.1}.

- * - * @author Inderjeet Singh - * @author Joel Leitch - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD, ElementType.TYPE}) -public @interface Since { - /** - * the value indicating a version number since this member - * or type has been present. - */ - double value(); -} diff --git a/minecraft_server/com/google/gson/annotations/Until.java b/minecraft_server/com/google/gson/annotations/Until.java deleted file mode 100644 index 7c61d10..0000000 --- a/minecraft_server/com/google/gson/annotations/Until.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * An annotation that indicates the version number until a member or a type should be present. - * Basically, if Gson is created with a version number that exceeds the value stored in the - * {@code Until} annotation then the field will be ignored from the JSON output. This annotation - * is useful to manage versioning of your JSON classes for a web-service. - * - *

- * This annotation has no effect unless you build {@link com.google.gson.Gson} with a - * {@link com.google.gson.GsonBuilder} and invoke - * {@link com.google.gson.GsonBuilder#setVersion(double)} method. - * - *

Here is an example of how this annotation is meant to be used:

- *
- * public class User {
- *   private String firstName;
- *   private String lastName;
- *   @Until(1.1) private String emailAddress;
- *   @Until(1.1) private String password;
- * }
- * 
- * - *

If you created Gson with {@code new Gson()}, the {@code toJson()} and {@code fromJson()} - * methods will use all the fields for serialization and deserialization. However, if you created - * Gson with {@code Gson gson = new GsonBuilder().setVersion(1.2).create()} then the - * {@code toJson()} and {@code fromJson()} methods of Gson will exclude the {@code emailAddress} - * and {@code password} fields from the example above, because the version number passed to the - * GsonBuilder, {@code 1.2}, exceeds the version number set on the {@code Until} annotation, - * {@code 1.1}, for those fields. - * - * @author Inderjeet Singh - * @author Joel Leitch - * @since 1.3 - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD, ElementType.TYPE}) -public @interface Until { - - /** - * the value indicating a version number until this member - * or type should be ignored. - */ - double value(); -} diff --git a/minecraft_server/com/google/gson/annotations/package-info.java b/minecraft_server/com/google/gson/annotations/package-info.java deleted file mode 100644 index 1c461fd..0000000 --- a/minecraft_server/com/google/gson/annotations/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * This package provides annotations that can be used with {@link com.google.gson.Gson}. - * - * @author Inderjeet Singh, Joel Leitch - */ -package com.google.gson.annotations; \ No newline at end of file diff --git a/minecraft_server/com/google/gson/internal/$Gson$Preconditions.java b/minecraft_server/com/google/gson/internal/$Gson$Preconditions.java deleted file mode 100644 index 83e5730..0000000 --- a/minecraft_server/com/google/gson/internal/$Gson$Preconditions.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -/** - * A simple utility class used to check method Preconditions. - * - *

- * public long divideBy(long value) {
- *   Preconditions.checkArgument(value != 0);
- *   return this.value / value;
- * }
- * 
- * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public final class $Gson$Preconditions { - private $Gson$Preconditions() { - throw new UnsupportedOperationException(); - } - - public static T checkNotNull(T obj) { - if (obj == null) { - throw new NullPointerException(); - } - return obj; - } - - public static void checkArgument(boolean condition) { - if (!condition) { - throw new IllegalArgumentException(); - } - } -} diff --git a/minecraft_server/com/google/gson/internal/$Gson$Types.java b/minecraft_server/com/google/gson/internal/$Gson$Types.java deleted file mode 100644 index 617a644..0000000 --- a/minecraft_server/com/google/gson/internal/$Gson$Types.java +++ /dev/null @@ -1,634 +0,0 @@ -/** - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -import java.io.Serializable; -import java.lang.reflect.Array; -import java.lang.reflect.GenericArrayType; -import java.lang.reflect.GenericDeclaration; -import java.lang.reflect.Modifier; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.lang.reflect.WildcardType; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Properties; - -import static com.google.gson.internal.$Gson$Preconditions.checkArgument; -import static com.google.gson.internal.$Gson$Preconditions.checkNotNull; - -/** - * Static methods for working with types. - * - * @author Bob Lee - * @author Jesse Wilson - */ -public final class $Gson$Types { - static final Type[] EMPTY_TYPE_ARRAY = new Type[] {}; - - private $Gson$Types() { - throw new UnsupportedOperationException(); - } - - /** - * Returns a new parameterized type, applying {@code typeArguments} to - * {@code rawType} and enclosed by {@code ownerType}. - * - * @return a {@link java.io.Serializable serializable} parameterized type. - */ - public static ParameterizedType newParameterizedTypeWithOwner( - Type ownerType, Type rawType, Type... typeArguments) { - return new ParameterizedTypeImpl(ownerType, rawType, typeArguments); - } - - /** - * Returns an array type whose elements are all instances of - * {@code componentType}. - * - * @return a {@link java.io.Serializable serializable} generic array type. - */ - public static GenericArrayType arrayOf(Type componentType) { - return new GenericArrayTypeImpl(componentType); - } - - /** - * Returns a type that represents an unknown type that extends {@code bound}. - * For example, if {@code bound} is {@code CharSequence.class}, this returns - * {@code ? extends CharSequence}. If {@code bound} is {@code Object.class}, - * this returns {@code ?}, which is shorthand for {@code ? extends Object}. - */ - public static WildcardType subtypeOf(Type bound) { - Type[] upperBounds; - if (bound instanceof WildcardType) { - upperBounds = ((WildcardType) bound).getUpperBounds(); - } else { - upperBounds = new Type[] { bound }; - } - return new WildcardTypeImpl(upperBounds, EMPTY_TYPE_ARRAY); - } - - /** - * Returns a type that represents an unknown supertype of {@code bound}. For - * example, if {@code bound} is {@code String.class}, this returns {@code ? - * super String}. - */ - public static WildcardType supertypeOf(Type bound) { - Type[] lowerBounds; - if (bound instanceof WildcardType) { - lowerBounds = ((WildcardType) bound).getLowerBounds(); - } else { - lowerBounds = new Type[] { bound }; - } - return new WildcardTypeImpl(new Type[] { Object.class }, lowerBounds); - } - - /** - * Returns a type that is functionally equal but not necessarily equal - * according to {@link Object#equals(Object) Object.equals()}. The returned - * type is {@link java.io.Serializable}. - */ - public static Type canonicalize(Type type) { - if (type instanceof Class) { - Class c = (Class) type; - return c.isArray() ? new GenericArrayTypeImpl(canonicalize(c.getComponentType())) : c; - - } else if (type instanceof ParameterizedType) { - ParameterizedType p = (ParameterizedType) type; - return new ParameterizedTypeImpl(p.getOwnerType(), - p.getRawType(), p.getActualTypeArguments()); - - } else if (type instanceof GenericArrayType) { - GenericArrayType g = (GenericArrayType) type; - return new GenericArrayTypeImpl(g.getGenericComponentType()); - - } else if (type instanceof WildcardType) { - WildcardType w = (WildcardType) type; - return new WildcardTypeImpl(w.getUpperBounds(), w.getLowerBounds()); - - } else { - // type is either serializable as-is or unsupported - return type; - } - } - - public static Class getRawType(Type type) { - if (type instanceof Class) { - // type is a normal class. - return (Class) type; - - } else if (type instanceof ParameterizedType) { - ParameterizedType parameterizedType = (ParameterizedType) type; - - // I'm not exactly sure why getRawType() returns Type instead of Class. - // Neal isn't either but suspects some pathological case related - // to nested classes exists. - Type rawType = parameterizedType.getRawType(); - checkArgument(rawType instanceof Class); - return (Class) rawType; - - } else if (type instanceof GenericArrayType) { - Type componentType = ((GenericArrayType)type).getGenericComponentType(); - return Array.newInstance(getRawType(componentType), 0).getClass(); - - } else if (type instanceof TypeVariable) { - // we could use the variable's bounds, but that won't work if there are multiple. - // having a raw type that's more general than necessary is okay - return Object.class; - - } else if (type instanceof WildcardType) { - return getRawType(((WildcardType) type).getUpperBounds()[0]); - - } else { - String className = type == null ? "null" : type.getClass().getName(); - throw new IllegalArgumentException("Expected a Class, ParameterizedType, or " - + "GenericArrayType, but <" + type + "> is of type " + className); - } - } - - static boolean equal(Object a, Object b) { - return a == b || (a != null && a.equals(b)); - } - - /** - * Returns true if {@code a} and {@code b} are equal. - */ - public static boolean equals(Type a, Type b) { - if (a == b) { - // also handles (a == null && b == null) - return true; - - } else if (a instanceof Class) { - // Class already specifies equals(). - return a.equals(b); - - } else if (a instanceof ParameterizedType) { - if (!(b instanceof ParameterizedType)) { - return false; - } - - // TODO: save a .clone() call - ParameterizedType pa = (ParameterizedType) a; - ParameterizedType pb = (ParameterizedType) b; - return equal(pa.getOwnerType(), pb.getOwnerType()) - && pa.getRawType().equals(pb.getRawType()) - && Arrays.equals(pa.getActualTypeArguments(), pb.getActualTypeArguments()); - - } else if (a instanceof GenericArrayType) { - if (!(b instanceof GenericArrayType)) { - return false; - } - - GenericArrayType ga = (GenericArrayType) a; - GenericArrayType gb = (GenericArrayType) b; - return equals(ga.getGenericComponentType(), gb.getGenericComponentType()); - - } else if (a instanceof WildcardType) { - if (!(b instanceof WildcardType)) { - return false; - } - - WildcardType wa = (WildcardType) a; - WildcardType wb = (WildcardType) b; - return Arrays.equals(wa.getUpperBounds(), wb.getUpperBounds()) - && Arrays.equals(wa.getLowerBounds(), wb.getLowerBounds()); - - } else if (a instanceof TypeVariable) { - if (!(b instanceof TypeVariable)) { - return false; - } - TypeVariable va = (TypeVariable) a; - TypeVariable vb = (TypeVariable) b; - return va.getGenericDeclaration() == vb.getGenericDeclaration() - && va.getName().equals(vb.getName()); - - } else { - // This isn't a type we support. Could be a generic array type, wildcard type, etc. - return false; - } - } - - static int hashCodeOrZero(Object o) { - return o != null ? o.hashCode() : 0; - } - - public static String typeToString(Type type) { - return type instanceof Class ? ((Class) type).getName() : type.toString(); - } - - /** - * Returns the generic supertype for {@code supertype}. For example, given a class {@code - * IntegerSet}, the result for when supertype is {@code Set.class} is {@code Set} and the - * result when the supertype is {@code Collection.class} is {@code Collection}. - */ - static Type getGenericSupertype(Type context, Class rawType, Class toResolve) { - if (toResolve == rawType) { - return context; - } - - // we skip searching through interfaces if unknown is an interface - if (toResolve.isInterface()) { - Class[] interfaces = rawType.getInterfaces(); - for (int i = 0, length = interfaces.length; i < length; i++) { - if (interfaces[i] == toResolve) { - return rawType.getGenericInterfaces()[i]; - } else if (toResolve.isAssignableFrom(interfaces[i])) { - return getGenericSupertype(rawType.getGenericInterfaces()[i], interfaces[i], toResolve); - } - } - } - - // check our supertypes - if (!rawType.isInterface()) { - while (rawType != Object.class) { - Class rawSupertype = rawType.getSuperclass(); - if (rawSupertype == toResolve) { - return rawType.getGenericSuperclass(); - } else if (toResolve.isAssignableFrom(rawSupertype)) { - return getGenericSupertype(rawType.getGenericSuperclass(), rawSupertype, toResolve); - } - rawType = rawSupertype; - } - } - - // we can't resolve this further - return toResolve; - } - - /** - * Returns the generic form of {@code supertype}. For example, if this is {@code - * ArrayList}, this returns {@code Iterable} given the input {@code - * Iterable.class}. - * - * @param supertype a superclass of, or interface implemented by, this. - */ - static Type getSupertype(Type context, Class contextRawType, Class supertype) { - if (context instanceof WildcardType) { - // wildcards are useless for resolving supertypes. As the upper bound has the same raw type, use it instead - context = ((WildcardType)context).getUpperBounds()[0]; - } - checkArgument(supertype.isAssignableFrom(contextRawType)); - return resolve(context, contextRawType, - $Gson$Types.getGenericSupertype(context, contextRawType, supertype)); - } - - /** - * Returns the component type of this array type. - * @throws ClassCastException if this type is not an array. - */ - public static Type getArrayComponentType(Type array) { - return array instanceof GenericArrayType - ? ((GenericArrayType) array).getGenericComponentType() - : ((Class) array).getComponentType(); - } - - /** - * Returns the element type of this collection type. - * @throws IllegalArgumentException if this type is not a collection. - */ - public static Type getCollectionElementType(Type context, Class contextRawType) { - Type collectionType = getSupertype(context, contextRawType, Collection.class); - - if (collectionType instanceof WildcardType) { - collectionType = ((WildcardType)collectionType).getUpperBounds()[0]; - } - if (collectionType instanceof ParameterizedType) { - return ((ParameterizedType) collectionType).getActualTypeArguments()[0]; - } - return Object.class; - } - - /** - * Returns a two element array containing this map's key and value types in - * positions 0 and 1 respectively. - */ - public static Type[] getMapKeyAndValueTypes(Type context, Class contextRawType) { - /* - * Work around a problem with the declaration of java.util.Properties. That - * class should extend Hashtable, but it's declared to - * extend Hashtable. - */ - if (context == Properties.class) { - return new Type[] { String.class, String.class }; // TODO: test subclasses of Properties! - } - - Type mapType = getSupertype(context, contextRawType, Map.class); - // TODO: strip wildcards? - if (mapType instanceof ParameterizedType) { - ParameterizedType mapParameterizedType = (ParameterizedType) mapType; - return mapParameterizedType.getActualTypeArguments(); - } - return new Type[] { Object.class, Object.class }; - } - - public static Type resolve(Type context, Class contextRawType, Type toResolve) { - - return resolve(context, contextRawType, toResolve, new HashMap, Type>()); - } - - private static Type resolve(Type context, Class contextRawType, Type toResolve, - Map, Type> visitedTypeVariables) { - // this implementation is made a little more complicated in an attempt to avoid object-creation - TypeVariable resolving = null; - while (true) { - if (toResolve instanceof TypeVariable) { - TypeVariable typeVariable = (TypeVariable) toResolve; - Type previouslyResolved = visitedTypeVariables.get(typeVariable); - if (previouslyResolved != null) { - // cannot reduce due to infinite recursion - return (previouslyResolved == Void.TYPE) ? toResolve : previouslyResolved; - } - - // Insert a placeholder to mark the fact that we are in the process of resolving this type - visitedTypeVariables.put(typeVariable, Void.TYPE); - if (resolving == null) { - resolving = typeVariable; - } - - toResolve = resolveTypeVariable(context, contextRawType, typeVariable); - if (toResolve == typeVariable) { - break; - } - - } else if (toResolve instanceof Class && ((Class) toResolve).isArray()) { - Class original = (Class) toResolve; - Type componentType = original.getComponentType(); - Type newComponentType = resolve(context, contextRawType, componentType, visitedTypeVariables); - toResolve = equal(componentType, newComponentType) - ? original - : arrayOf(newComponentType); - break; - - } else if (toResolve instanceof GenericArrayType) { - GenericArrayType original = (GenericArrayType) toResolve; - Type componentType = original.getGenericComponentType(); - Type newComponentType = resolve(context, contextRawType, componentType, visitedTypeVariables); - toResolve = equal(componentType, newComponentType) - ? original - : arrayOf(newComponentType); - break; - - } else if (toResolve instanceof ParameterizedType) { - ParameterizedType original = (ParameterizedType) toResolve; - Type ownerType = original.getOwnerType(); - Type newOwnerType = resolve(context, contextRawType, ownerType, visitedTypeVariables); - boolean changed = !equal(newOwnerType, ownerType); - - Type[] args = original.getActualTypeArguments(); - for (int t = 0, length = args.length; t < length; t++) { - Type resolvedTypeArgument = resolve(context, contextRawType, args[t], visitedTypeVariables); - if (!equal(resolvedTypeArgument, args[t])) { - if (!changed) { - args = args.clone(); - changed = true; - } - args[t] = resolvedTypeArgument; - } - } - - toResolve = changed - ? newParameterizedTypeWithOwner(newOwnerType, original.getRawType(), args) - : original; - break; - - } else if (toResolve instanceof WildcardType) { - WildcardType original = (WildcardType) toResolve; - Type[] originalLowerBound = original.getLowerBounds(); - Type[] originalUpperBound = original.getUpperBounds(); - - if (originalLowerBound.length == 1) { - Type lowerBound = resolve(context, contextRawType, originalLowerBound[0], visitedTypeVariables); - if (lowerBound != originalLowerBound[0]) { - toResolve = supertypeOf(lowerBound); - break; - } - } else if (originalUpperBound.length == 1) { - Type upperBound = resolve(context, contextRawType, originalUpperBound[0], visitedTypeVariables); - if (upperBound != originalUpperBound[0]) { - toResolve = subtypeOf(upperBound); - break; - } - } - toResolve = original; - break; - - } else { - break; - } - } - // ensure that any in-process resolution gets updated with the final result - if (resolving != null) { - visitedTypeVariables.put(resolving, toResolve); - } - return toResolve; - } - - static Type resolveTypeVariable(Type context, Class contextRawType, TypeVariable unknown) { - Class declaredByRaw = declaringClassOf(unknown); - - // we can't reduce this further - if (declaredByRaw == null) { - return unknown; - } - - Type declaredBy = getGenericSupertype(context, contextRawType, declaredByRaw); - if (declaredBy instanceof ParameterizedType) { - int index = indexOf(declaredByRaw.getTypeParameters(), unknown); - return ((ParameterizedType) declaredBy).getActualTypeArguments()[index]; - } - - return unknown; - } - - private static int indexOf(Object[] array, Object toFind) { - for (int i = 0, length = array.length; i < length; i++) { - if (toFind.equals(array[i])) { - return i; - } - } - throw new NoSuchElementException(); - } - - /** - * Returns the declaring class of {@code typeVariable}, or {@code null} if it was not declared by - * a class. - */ - private static Class declaringClassOf(TypeVariable typeVariable) { - GenericDeclaration genericDeclaration = typeVariable.getGenericDeclaration(); - return genericDeclaration instanceof Class - ? (Class) genericDeclaration - : null; - } - - static void checkNotPrimitive(Type type) { - checkArgument(!(type instanceof Class) || !((Class) type).isPrimitive()); - } - - private static final class ParameterizedTypeImpl implements ParameterizedType, Serializable { - private final Type ownerType; - private final Type rawType; - private final Type[] typeArguments; - - public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) { - // require an owner type if the raw type needs it - if (rawType instanceof Class) { - Class rawTypeAsClass = (Class) rawType; - boolean isStaticOrTopLevelClass = Modifier.isStatic(rawTypeAsClass.getModifiers()) - || rawTypeAsClass.getEnclosingClass() == null; - checkArgument(ownerType != null || isStaticOrTopLevelClass); - } - - this.ownerType = ownerType == null ? null : canonicalize(ownerType); - this.rawType = canonicalize(rawType); - this.typeArguments = typeArguments.clone(); - for (int t = 0, length = this.typeArguments.length; t < length; t++) { - checkNotNull(this.typeArguments[t]); - checkNotPrimitive(this.typeArguments[t]); - this.typeArguments[t] = canonicalize(this.typeArguments[t]); - } - } - - public Type[] getActualTypeArguments() { - return typeArguments.clone(); - } - - public Type getRawType() { - return rawType; - } - - public Type getOwnerType() { - return ownerType; - } - - @Override public boolean equals(Object other) { - return other instanceof ParameterizedType - && $Gson$Types.equals(this, (ParameterizedType) other); - } - - @Override public int hashCode() { - return Arrays.hashCode(typeArguments) - ^ rawType.hashCode() - ^ hashCodeOrZero(ownerType); - } - - @Override public String toString() { - int length = typeArguments.length; - if (length == 0) { - return typeToString(rawType); - } - - StringBuilder stringBuilder = new StringBuilder(30 * (length + 1)); - stringBuilder.append(typeToString(rawType)).append("<").append(typeToString(typeArguments[0])); - for (int i = 1; i < length; i++) { - stringBuilder.append(", ").append(typeToString(typeArguments[i])); - } - return stringBuilder.append(">").toString(); - } - - private static final long serialVersionUID = 0; - } - - private static final class GenericArrayTypeImpl implements GenericArrayType, Serializable { - private final Type componentType; - - public GenericArrayTypeImpl(Type componentType) { - this.componentType = canonicalize(componentType); - } - - public Type getGenericComponentType() { - return componentType; - } - - @Override public boolean equals(Object o) { - return o instanceof GenericArrayType - && $Gson$Types.equals(this, (GenericArrayType) o); - } - - @Override public int hashCode() { - return componentType.hashCode(); - } - - @Override public String toString() { - return typeToString(componentType) + "[]"; - } - - private static final long serialVersionUID = 0; - } - - /** - * The WildcardType interface supports multiple upper bounds and multiple - * lower bounds. We only support what the Java 6 language needs - at most one - * bound. If a lower bound is set, the upper bound must be Object.class. - */ - private static final class WildcardTypeImpl implements WildcardType, Serializable { - private final Type upperBound; - private final Type lowerBound; - - public WildcardTypeImpl(Type[] upperBounds, Type[] lowerBounds) { - checkArgument(lowerBounds.length <= 1); - checkArgument(upperBounds.length == 1); - - if (lowerBounds.length == 1) { - checkNotNull(lowerBounds[0]); - checkNotPrimitive(lowerBounds[0]); - checkArgument(upperBounds[0] == Object.class); - this.lowerBound = canonicalize(lowerBounds[0]); - this.upperBound = Object.class; - - } else { - checkNotNull(upperBounds[0]); - checkNotPrimitive(upperBounds[0]); - this.lowerBound = null; - this.upperBound = canonicalize(upperBounds[0]); - } - } - - public Type[] getUpperBounds() { - return new Type[] { upperBound }; - } - - public Type[] getLowerBounds() { - return lowerBound != null ? new Type[] { lowerBound } : EMPTY_TYPE_ARRAY; - } - - @Override public boolean equals(Object other) { - return other instanceof WildcardType - && $Gson$Types.equals(this, (WildcardType) other); - } - - @Override public int hashCode() { - // this equals Arrays.hashCode(getLowerBounds()) ^ Arrays.hashCode(getUpperBounds()); - return (lowerBound != null ? 31 + lowerBound.hashCode() : 1) - ^ (31 + upperBound.hashCode()); - } - - @Override public String toString() { - if (lowerBound != null) { - return "? super " + typeToString(lowerBound); - } else if (upperBound == Object.class) { - return "?"; - } else { - return "? extends " + typeToString(upperBound); - } - } - - private static final long serialVersionUID = 0; - } -} diff --git a/minecraft_server/com/google/gson/internal/ConstructorConstructor.java b/minecraft_server/com/google/gson/internal/ConstructorConstructor.java deleted file mode 100644 index 5fab460..0000000 --- a/minecraft_server/com/google/gson/internal/ConstructorConstructor.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Collection; -import java.util.EnumSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Queue; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeMap; -import java.util.TreeSet; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ConcurrentNavigableMap; -import java.util.concurrent.ConcurrentSkipListMap; - -import com.google.gson.InstanceCreator; -import com.google.gson.JsonIOException; -import com.google.gson.internal.reflect.ReflectionAccessor; -import com.google.gson.reflect.TypeToken; - -/** - * Returns a function that can construct an instance of a requested type. - */ -public final class ConstructorConstructor { - private final Map> instanceCreators; - private final ReflectionAccessor accessor = ReflectionAccessor.getInstance(); - - public ConstructorConstructor(Map> instanceCreators) { - this.instanceCreators = instanceCreators; - } - - public ObjectConstructor get(TypeToken typeToken) { - final Type type = typeToken.getType(); - final Class rawType = typeToken.getRawType(); - - // first try an instance creator - - @SuppressWarnings("unchecked") // types must agree - final InstanceCreator typeCreator = (InstanceCreator) instanceCreators.get(type); - if (typeCreator != null) { - return new ObjectConstructor() { - @Override public T construct() { - return typeCreator.createInstance(type); - } - }; - } - - // Next try raw type match for instance creators - @SuppressWarnings("unchecked") // types must agree - final InstanceCreator rawTypeCreator = - (InstanceCreator) instanceCreators.get(rawType); - if (rawTypeCreator != null) { - return new ObjectConstructor() { - @Override public T construct() { - return rawTypeCreator.createInstance(type); - } - }; - } - - ObjectConstructor defaultConstructor = newDefaultConstructor(rawType); - if (defaultConstructor != null) { - return defaultConstructor; - } - - ObjectConstructor defaultImplementation = newDefaultImplementationConstructor(type, rawType); - if (defaultImplementation != null) { - return defaultImplementation; - } - - // finally try unsafe - return newUnsafeAllocator(type, rawType); - } - - private ObjectConstructor newDefaultConstructor(Class rawType) { - try { - final Constructor constructor = rawType.getDeclaredConstructor(); - if (!constructor.isAccessible()) { - accessor.makeAccessible(constructor); - } - return new ObjectConstructor() { - @SuppressWarnings("unchecked") // T is the same raw type as is requested - @Override public T construct() { - try { - Object[] args = null; - return (T) constructor.newInstance(args); - } catch (InstantiationException e) { - // TODO: JsonParseException ? - throw new RuntimeException("Failed to invoke " + constructor + " with no args", e); - } catch (InvocationTargetException e) { - // TODO: don't wrap if cause is unchecked! - // TODO: JsonParseException ? - throw new RuntimeException("Failed to invoke " + constructor + " with no args", - e.getTargetException()); - } catch (IllegalAccessException e) { - throw new AssertionError(e); - } - } - }; - } catch (NoSuchMethodException e) { - return null; - } - } - - /** - * Constructors for common interface types like Map and List and their - * subtypes. - */ - @SuppressWarnings("unchecked") // use runtime checks to guarantee that 'T' is what it is - private ObjectConstructor newDefaultImplementationConstructor( - final Type type, Class rawType) { - if (Collection.class.isAssignableFrom(rawType)) { - if (SortedSet.class.isAssignableFrom(rawType)) { - return new ObjectConstructor() { - @Override public T construct() { - return (T) new TreeSet(); - } - }; - } else if (EnumSet.class.isAssignableFrom(rawType)) { - return new ObjectConstructor() { - @SuppressWarnings("rawtypes") - @Override public T construct() { - if (type instanceof ParameterizedType) { - Type elementType = ((ParameterizedType) type).getActualTypeArguments()[0]; - if (elementType instanceof Class) { - return (T) EnumSet.noneOf((Class)elementType); - } else { - throw new JsonIOException("Invalid EnumSet type: " + type.toString()); - } - } else { - throw new JsonIOException("Invalid EnumSet type: " + type.toString()); - } - } - }; - } else if (Set.class.isAssignableFrom(rawType)) { - return new ObjectConstructor() { - @Override public T construct() { - return (T) new LinkedHashSet(); - } - }; - } else if (Queue.class.isAssignableFrom(rawType)) { - return new ObjectConstructor() { - @Override public T construct() { - return (T) new ArrayDeque(); - } - }; - } else { - return new ObjectConstructor() { - @Override public T construct() { - return (T) new ArrayList(); - } - }; - } - } - - if (Map.class.isAssignableFrom(rawType)) { - if (ConcurrentNavigableMap.class.isAssignableFrom(rawType)) { - return new ObjectConstructor() { - @Override public T construct() { - return (T) new ConcurrentSkipListMap(); - } - }; - } else if (ConcurrentMap.class.isAssignableFrom(rawType)) { - return new ObjectConstructor() { - @Override public T construct() { - return (T) new ConcurrentHashMap(); - } - }; - } else if (SortedMap.class.isAssignableFrom(rawType)) { - return new ObjectConstructor() { - @Override public T construct() { - return (T) new TreeMap(); - } - }; - } else if (type instanceof ParameterizedType && !(String.class.isAssignableFrom( - TypeToken.get(((ParameterizedType) type).getActualTypeArguments()[0]).getRawType()))) { - return new ObjectConstructor() { - @Override public T construct() { - return (T) new LinkedHashMap(); - } - }; - } else { - return new ObjectConstructor() { - @Override public T construct() { - return (T) new LinkedTreeMap(); - } - }; - } - } - - return null; - } - - private ObjectConstructor newUnsafeAllocator( - final Type type, final Class rawType) { - return new ObjectConstructor() { - private final UnsafeAllocator unsafeAllocator = UnsafeAllocator.create(); - @SuppressWarnings("unchecked") - @Override public T construct() { - try { - Object newInstance = unsafeAllocator.newInstance(rawType); - return (T) newInstance; - } catch (Exception e) { - throw new RuntimeException(("Unable to invoke no-args constructor for " + type + ". " - + "Registering an InstanceCreator with Gson for this type may fix this problem."), e); - } - } - }; - } - - @Override public String toString() { - return instanceCreators.toString(); - } -} diff --git a/minecraft_server/com/google/gson/internal/Excluder.java b/minecraft_server/com/google/gson/internal/Excluder.java deleted file mode 100644 index 9e7f322..0000000 --- a/minecraft_server/com/google/gson/internal/Excluder.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -import com.google.gson.ExclusionStrategy; -import com.google.gson.FieldAttributes; -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.Since; -import com.google.gson.annotations.Until; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * This class selects which fields and types to omit. It is configurable, - * supporting version attributes {@link Since} and {@link Until}, modifiers, - * synthetic fields, anonymous and local classes, inner classes, and fields with - * the {@link Expose} annotation. - * - *

This class is a type adapter factory; types that are excluded will be - * adapted to null. It may delegate to another type adapter if only one - * direction is excluded. - * - * @author Joel Leitch - * @author Jesse Wilson - */ -public final class Excluder implements TypeAdapterFactory, Cloneable { - private static final double IGNORE_VERSIONS = -1.0d; - public static final Excluder DEFAULT = new Excluder(); - - private double version = IGNORE_VERSIONS; - private int modifiers = Modifier.TRANSIENT | Modifier.STATIC; - private boolean serializeInnerClasses = true; - private boolean requireExpose; - private List serializationStrategies = Collections.emptyList(); - private List deserializationStrategies = Collections.emptyList(); - - @Override protected Excluder clone() { - try { - return (Excluder) super.clone(); - } catch (CloneNotSupportedException e) { - throw new AssertionError(e); - } - } - - public Excluder withVersion(double ignoreVersionsAfter) { - Excluder result = clone(); - result.version = ignoreVersionsAfter; - return result; - } - - public Excluder withModifiers(int... modifiers) { - Excluder result = clone(); - result.modifiers = 0; - for (int modifier : modifiers) { - result.modifiers |= modifier; - } - return result; - } - - public Excluder disableInnerClassSerialization() { - Excluder result = clone(); - result.serializeInnerClasses = false; - return result; - } - - public Excluder excludeFieldsWithoutExposeAnnotation() { - Excluder result = clone(); - result.requireExpose = true; - return result; - } - - public Excluder withExclusionStrategy(ExclusionStrategy exclusionStrategy, - boolean serialization, boolean deserialization) { - Excluder result = clone(); - if (serialization) { - result.serializationStrategies = new ArrayList(serializationStrategies); - result.serializationStrategies.add(exclusionStrategy); - } - if (deserialization) { - result.deserializationStrategies - = new ArrayList(deserializationStrategies); - result.deserializationStrategies.add(exclusionStrategy); - } - return result; - } - - public TypeAdapter create(final Gson gson, final TypeToken type) { - Class rawType = type.getRawType(); - boolean excludeClass = excludeClassChecks(rawType); - - final boolean skipSerialize = excludeClass || excludeClassInStrategy(rawType, true); - final boolean skipDeserialize = excludeClass || excludeClassInStrategy(rawType, false); - - if (!skipSerialize && !skipDeserialize) { - return null; - } - - return new TypeAdapter() { - /** The delegate is lazily created because it may not be needed, and creating it may fail. */ - private TypeAdapter delegate; - - @Override public T read(JsonReader in) throws IOException { - if (skipDeserialize) { - in.skipValue(); - return null; - } - return delegate().read(in); - } - - @Override public void write(JsonWriter out, T value) throws IOException { - if (skipSerialize) { - out.nullValue(); - return; - } - delegate().write(out, value); - } - - private TypeAdapter delegate() { - TypeAdapter d = delegate; - return d != null - ? d - : (delegate = gson.getDelegateAdapter(Excluder.this, type)); - } - }; - } - - public boolean excludeField(Field field, boolean serialize) { - if ((modifiers & field.getModifiers()) != 0) { - return true; - } - - if (version != Excluder.IGNORE_VERSIONS - && !isValidVersion(field.getAnnotation(Since.class), field.getAnnotation(Until.class))) { - return true; - } - - if (field.isSynthetic()) { - return true; - } - - if (requireExpose) { - Expose annotation = field.getAnnotation(Expose.class); - if (annotation == null || (serialize ? !annotation.serialize() : !annotation.deserialize())) { - return true; - } - } - - if (!serializeInnerClasses && isInnerClass(field.getType())) { - return true; - } - - if (isAnonymousOrNonStaticLocal(field.getType())) { - return true; - } - - List list = serialize ? serializationStrategies : deserializationStrategies; - if (!list.isEmpty()) { - FieldAttributes fieldAttributes = new FieldAttributes(field); - for (ExclusionStrategy exclusionStrategy : list) { - if (exclusionStrategy.shouldSkipField(fieldAttributes)) { - return true; - } - } - } - - return false; - } - - private boolean excludeClassChecks(Class clazz) { - if (version != Excluder.IGNORE_VERSIONS && !isValidVersion(clazz.getAnnotation(Since.class), clazz.getAnnotation(Until.class))) { - return true; - } - - if (!serializeInnerClasses && isInnerClass(clazz)) { - return true; - } - - if (isAnonymousOrNonStaticLocal(clazz)) { - return true; - } - - return false; - } - - public boolean excludeClass(Class clazz, boolean serialize) { - return excludeClassChecks(clazz) || - excludeClassInStrategy(clazz, serialize); - } - - private boolean excludeClassInStrategy(Class clazz, boolean serialize) { - List list = serialize ? serializationStrategies : deserializationStrategies; - for (ExclusionStrategy exclusionStrategy : list) { - if (exclusionStrategy.shouldSkipClass(clazz)) { - return true; - } - } - return false; - } - - private boolean isAnonymousOrNonStaticLocal(Class clazz) { - return !Enum.class.isAssignableFrom(clazz) && !isStatic(clazz) - && (clazz.isAnonymousClass() || clazz.isLocalClass()); - } - - private boolean isInnerClass(Class clazz) { - return clazz.isMemberClass() && !isStatic(clazz); - } - - private boolean isStatic(Class clazz) { - return (clazz.getModifiers() & Modifier.STATIC) != 0; - } - - private boolean isValidVersion(Since since, Until until) { - return isValidSince(since) && isValidUntil(until); - } - - private boolean isValidSince(Since annotation) { - if (annotation != null) { - double annotationVersion = annotation.value(); - if (annotationVersion > version) { - return false; - } - } - return true; - } - - private boolean isValidUntil(Until annotation) { - if (annotation != null) { - double annotationVersion = annotation.value(); - if (annotationVersion <= version) { - return false; - } - } - return true; - } -} diff --git a/minecraft_server/com/google/gson/internal/JavaVersion.java b/minecraft_server/com/google/gson/internal/JavaVersion.java deleted file mode 100644 index fab1b7c..0000000 --- a/minecraft_server/com/google/gson/internal/JavaVersion.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2017 The Gson authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -/** - * Utility to check the major Java version of the current JVM. - */ -public final class JavaVersion { - // Oracle defines naming conventions at http://www.oracle.com/technetwork/java/javase/versioning-naming-139433.html - // However, many alternate implementations differ. For example, Debian used 9-debian as the version string - - private static final int majorJavaVersion = determineMajorJavaVersion(); - - private static int determineMajorJavaVersion() { - String javaVersion = System.getProperty("java.version"); - return getMajorJavaVersion(javaVersion); - } - - // Visible for testing only - static int getMajorJavaVersion(String javaVersion) { - int version = parseDotted(javaVersion); - if (version == -1) { - version = extractBeginningInt(javaVersion); - } - if (version == -1) { - return 6; // Choose minimum supported JDK version as default - } - return version; - } - - // Parses both legacy 1.8 style and newer 9.0.4 style - private static int parseDotted(String javaVersion) { - try { - String[] parts = javaVersion.split("[._]"); - int firstVer = Integer.parseInt(parts[0]); - if (firstVer == 1 && parts.length > 1) { - return Integer.parseInt(parts[1]); - } else { - return firstVer; - } - } catch (NumberFormatException e) { - return -1; - } - } - - private static int extractBeginningInt(String javaVersion) { - try { - StringBuilder num = new StringBuilder(); - for (int i = 0; i < javaVersion.length(); ++i) { - char c = javaVersion.charAt(i); - if (Character.isDigit(c)) { - num.append(c); - } else { - break; - } - } - return Integer.parseInt(num.toString()); - } catch (NumberFormatException e) { - return -1; - } - } - - /** - * @return the major Java version, i.e. '8' for Java 1.8, '9' for Java 9 etc. - */ - public static int getMajorJavaVersion() { - return majorJavaVersion; - } - - /** - * @return {@code true} if the application is running on Java 9 or later; and {@code false} otherwise. - */ - public static boolean isJava9OrLater() { - return majorJavaVersion >= 9; - } - - private JavaVersion() { } -} diff --git a/minecraft_server/com/google/gson/internal/JsonReaderInternalAccess.java b/minecraft_server/com/google/gson/internal/JsonReaderInternalAccess.java deleted file mode 100644 index bbd4720..0000000 --- a/minecraft_server/com/google/gson/internal/JsonReaderInternalAccess.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -import com.google.gson.stream.JsonReader; -import java.io.IOException; - -/** - * Internal-only APIs of JsonReader available only to other classes in Gson. - */ -public abstract class JsonReaderInternalAccess { - public static JsonReaderInternalAccess INSTANCE; - - /** - * Changes the type of the current property name token to a string value. - */ - public abstract void promoteNameToValue(JsonReader reader) throws IOException; -} diff --git a/minecraft_server/com/google/gson/internal/LazilyParsedNumber.java b/minecraft_server/com/google/gson/internal/LazilyParsedNumber.java deleted file mode 100644 index 6138dff..0000000 --- a/minecraft_server/com/google/gson/internal/LazilyParsedNumber.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.gson.internal; - -import java.io.IOException; -import java.io.InvalidObjectException; -import java.io.ObjectInputStream; -import java.io.ObjectStreamException; -import java.math.BigDecimal; - -/** - * This class holds a number value that is lazily converted to a specific number type - * - * @author Inderjeet Singh - */ -public final class LazilyParsedNumber extends Number { - private final String value; - - /** @param value must not be null */ - public LazilyParsedNumber(String value) { - this.value = value; - } - - @Override - public int intValue() { - try { - return Integer.parseInt(value); - } catch (NumberFormatException e) { - try { - return (int) Long.parseLong(value); - } catch (NumberFormatException nfe) { - return new BigDecimal(value).intValue(); - } - } - } - - @Override - public long longValue() { - try { - return Long.parseLong(value); - } catch (NumberFormatException e) { - return new BigDecimal(value).longValue(); - } - } - - @Override - public float floatValue() { - return Float.parseFloat(value); - } - - @Override - public double doubleValue() { - return Double.parseDouble(value); - } - - @Override - public String toString() { - return value; - } - - /** - * If somebody is unlucky enough to have to serialize one of these, serialize - * it as a BigDecimal so that they won't need Gson on the other side to - * deserialize it. - */ - private Object writeReplace() throws ObjectStreamException { - return new BigDecimal(value); - } - - private void readObject(ObjectInputStream in) throws IOException { - // Don't permit directly deserializing this class; writeReplace() should have written a replacement - throw new InvalidObjectException("Deserialization is unsupported"); - } - - @Override - public int hashCode() { - return value.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof LazilyParsedNumber) { - LazilyParsedNumber other = (LazilyParsedNumber) obj; - return value == other.value || value.equals(other.value); - } - return false; - } -} diff --git a/minecraft_server/com/google/gson/internal/LinkedHashTreeMap.java b/minecraft_server/com/google/gson/internal/LinkedHashTreeMap.java deleted file mode 100644 index 0cade0d..0000000 --- a/minecraft_server/com/google/gson/internal/LinkedHashTreeMap.java +++ /dev/null @@ -1,872 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * Copyright (C) 2012 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -import java.io.IOException; -import java.io.InvalidObjectException; -import java.io.ObjectInputStream; -import java.io.ObjectStreamException; -import java.io.Serializable; -import java.util.AbstractMap; -import java.util.AbstractSet; -import java.util.Arrays; -import java.util.Comparator; -import java.util.ConcurrentModificationException; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.NoSuchElementException; -import java.util.Set; - -/** - * A map of comparable keys to values. Unlike {@code TreeMap}, this class uses - * insertion order for iteration order. Comparison order is only used as an - * optimization for efficient insertion and removal. - * - *

This implementation was derived from Android 4.1's TreeMap and - * LinkedHashMap classes. - */ -public final class LinkedHashTreeMap extends AbstractMap implements Serializable { - @SuppressWarnings({ "unchecked", "rawtypes" }) // to avoid Comparable>> - private static final Comparator NATURAL_ORDER = new Comparator() { - public int compare(Comparable a, Comparable b) { - return a.compareTo(b); - } - }; - - Comparator comparator; - Node[] table; - final Node header; - int size = 0; - int modCount = 0; - int threshold; - - /** - * Create a natural order, empty tree map whose keys must be mutually - * comparable and non-null. - */ - @SuppressWarnings("unchecked") // unsafe! this assumes K is comparable - public LinkedHashTreeMap() { - this((Comparator) NATURAL_ORDER); - } - - /** - * Create a tree map ordered by {@code comparator}. This map's keys may only - * be null if {@code comparator} permits. - * - * @param comparator the comparator to order elements with, or {@code null} to - * use the natural ordering. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) // unsafe! if comparator is null, this assumes K is comparable - public LinkedHashTreeMap(Comparator comparator) { - this.comparator = comparator != null - ? comparator - : (Comparator) NATURAL_ORDER; - this.header = new Node(); - this.table = new Node[16]; // TODO: sizing/resizing policies - this.threshold = (table.length / 2) + (table.length / 4); // 3/4 capacity - } - - @Override public int size() { - return size; - } - - @Override public V get(Object key) { - Node node = findByObject(key); - return node != null ? node.value : null; - } - - @Override public boolean containsKey(Object key) { - return findByObject(key) != null; - } - - @Override public V put(K key, V value) { - if (key == null) { - throw new NullPointerException("key == null"); - } - Node created = find(key, true); - V result = created.value; - created.value = value; - return result; - } - - @Override public void clear() { - Arrays.fill(table, null); - size = 0; - modCount++; - - // Clear all links to help GC - Node header = this.header; - for (Node e = header.next; e != header; ) { - Node next = e.next; - e.next = e.prev = null; - e = next; - } - - header.next = header.prev = header; - } - - @Override public V remove(Object key) { - Node node = removeInternalByKey(key); - return node != null ? node.value : null; - } - - /** - * Returns the node at or adjacent to the given key, creating it if requested. - * - * @throws ClassCastException if {@code key} and the tree's keys aren't - * mutually comparable. - */ - Node find(K key, boolean create) { - Comparator comparator = this.comparator; - Node[] table = this.table; - int hash = secondaryHash(key.hashCode()); - int index = hash & (table.length - 1); - Node nearest = table[index]; - int comparison = 0; - - if (nearest != null) { - // Micro-optimization: avoid polymorphic calls to Comparator.compare(). - @SuppressWarnings("unchecked") // Throws a ClassCastException below if there's trouble. - Comparable comparableKey = (comparator == NATURAL_ORDER) - ? (Comparable) key - : null; - - while (true) { - comparison = (comparableKey != null) - ? comparableKey.compareTo(nearest.key) - : comparator.compare(key, nearest.key); - - // We found the requested key. - if (comparison == 0) { - return nearest; - } - - // If it exists, the key is in a subtree. Go deeper. - Node child = (comparison < 0) ? nearest.left : nearest.right; - if (child == null) { - break; - } - - nearest = child; - } - } - - // The key doesn't exist in this tree. - if (!create) { - return null; - } - - // Create the node and add it to the tree or the table. - Node header = this.header; - Node created; - if (nearest == null) { - // Check that the value is comparable if we didn't do any comparisons. - if (comparator == NATURAL_ORDER && !(key instanceof Comparable)) { - throw new ClassCastException(key.getClass().getName() + " is not Comparable"); - } - created = new Node(nearest, key, hash, header, header.prev); - table[index] = created; - } else { - created = new Node(nearest, key, hash, header, header.prev); - if (comparison < 0) { // nearest.key is higher - nearest.left = created; - } else { // comparison > 0, nearest.key is lower - nearest.right = created; - } - rebalance(nearest, true); - } - - if (size++ > threshold) { - doubleCapacity(); - } - modCount++; - - return created; - } - - @SuppressWarnings("unchecked") - Node findByObject(Object key) { - try { - return key != null ? find((K) key, false) : null; - } catch (ClassCastException e) { - return null; - } - } - - /** - * Returns this map's entry that has the same key and value as {@code - * entry}, or null if this map has no such entry. - * - *

This method uses the comparator for key equality rather than {@code - * equals}. If this map's comparator isn't consistent with equals (such as - * {@code String.CASE_INSENSITIVE_ORDER}), then {@code remove()} and {@code - * contains()} will violate the collections API. - */ - Node findByEntry(Entry entry) { - Node mine = findByObject(entry.getKey()); - boolean valuesEqual = mine != null && equal(mine.value, entry.getValue()); - return valuesEqual ? mine : null; - } - - private boolean equal(Object a, Object b) { - return a == b || (a != null && a.equals(b)); - } - - /** - * Applies a supplemental hash function to a given hashCode, which defends - * against poor quality hash functions. This is critical because HashMap - * uses power-of-two length hash tables, that otherwise encounter collisions - * for hashCodes that do not differ in lower or upper bits. - */ - private static int secondaryHash(int h) { - // Doug Lea's supplemental hash function - h ^= (h >>> 20) ^ (h >>> 12); - return h ^ (h >>> 7) ^ (h >>> 4); - } - - /** - * Removes {@code node} from this tree, rearranging the tree's structure as - * necessary. - * - * @param unlink true to also unlink this node from the iteration linked list. - */ - void removeInternal(Node node, boolean unlink) { - if (unlink) { - node.prev.next = node.next; - node.next.prev = node.prev; - node.next = node.prev = null; // Help the GC (for performance) - } - - Node left = node.left; - Node right = node.right; - Node originalParent = node.parent; - if (left != null && right != null) { - - /* - * To remove a node with both left and right subtrees, move an - * adjacent node from one of those subtrees into this node's place. - * - * Removing the adjacent node may change this node's subtrees. This - * node may no longer have two subtrees once the adjacent node is - * gone! - */ - - Node adjacent = (left.height > right.height) ? left.last() : right.first(); - removeInternal(adjacent, false); // takes care of rebalance and size-- - - int leftHeight = 0; - left = node.left; - if (left != null) { - leftHeight = left.height; - adjacent.left = left; - left.parent = adjacent; - node.left = null; - } - int rightHeight = 0; - right = node.right; - if (right != null) { - rightHeight = right.height; - adjacent.right = right; - right.parent = adjacent; - node.right = null; - } - adjacent.height = Math.max(leftHeight, rightHeight) + 1; - replaceInParent(node, adjacent); - return; - } else if (left != null) { - replaceInParent(node, left); - node.left = null; - } else if (right != null) { - replaceInParent(node, right); - node.right = null; - } else { - replaceInParent(node, null); - } - - rebalance(originalParent, false); - size--; - modCount++; - } - - Node removeInternalByKey(Object key) { - Node node = findByObject(key); - if (node != null) { - removeInternal(node, true); - } - return node; - } - - private void replaceInParent(Node node, Node replacement) { - Node parent = node.parent; - node.parent = null; - if (replacement != null) { - replacement.parent = parent; - } - - if (parent != null) { - if (parent.left == node) { - parent.left = replacement; - } else { - assert (parent.right == node); - parent.right = replacement; - } - } else { - int index = node.hash & (table.length - 1); - table[index] = replacement; - } - } - - /** - * Rebalances the tree by making any AVL rotations necessary between the - * newly-unbalanced node and the tree's root. - * - * @param insert true if the node was unbalanced by an insert; false if it - * was by a removal. - */ - private void rebalance(Node unbalanced, boolean insert) { - for (Node node = unbalanced; node != null; node = node.parent) { - Node left = node.left; - Node right = node.right; - int leftHeight = left != null ? left.height : 0; - int rightHeight = right != null ? right.height : 0; - - int delta = leftHeight - rightHeight; - if (delta == -2) { - Node rightLeft = right.left; - Node rightRight = right.right; - int rightRightHeight = rightRight != null ? rightRight.height : 0; - int rightLeftHeight = rightLeft != null ? rightLeft.height : 0; - - int rightDelta = rightLeftHeight - rightRightHeight; - if (rightDelta == -1 || (rightDelta == 0 && !insert)) { - rotateLeft(node); // AVL right right - } else { - assert (rightDelta == 1); - rotateRight(right); // AVL right left - rotateLeft(node); - } - if (insert) { - break; // no further rotations will be necessary - } - - } else if (delta == 2) { - Node leftLeft = left.left; - Node leftRight = left.right; - int leftRightHeight = leftRight != null ? leftRight.height : 0; - int leftLeftHeight = leftLeft != null ? leftLeft.height : 0; - - int leftDelta = leftLeftHeight - leftRightHeight; - if (leftDelta == 1 || (leftDelta == 0 && !insert)) { - rotateRight(node); // AVL left left - } else { - assert (leftDelta == -1); - rotateLeft(left); // AVL left right - rotateRight(node); - } - if (insert) { - break; // no further rotations will be necessary - } - - } else if (delta == 0) { - node.height = leftHeight + 1; // leftHeight == rightHeight - if (insert) { - break; // the insert caused balance, so rebalancing is done! - } - - } else { - assert (delta == -1 || delta == 1); - node.height = Math.max(leftHeight, rightHeight) + 1; - if (!insert) { - break; // the height hasn't changed, so rebalancing is done! - } - } - } - } - - /** - * Rotates the subtree so that its root's right child is the new root. - */ - private void rotateLeft(Node root) { - Node left = root.left; - Node pivot = root.right; - Node pivotLeft = pivot.left; - Node pivotRight = pivot.right; - - // move the pivot's left child to the root's right - root.right = pivotLeft; - if (pivotLeft != null) { - pivotLeft.parent = root; - } - - replaceInParent(root, pivot); - - // move the root to the pivot's left - pivot.left = root; - root.parent = pivot; - - // fix heights - root.height = Math.max(left != null ? left.height : 0, - pivotLeft != null ? pivotLeft.height : 0) + 1; - pivot.height = Math.max(root.height, - pivotRight != null ? pivotRight.height : 0) + 1; - } - - /** - * Rotates the subtree so that its root's left child is the new root. - */ - private void rotateRight(Node root) { - Node pivot = root.left; - Node right = root.right; - Node pivotLeft = pivot.left; - Node pivotRight = pivot.right; - - // move the pivot's right child to the root's left - root.left = pivotRight; - if (pivotRight != null) { - pivotRight.parent = root; - } - - replaceInParent(root, pivot); - - // move the root to the pivot's right - pivot.right = root; - root.parent = pivot; - - // fixup heights - root.height = Math.max(right != null ? right.height : 0, - pivotRight != null ? pivotRight.height : 0) + 1; - pivot.height = Math.max(root.height, - pivotLeft != null ? pivotLeft.height : 0) + 1; - } - - private EntrySet entrySet; - private KeySet keySet; - - @Override public Set> entrySet() { - EntrySet result = entrySet; - return result != null ? result : (entrySet = new EntrySet()); - } - - @Override public Set keySet() { - KeySet result = keySet; - return result != null ? result : (keySet = new KeySet()); - } - - static final class Node implements Entry { - Node parent; - Node left; - Node right; - Node next; - Node prev; - final K key; - final int hash; - V value; - int height; - - /** Create the header entry */ - Node() { - key = null; - hash = -1; - next = prev = this; - } - - /** Create a regular entry */ - Node(Node parent, K key, int hash, Node next, Node prev) { - this.parent = parent; - this.key = key; - this.hash = hash; - this.height = 1; - this.next = next; - this.prev = prev; - prev.next = this; - next.prev = this; - } - - public K getKey() { - return key; - } - - public V getValue() { - return value; - } - - public V setValue(V value) { - V oldValue = this.value; - this.value = value; - return oldValue; - } - - @SuppressWarnings("rawtypes") - @Override public boolean equals(Object o) { - if (o instanceof Entry) { - Entry other = (Entry) o; - return (key == null ? other.getKey() == null : key.equals(other.getKey())) - && (value == null ? other.getValue() == null : value.equals(other.getValue())); - } - return false; - } - - @Override public int hashCode() { - return (key == null ? 0 : key.hashCode()) - ^ (value == null ? 0 : value.hashCode()); - } - - @Override public String toString() { - return key + "=" + value; - } - - /** - * Returns the first node in this subtree. - */ - public Node first() { - Node node = this; - Node child = node.left; - while (child != null) { - node = child; - child = node.left; - } - return node; - } - - /** - * Returns the last node in this subtree. - */ - public Node last() { - Node node = this; - Node child = node.right; - while (child != null) { - node = child; - child = node.right; - } - return node; - } - } - - private void doubleCapacity() { - table = doubleCapacity(table); - threshold = (table.length / 2) + (table.length / 4); // 3/4 capacity - } - - /** - * Returns a new array containing the same nodes as {@code oldTable}, but with - * twice as many trees, each of (approximately) half the previous size. - */ - static Node[] doubleCapacity(Node[] oldTable) { - // TODO: don't do anything if we're already at MAX_CAPACITY - int oldCapacity = oldTable.length; - @SuppressWarnings("unchecked") // Arrays and generics don't get along. - Node[] newTable = new Node[oldCapacity * 2]; - AvlIterator iterator = new AvlIterator(); - AvlBuilder leftBuilder = new AvlBuilder(); - AvlBuilder rightBuilder = new AvlBuilder(); - - // Split each tree into two trees. - for (int i = 0; i < oldCapacity; i++) { - Node root = oldTable[i]; - if (root == null) { - continue; - } - - // Compute the sizes of the left and right trees. - iterator.reset(root); - int leftSize = 0; - int rightSize = 0; - for (Node node; (node = iterator.next()) != null; ) { - if ((node.hash & oldCapacity) == 0) { - leftSize++; - } else { - rightSize++; - } - } - - // Split the tree into two. - leftBuilder.reset(leftSize); - rightBuilder.reset(rightSize); - iterator.reset(root); - for (Node node; (node = iterator.next()) != null; ) { - if ((node.hash & oldCapacity) == 0) { - leftBuilder.add(node); - } else { - rightBuilder.add(node); - } - } - - // Populate the enlarged array with these new roots. - newTable[i] = leftSize > 0 ? leftBuilder.root() : null; - newTable[i + oldCapacity] = rightSize > 0 ? rightBuilder.root() : null; - } - return newTable; - } - - /** - * Walks an AVL tree in iteration order. Once a node has been returned, its - * left, right and parent links are no longer used. For this - * reason it is safe to transform these links as you walk a tree. - * - *

Warning: this iterator is destructive. It clears the - * parent node of all nodes in the tree. It is an error to make a partial - * iteration of a tree. - */ - static class AvlIterator { - /** This stack is a singly linked list, linked by the 'parent' field. */ - private Node stackTop; - - void reset(Node root) { - Node stackTop = null; - for (Node n = root; n != null; n = n.left) { - n.parent = stackTop; - stackTop = n; // Stack push. - } - this.stackTop = stackTop; - } - - public Node next() { - Node stackTop = this.stackTop; - if (stackTop == null) { - return null; - } - Node result = stackTop; - stackTop = result.parent; - result.parent = null; - for (Node n = result.right; n != null; n = n.left) { - n.parent = stackTop; - stackTop = n; // Stack push. - } - this.stackTop = stackTop; - return result; - } - } - - /** - * Builds AVL trees of a predetermined size by accepting nodes of increasing - * value. To use: - *

    - *
  1. Call {@link #reset} to initialize the target size size. - *
  2. Call {@link #add} size times with increasing values. - *
  3. Call {@link #root} to get the root of the balanced tree. - *
- * - *

The returned tree will satisfy the AVL constraint: for every node - * N, the height of N.left and N.right is different by at - * most 1. It accomplishes this by omitting deepest-level leaf nodes when - * building trees whose size isn't a power of 2 minus 1. - * - *

Unlike rebuilding a tree from scratch, this approach requires no value - * comparisons. Using this class to create a tree of size S is - * {@code O(S)}. - */ - final static class AvlBuilder { - /** This stack is a singly linked list, linked by the 'parent' field. */ - private Node stack; - private int leavesToSkip; - private int leavesSkipped; - private int size; - - void reset(int targetSize) { - // compute the target tree size. This is a power of 2 minus one, like 15 or 31. - int treeCapacity = Integer.highestOneBit(targetSize) * 2 - 1; - leavesToSkip = treeCapacity - targetSize; - size = 0; - leavesSkipped = 0; - stack = null; - } - - void add(Node node) { - node.left = node.parent = node.right = null; - node.height = 1; - - // Skip a leaf if necessary. - if (leavesToSkip > 0 && (size & 1) == 0) { - size++; - leavesToSkip--; - leavesSkipped++; - } - - node.parent = stack; - stack = node; // Stack push. - size++; - - // Skip a leaf if necessary. - if (leavesToSkip > 0 && (size & 1) == 0) { - size++; - leavesToSkip--; - leavesSkipped++; - } - - /* - * Combine 3 nodes into subtrees whenever the size is one less than a - * multiple of 4. For example we combine the nodes A, B, C into a - * 3-element tree with B as the root. - * - * Combine two subtrees and a spare single value whenever the size is one - * less than a multiple of 8. For example at 8 we may combine subtrees - * (A B C) and (E F G) with D as the root to form ((A B C) D (E F G)). - * - * Just as we combine single nodes when size nears a multiple of 4, and - * 3-element trees when size nears a multiple of 8, we combine subtrees of - * size (N-1) whenever the total size is 2N-1 whenever N is a power of 2. - */ - for (int scale = 4; (size & scale - 1) == scale - 1; scale *= 2) { - if (leavesSkipped == 0) { - // Pop right, center and left, then make center the top of the stack. - Node right = stack; - Node center = right.parent; - Node left = center.parent; - center.parent = left.parent; - stack = center; - // Construct a tree. - center.left = left; - center.right = right; - center.height = right.height + 1; - left.parent = center; - right.parent = center; - } else if (leavesSkipped == 1) { - // Pop right and center, then make center the top of the stack. - Node right = stack; - Node center = right.parent; - stack = center; - // Construct a tree with no left child. - center.right = right; - center.height = right.height + 1; - right.parent = center; - leavesSkipped = 0; - } else if (leavesSkipped == 2) { - leavesSkipped = 0; - } - } - } - - Node root() { - Node stackTop = this.stack; - if (stackTop.parent != null) { - throw new IllegalStateException(); - } - return stackTop; - } - } - - private abstract class LinkedTreeMapIterator implements Iterator { - Node next = header.next; - Node lastReturned = null; - int expectedModCount = modCount; - - LinkedTreeMapIterator() { - } - - public final boolean hasNext() { - return next != header; - } - - final Node nextNode() { - Node e = next; - if (e == header) { - throw new NoSuchElementException(); - } - if (modCount != expectedModCount) { - throw new ConcurrentModificationException(); - } - next = e.next; - return lastReturned = e; - } - - public final void remove() { - if (lastReturned == null) { - throw new IllegalStateException(); - } - removeInternal(lastReturned, true); - lastReturned = null; - expectedModCount = modCount; - } - } - - final class EntrySet extends AbstractSet> { - @Override public int size() { - return size; - } - - @Override public Iterator> iterator() { - return new LinkedTreeMapIterator>() { - public Entry next() { - return nextNode(); - } - }; - } - - @Override public boolean contains(Object o) { - return o instanceof Entry && findByEntry((Entry) o) != null; - } - - @Override public boolean remove(Object o) { - if (!(o instanceof Entry)) { - return false; - } - - Node node = findByEntry((Entry) o); - if (node == null) { - return false; - } - removeInternal(node, true); - return true; - } - - @Override public void clear() { - LinkedHashTreeMap.this.clear(); - } - } - - final class KeySet extends AbstractSet { - @Override public int size() { - return size; - } - - @Override public Iterator iterator() { - return new LinkedTreeMapIterator() { - public K next() { - return nextNode().key; - } - }; - } - - @Override public boolean contains(Object o) { - return containsKey(o); - } - - @Override public boolean remove(Object key) { - return removeInternalByKey(key) != null; - } - - @Override public void clear() { - LinkedHashTreeMap.this.clear(); - } - } - - /** - * If somebody is unlucky enough to have to serialize one of these, serialize - * it as a LinkedHashMap so that they won't need Gson on the other side to - * deserialize it. Using serialization defeats our DoS defence, so most apps - * shouldn't use it. - */ - private Object writeReplace() throws ObjectStreamException { - return new LinkedHashMap(this); - } - - private void readObject(ObjectInputStream in) throws IOException { - // Don't permit directly deserializing this class; writeReplace() should have written a replacement - throw new InvalidObjectException("Deserialization is unsupported"); - } -} diff --git a/minecraft_server/com/google/gson/internal/LinkedTreeMap.java b/minecraft_server/com/google/gson/internal/LinkedTreeMap.java deleted file mode 100644 index aaa8ce0..0000000 --- a/minecraft_server/com/google/gson/internal/LinkedTreeMap.java +++ /dev/null @@ -1,638 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * Copyright (C) 2012 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -import java.io.IOException; -import java.io.InvalidObjectException; -import java.io.ObjectInputStream; -import java.io.ObjectStreamException; -import java.io.Serializable; -import java.util.AbstractMap; -import java.util.AbstractSet; -import java.util.Comparator; -import java.util.ConcurrentModificationException; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.NoSuchElementException; -import java.util.Set; - -/** - * A map of comparable keys to values. Unlike {@code TreeMap}, this class uses - * insertion order for iteration order. Comparison order is only used as an - * optimization for efficient insertion and removal. - * - *

This implementation was derived from Android 4.1's TreeMap class. - */ -public final class LinkedTreeMap extends AbstractMap implements Serializable { - @SuppressWarnings({ "unchecked", "rawtypes" }) // to avoid Comparable>> - private static final Comparator NATURAL_ORDER = new Comparator() { - public int compare(Comparable a, Comparable b) { - return a.compareTo(b); - } - }; - - Comparator comparator; - Node root; - int size = 0; - int modCount = 0; - - // Used to preserve iteration order - final Node header = new Node(); - - /** - * Create a natural order, empty tree map whose keys must be mutually - * comparable and non-null. - */ - @SuppressWarnings("unchecked") // unsafe! this assumes K is comparable - public LinkedTreeMap() { - this((Comparator) NATURAL_ORDER); - } - - /** - * Create a tree map ordered by {@code comparator}. This map's keys may only - * be null if {@code comparator} permits. - * - * @param comparator the comparator to order elements with, or {@code null} to - * use the natural ordering. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) // unsafe! if comparator is null, this assumes K is comparable - public LinkedTreeMap(Comparator comparator) { - this.comparator = comparator != null - ? comparator - : (Comparator) NATURAL_ORDER; - } - - @Override public int size() { - return size; - } - - @Override public V get(Object key) { - Node node = findByObject(key); - return node != null ? node.value : null; - } - - @Override public boolean containsKey(Object key) { - return findByObject(key) != null; - } - - @Override public V put(K key, V value) { - if (key == null) { - throw new NullPointerException("key == null"); - } - Node created = find(key, true); - V result = created.value; - created.value = value; - return result; - } - - @Override public void clear() { - root = null; - size = 0; - modCount++; - - // Clear iteration order - Node header = this.header; - header.next = header.prev = header; - } - - @Override public V remove(Object key) { - Node node = removeInternalByKey(key); - return node != null ? node.value : null; - } - - /** - * Returns the node at or adjacent to the given key, creating it if requested. - * - * @throws ClassCastException if {@code key} and the tree's keys aren't - * mutually comparable. - */ - Node find(K key, boolean create) { - Comparator comparator = this.comparator; - Node nearest = root; - int comparison = 0; - - if (nearest != null) { - // Micro-optimization: avoid polymorphic calls to Comparator.compare(). - @SuppressWarnings("unchecked") // Throws a ClassCastException below if there's trouble. - Comparable comparableKey = (comparator == NATURAL_ORDER) - ? (Comparable) key - : null; - - while (true) { - comparison = (comparableKey != null) - ? comparableKey.compareTo(nearest.key) - : comparator.compare(key, nearest.key); - - // We found the requested key. - if (comparison == 0) { - return nearest; - } - - // If it exists, the key is in a subtree. Go deeper. - Node child = (comparison < 0) ? nearest.left : nearest.right; - if (child == null) { - break; - } - - nearest = child; - } - } - - // The key doesn't exist in this tree. - if (!create) { - return null; - } - - // Create the node and add it to the tree or the table. - Node header = this.header; - Node created; - if (nearest == null) { - // Check that the value is comparable if we didn't do any comparisons. - if (comparator == NATURAL_ORDER && !(key instanceof Comparable)) { - throw new ClassCastException(key.getClass().getName() + " is not Comparable"); - } - created = new Node(nearest, key, header, header.prev); - root = created; - } else { - created = new Node(nearest, key, header, header.prev); - if (comparison < 0) { // nearest.key is higher - nearest.left = created; - } else { // comparison > 0, nearest.key is lower - nearest.right = created; - } - rebalance(nearest, true); - } - size++; - modCount++; - - return created; - } - - @SuppressWarnings("unchecked") - Node findByObject(Object key) { - try { - return key != null ? find((K) key, false) : null; - } catch (ClassCastException e) { - return null; - } - } - - /** - * Returns this map's entry that has the same key and value as {@code - * entry}, or null if this map has no such entry. - * - *

This method uses the comparator for key equality rather than {@code - * equals}. If this map's comparator isn't consistent with equals (such as - * {@code String.CASE_INSENSITIVE_ORDER}), then {@code remove()} and {@code - * contains()} will violate the collections API. - */ - Node findByEntry(Entry entry) { - Node mine = findByObject(entry.getKey()); - boolean valuesEqual = mine != null && equal(mine.value, entry.getValue()); - return valuesEqual ? mine : null; - } - - private boolean equal(Object a, Object b) { - return a == b || (a != null && a.equals(b)); - } - - /** - * Removes {@code node} from this tree, rearranging the tree's structure as - * necessary. - * - * @param unlink true to also unlink this node from the iteration linked list. - */ - void removeInternal(Node node, boolean unlink) { - if (unlink) { - node.prev.next = node.next; - node.next.prev = node.prev; - } - - Node left = node.left; - Node right = node.right; - Node originalParent = node.parent; - if (left != null && right != null) { - - /* - * To remove a node with both left and right subtrees, move an - * adjacent node from one of those subtrees into this node's place. - * - * Removing the adjacent node may change this node's subtrees. This - * node may no longer have two subtrees once the adjacent node is - * gone! - */ - - Node adjacent = (left.height > right.height) ? left.last() : right.first(); - removeInternal(adjacent, false); // takes care of rebalance and size-- - - int leftHeight = 0; - left = node.left; - if (left != null) { - leftHeight = left.height; - adjacent.left = left; - left.parent = adjacent; - node.left = null; - } - - int rightHeight = 0; - right = node.right; - if (right != null) { - rightHeight = right.height; - adjacent.right = right; - right.parent = adjacent; - node.right = null; - } - - adjacent.height = Math.max(leftHeight, rightHeight) + 1; - replaceInParent(node, adjacent); - return; - } else if (left != null) { - replaceInParent(node, left); - node.left = null; - } else if (right != null) { - replaceInParent(node, right); - node.right = null; - } else { - replaceInParent(node, null); - } - - rebalance(originalParent, false); - size--; - modCount++; - } - - Node removeInternalByKey(Object key) { - Node node = findByObject(key); - if (node != null) { - removeInternal(node, true); - } - return node; - } - - private void replaceInParent(Node node, Node replacement) { - Node parent = node.parent; - node.parent = null; - if (replacement != null) { - replacement.parent = parent; - } - - if (parent != null) { - if (parent.left == node) { - parent.left = replacement; - } else { - assert (parent.right == node); - parent.right = replacement; - } - } else { - root = replacement; - } - } - - /** - * Rebalances the tree by making any AVL rotations necessary between the - * newly-unbalanced node and the tree's root. - * - * @param insert true if the node was unbalanced by an insert; false if it - * was by a removal. - */ - private void rebalance(Node unbalanced, boolean insert) { - for (Node node = unbalanced; node != null; node = node.parent) { - Node left = node.left; - Node right = node.right; - int leftHeight = left != null ? left.height : 0; - int rightHeight = right != null ? right.height : 0; - - int delta = leftHeight - rightHeight; - if (delta == -2) { - Node rightLeft = right.left; - Node rightRight = right.right; - int rightRightHeight = rightRight != null ? rightRight.height : 0; - int rightLeftHeight = rightLeft != null ? rightLeft.height : 0; - - int rightDelta = rightLeftHeight - rightRightHeight; - if (rightDelta == -1 || (rightDelta == 0 && !insert)) { - rotateLeft(node); // AVL right right - } else { - assert (rightDelta == 1); - rotateRight(right); // AVL right left - rotateLeft(node); - } - if (insert) { - break; // no further rotations will be necessary - } - - } else if (delta == 2) { - Node leftLeft = left.left; - Node leftRight = left.right; - int leftRightHeight = leftRight != null ? leftRight.height : 0; - int leftLeftHeight = leftLeft != null ? leftLeft.height : 0; - - int leftDelta = leftLeftHeight - leftRightHeight; - if (leftDelta == 1 || (leftDelta == 0 && !insert)) { - rotateRight(node); // AVL left left - } else { - assert (leftDelta == -1); - rotateLeft(left); // AVL left right - rotateRight(node); - } - if (insert) { - break; // no further rotations will be necessary - } - - } else if (delta == 0) { - node.height = leftHeight + 1; // leftHeight == rightHeight - if (insert) { - break; // the insert caused balance, so rebalancing is done! - } - - } else { - assert (delta == -1 || delta == 1); - node.height = Math.max(leftHeight, rightHeight) + 1; - if (!insert) { - break; // the height hasn't changed, so rebalancing is done! - } - } - } - } - - /** - * Rotates the subtree so that its root's right child is the new root. - */ - private void rotateLeft(Node root) { - Node left = root.left; - Node pivot = root.right; - Node pivotLeft = pivot.left; - Node pivotRight = pivot.right; - - // move the pivot's left child to the root's right - root.right = pivotLeft; - if (pivotLeft != null) { - pivotLeft.parent = root; - } - - replaceInParent(root, pivot); - - // move the root to the pivot's left - pivot.left = root; - root.parent = pivot; - - // fix heights - root.height = Math.max(left != null ? left.height : 0, - pivotLeft != null ? pivotLeft.height : 0) + 1; - pivot.height = Math.max(root.height, - pivotRight != null ? pivotRight.height : 0) + 1; - } - - /** - * Rotates the subtree so that its root's left child is the new root. - */ - private void rotateRight(Node root) { - Node pivot = root.left; - Node right = root.right; - Node pivotLeft = pivot.left; - Node pivotRight = pivot.right; - - // move the pivot's right child to the root's left - root.left = pivotRight; - if (pivotRight != null) { - pivotRight.parent = root; - } - - replaceInParent(root, pivot); - - // move the root to the pivot's right - pivot.right = root; - root.parent = pivot; - - // fixup heights - root.height = Math.max(right != null ? right.height : 0, - pivotRight != null ? pivotRight.height : 0) + 1; - pivot.height = Math.max(root.height, - pivotLeft != null ? pivotLeft.height : 0) + 1; - } - - private EntrySet entrySet; - private KeySet keySet; - - @Override public Set> entrySet() { - EntrySet result = entrySet; - return result != null ? result : (entrySet = new EntrySet()); - } - - @Override public Set keySet() { - KeySet result = keySet; - return result != null ? result : (keySet = new KeySet()); - } - - static final class Node implements Entry { - Node parent; - Node left; - Node right; - Node next; - Node prev; - final K key; - V value; - int height; - - /** Create the header entry */ - Node() { - key = null; - next = prev = this; - } - - /** Create a regular entry */ - Node(Node parent, K key, Node next, Node prev) { - this.parent = parent; - this.key = key; - this.height = 1; - this.next = next; - this.prev = prev; - prev.next = this; - next.prev = this; - } - - public K getKey() { - return key; - } - - public V getValue() { - return value; - } - - public V setValue(V value) { - V oldValue = this.value; - this.value = value; - return oldValue; - } - - @SuppressWarnings("rawtypes") - @Override public boolean equals(Object o) { - if (o instanceof Entry) { - Entry other = (Entry) o; - return (key == null ? other.getKey() == null : key.equals(other.getKey())) - && (value == null ? other.getValue() == null : value.equals(other.getValue())); - } - return false; - } - - @Override public int hashCode() { - return (key == null ? 0 : key.hashCode()) - ^ (value == null ? 0 : value.hashCode()); - } - - @Override public String toString() { - return key + "=" + value; - } - - /** - * Returns the first node in this subtree. - */ - public Node first() { - Node node = this; - Node child = node.left; - while (child != null) { - node = child; - child = node.left; - } - return node; - } - - /** - * Returns the last node in this subtree. - */ - public Node last() { - Node node = this; - Node child = node.right; - while (child != null) { - node = child; - child = node.right; - } - return node; - } - } - - private abstract class LinkedTreeMapIterator implements Iterator { - Node next = header.next; - Node lastReturned = null; - int expectedModCount = modCount; - - LinkedTreeMapIterator() { - } - - public final boolean hasNext() { - return next != header; - } - - final Node nextNode() { - Node e = next; - if (e == header) { - throw new NoSuchElementException(); - } - if (modCount != expectedModCount) { - throw new ConcurrentModificationException(); - } - next = e.next; - return lastReturned = e; - } - - public final void remove() { - if (lastReturned == null) { - throw new IllegalStateException(); - } - removeInternal(lastReturned, true); - lastReturned = null; - expectedModCount = modCount; - } - } - - class EntrySet extends AbstractSet> { - @Override public int size() { - return size; - } - - @Override public Iterator> iterator() { - return new LinkedTreeMapIterator>() { - public Entry next() { - return nextNode(); - } - }; - } - - @Override public boolean contains(Object o) { - return o instanceof Entry && findByEntry((Entry) o) != null; - } - - @Override public boolean remove(Object o) { - if (!(o instanceof Entry)) { - return false; - } - - Node node = findByEntry((Entry) o); - if (node == null) { - return false; - } - removeInternal(node, true); - return true; - } - - @Override public void clear() { - LinkedTreeMap.this.clear(); - } - } - - final class KeySet extends AbstractSet { - @Override public int size() { - return size; - } - - @Override public Iterator iterator() { - return new LinkedTreeMapIterator() { - public K next() { - return nextNode().key; - } - }; - } - - @Override public boolean contains(Object o) { - return containsKey(o); - } - - @Override public boolean remove(Object key) { - return removeInternalByKey(key) != null; - } - - @Override public void clear() { - LinkedTreeMap.this.clear(); - } - } - - /** - * If somebody is unlucky enough to have to serialize one of these, serialize - * it as a LinkedHashMap so that they won't need Gson on the other side to - * deserialize it. Using serialization defeats our DoS defence, so most apps - * shouldn't use it. - */ - private Object writeReplace() throws ObjectStreamException { - return new LinkedHashMap(this); - } - - private void readObject(ObjectInputStream in) throws IOException { - // Don't permit directly deserializing this class; writeReplace() should have written a replacement - throw new InvalidObjectException("Deserialization is unsupported"); - } -} diff --git a/minecraft_server/com/google/gson/internal/ObjectConstructor.java b/minecraft_server/com/google/gson/internal/ObjectConstructor.java deleted file mode 100644 index 6ef2060..0000000 --- a/minecraft_server/com/google/gson/internal/ObjectConstructor.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -/** - * Defines a generic object construction factory. The purpose of this class - * is to construct a default instance of a class that can be used for object - * navigation while deserialization from its JSON representation. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public interface ObjectConstructor { - - /** - * Returns a new instance. - */ - public T construct(); -} \ No newline at end of file diff --git a/minecraft_server/com/google/gson/internal/PreJava9DateFormatProvider.java b/minecraft_server/com/google/gson/internal/PreJava9DateFormatProvider.java deleted file mode 100644 index beb527c..0000000 --- a/minecraft_server/com/google/gson/internal/PreJava9DateFormatProvider.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2017 The Gson authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.gson.internal; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Locale; - -/** - * Provides DateFormats for US locale with patterns which were the default ones before Java 9. - */ -public class PreJava9DateFormatProvider { - - /** - * Returns the same DateFormat as {@code DateFormat.getDateInstance(style, Locale.US)} in Java 8 or below. - */ - public static DateFormat getUSDateFormat(int style) { - return new SimpleDateFormat(getDateFormatPattern(style), Locale.US); - } - - /** - * Returns the same DateFormat as {@code DateFormat.getDateTimeInstance(dateStyle, timeStyle, Locale.US)} - * in Java 8 or below. - */ - public static DateFormat getUSDateTimeFormat(int dateStyle, int timeStyle) { - String pattern = getDatePartOfDateTimePattern(dateStyle) + " " + getTimePartOfDateTimePattern(timeStyle); - return new SimpleDateFormat(pattern, Locale.US); - } - - private static String getDateFormatPattern(int style) { - switch (style) { - case DateFormat.SHORT: - return "M/d/yy"; - case DateFormat.MEDIUM: - return "MMM d, y"; - case DateFormat.LONG: - return "MMMM d, y"; - case DateFormat.FULL: - return "EEEE, MMMM d, y"; - default: - throw new IllegalArgumentException("Unknown DateFormat style: " + style); - } - } - - private static String getDatePartOfDateTimePattern(int dateStyle) { - switch (dateStyle) { - case DateFormat.SHORT: - return "M/d/yy"; - case DateFormat.MEDIUM: - return "MMM d, yyyy"; - case DateFormat.LONG: - return "MMMM d, yyyy"; - case DateFormat.FULL: - return "EEEE, MMMM d, yyyy"; - default: - throw new IllegalArgumentException("Unknown DateFormat style: " + dateStyle); - } - } - - private static String getTimePartOfDateTimePattern(int timeStyle) { - switch (timeStyle) { - case DateFormat.SHORT: - return "h:mm a"; - case DateFormat.MEDIUM: - return "h:mm:ss a"; - case DateFormat.FULL: - case DateFormat.LONG: - return "h:mm:ss a z"; - default: - throw new IllegalArgumentException("Unknown DateFormat style: " + timeStyle); - } - } -} diff --git a/minecraft_server/com/google/gson/internal/Primitives.java b/minecraft_server/com/google/gson/internal/Primitives.java deleted file mode 100644 index 2506fd0..0000000 --- a/minecraft_server/com/google/gson/internal/Primitives.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -import java.lang.reflect.Type; - -/** - * Contains static utility methods pertaining to primitive types and their - * corresponding wrapper types. - * - * @author Kevin Bourrillion - */ -public final class Primitives { - private Primitives() {} - - /** - * Returns true if this type is a primitive. - */ - public static boolean isPrimitive(Type type) { - return type instanceof Class && ((Class) type).isPrimitive(); - } - - /** - * Returns {@code true} if {@code type} is one of the nine - * primitive-wrapper types, such as {@link Integer}. - * - * @see Class#isPrimitive - */ - public static boolean isWrapperType(Type type) { - return type == Integer.class - || type == Float.class - || type == Byte.class - || type == Double.class - || type == Long.class - || type == Character.class - || type == Boolean.class - || type == Short.class - || type == Void.class; - } - - /** - * Returns the corresponding wrapper type of {@code type} if it is a primitive - * type; otherwise returns {@code type} itself. Idempotent. - *

-   *     wrap(int.class) == Integer.class
-   *     wrap(Integer.class) == Integer.class
-   *     wrap(String.class) == String.class
-   * 
- */ - @SuppressWarnings("unchecked") - public static Class wrap(Class type) { - if (type == int.class) return (Class) Integer.class; - if (type == float.class) return (Class) Float.class; - if (type == byte.class) return (Class) Byte.class; - if (type == double.class) return (Class) Double.class; - if (type == long.class) return (Class) Long.class; - if (type == char.class) return (Class) Character.class; - if (type == boolean.class) return (Class) Boolean.class; - if (type == short.class) return (Class) Short.class; - if (type == void.class) return (Class) Void.class; - return type; - } - - /** - * Returns the corresponding primitive type of {@code type} if it is a - * wrapper type; otherwise returns {@code type} itself. Idempotent. - *
-   *     unwrap(Integer.class) == int.class
-   *     unwrap(int.class) == int.class
-   *     unwrap(String.class) == String.class
-   * 
- */ - @SuppressWarnings("unchecked") - public static Class unwrap(Class type) { - if (type == Integer.class) return (Class) int.class; - if (type == Float.class) return (Class) float.class; - if (type == Byte.class) return (Class) byte.class; - if (type == Double.class) return (Class) double.class; - if (type == Long.class) return (Class) long.class; - if (type == Character.class) return (Class) char.class; - if (type == Boolean.class) return (Class) boolean.class; - if (type == Short.class) return (Class) short.class; - if (type == Void.class) return (Class) void.class; - return type; - } -} diff --git a/minecraft_server/com/google/gson/internal/Streams.java b/minecraft_server/com/google/gson/internal/Streams.java deleted file mode 100644 index ac99910..0000000 --- a/minecraft_server/com/google/gson/internal/Streams.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -import com.google.gson.JsonElement; -import com.google.gson.JsonIOException; -import com.google.gson.JsonNull; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSyntaxException; -import com.google.gson.internal.bind.TypeAdapters; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.google.gson.stream.MalformedJsonException; -import java.io.EOFException; -import java.io.IOException; -import java.io.Writer; - -/** - * Reads and writes GSON parse trees over streams. - */ -public final class Streams { - private Streams() { - throw new UnsupportedOperationException(); - } - - /** - * Takes a reader in any state and returns the next value as a JsonElement. - */ - public static JsonElement parse(JsonReader reader) throws JsonParseException { - boolean isEmpty = true; - try { - reader.peek(); - isEmpty = false; - return TypeAdapters.JSON_ELEMENT.read(reader); - } catch (EOFException e) { - /* - * For compatibility with JSON 1.5 and earlier, we return a JsonNull for - * empty documents instead of throwing. - */ - if (isEmpty) { - return JsonNull.INSTANCE; - } - // The stream ended prematurely so it is likely a syntax error. - throw new JsonSyntaxException(e); - } catch (MalformedJsonException e) { - throw new JsonSyntaxException(e); - } catch (IOException e) { - throw new JsonIOException(e); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - - /** - * Writes the JSON element to the writer, recursively. - */ - public static void write(JsonElement element, JsonWriter writer) throws IOException { - TypeAdapters.JSON_ELEMENT.write(writer, element); - } - - public static Writer writerForAppendable(Appendable appendable) { - return appendable instanceof Writer ? (Writer) appendable : new AppendableWriter(appendable); - } - - /** - * Adapts an {@link Appendable} so it can be passed anywhere a {@link Writer} - * is used. - */ - private static final class AppendableWriter extends Writer { - private final Appendable appendable; - private final CurrentWrite currentWrite = new CurrentWrite(); - - AppendableWriter(Appendable appendable) { - this.appendable = appendable; - } - - @Override public void write(char[] chars, int offset, int length) throws IOException { - currentWrite.chars = chars; - appendable.append(currentWrite, offset, offset + length); - } - - @Override public void write(int i) throws IOException { - appendable.append((char) i); - } - - @Override public void flush() {} - @Override public void close() {} - - /** - * A mutable char sequence pointing at a single char[]. - */ - static class CurrentWrite implements CharSequence { - char[] chars; - public int length() { - return chars.length; - } - public char charAt(int i) { - return chars[i]; - } - public CharSequence subSequence(int start, int end) { - return new String(chars, start, end - start); - } - } - } - -} diff --git a/minecraft_server/com/google/gson/internal/UnsafeAllocator.java b/minecraft_server/com/google/gson/internal/UnsafeAllocator.java deleted file mode 100644 index 999a2b5..0000000 --- a/minecraft_server/com/google/gson/internal/UnsafeAllocator.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal; - -import java.io.ObjectInputStream; -import java.io.ObjectStreamClass; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -/** - * Do sneaky things to allocate objects without invoking their constructors. - * - * @author Joel Leitch - * @author Jesse Wilson - */ -public abstract class UnsafeAllocator { - public abstract T newInstance(Class c) throws Exception; - - public static UnsafeAllocator create() { - // try JVM - // public class Unsafe { - // public Object allocateInstance(Class type); - // } - try { - Class unsafeClass = Class.forName("sun.misc.Unsafe"); - Field f = unsafeClass.getDeclaredField("theUnsafe"); - f.setAccessible(true); - final Object unsafe = f.get(null); - final Method allocateInstance = unsafeClass.getMethod("allocateInstance", Class.class); - return new UnsafeAllocator() { - @Override - @SuppressWarnings("unchecked") - public T newInstance(Class c) throws Exception { - assertInstantiable(c); - return (T) allocateInstance.invoke(unsafe, c); - } - }; - } catch (Exception ignored) { - } - - // try dalvikvm, post-gingerbread - // public class ObjectStreamClass { - // private static native int getConstructorId(Class c); - // private static native Object newInstance(Class instantiationClass, int methodId); - // } - try { - Method getConstructorId = ObjectStreamClass.class - .getDeclaredMethod("getConstructorId", Class.class); - getConstructorId.setAccessible(true); - final int constructorId = (Integer) getConstructorId.invoke(null, Object.class); - final Method newInstance = ObjectStreamClass.class - .getDeclaredMethod("newInstance", Class.class, int.class); - newInstance.setAccessible(true); - return new UnsafeAllocator() { - @Override - @SuppressWarnings("unchecked") - public T newInstance(Class c) throws Exception { - assertInstantiable(c); - return (T) newInstance.invoke(null, c, constructorId); - } - }; - } catch (Exception ignored) { - } - - // try dalvikvm, pre-gingerbread - // public class ObjectInputStream { - // private static native Object newInstance( - // Class instantiationClass, Class constructorClass); - // } - try { - final Method newInstance = ObjectInputStream.class - .getDeclaredMethod("newInstance", Class.class, Class.class); - newInstance.setAccessible(true); - return new UnsafeAllocator() { - @Override - @SuppressWarnings("unchecked") - public T newInstance(Class c) throws Exception { - assertInstantiable(c); - return (T) newInstance.invoke(null, c, Object.class); - } - }; - } catch (Exception ignored) { - } - - // give up - return new UnsafeAllocator() { - @Override - public T newInstance(Class c) { - throw new UnsupportedOperationException("Cannot allocate " + c); - } - }; - } - - /** - * Check if the class can be instantiated by unsafe allocator. If the instance has interface or abstract modifiers - * throw an {@link java.lang.UnsupportedOperationException} - * @param c instance of the class to be checked - */ - static void assertInstantiable(Class c) { - int modifiers = c.getModifiers(); - if (Modifier.isInterface(modifiers)) { - throw new UnsupportedOperationException("Interface can't be instantiated! Interface name: " + c.getName()); - } - if (Modifier.isAbstract(modifiers)) { - throw new UnsupportedOperationException("Abstract class can't be instantiated! Class name: " + c.getName()); - } - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/ArrayTypeAdapter.java b/minecraft_server/com/google/gson/internal/bind/ArrayTypeAdapter.java deleted file mode 100644 index 5610170..0000000 --- a/minecraft_server/com/google/gson/internal/bind/ArrayTypeAdapter.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import java.io.IOException; -import java.lang.reflect.Array; -import java.lang.reflect.GenericArrayType; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.internal.$Gson$Types; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; - -/** - * Adapt an array of objects. - */ -public final class ArrayTypeAdapter extends TypeAdapter { - public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { - @SuppressWarnings({"unchecked", "rawtypes"}) - @Override public TypeAdapter create(Gson gson, TypeToken typeToken) { - Type type = typeToken.getType(); - if (!(type instanceof GenericArrayType || type instanceof Class && ((Class) type).isArray())) { - return null; - } - - Type componentType = $Gson$Types.getArrayComponentType(type); - TypeAdapter componentTypeAdapter = gson.getAdapter(TypeToken.get(componentType)); - return new ArrayTypeAdapter( - gson, componentTypeAdapter, $Gson$Types.getRawType(componentType)); - } - }; - - private final Class componentType; - private final TypeAdapter componentTypeAdapter; - - public ArrayTypeAdapter(Gson context, TypeAdapter componentTypeAdapter, Class componentType) { - this.componentTypeAdapter = - new TypeAdapterRuntimeTypeWrapper(context, componentTypeAdapter, componentType); - this.componentType = componentType; - } - - @Override public Object read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - - List list = new ArrayList(); - in.beginArray(); - while (in.hasNext()) { - E instance = componentTypeAdapter.read(in); - list.add(instance); - } - in.endArray(); - - int size = list.size(); - Object array = Array.newInstance(componentType, size); - for (int i = 0; i < size; i++) { - Array.set(array, i, list.get(i)); - } - return array; - } - - @SuppressWarnings("unchecked") - @Override public void write(JsonWriter out, Object array) throws IOException { - if (array == null) { - out.nullValue(); - return; - } - - out.beginArray(); - for (int i = 0, length = Array.getLength(array); i < length; i++) { - E value = (E) Array.get(array, i); - componentTypeAdapter.write(out, value); - } - out.endArray(); - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java b/minecraft_server/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java deleted file mode 100644 index 1d57844..0000000 --- a/minecraft_server/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.internal.$Gson$Types; -import com.google.gson.internal.ConstructorConstructor; -import com.google.gson.internal.ObjectConstructor; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.Collection; - -/** - * Adapt a homogeneous collection of objects. - */ -public final class CollectionTypeAdapterFactory implements TypeAdapterFactory { - private final ConstructorConstructor constructorConstructor; - - public CollectionTypeAdapterFactory(ConstructorConstructor constructorConstructor) { - this.constructorConstructor = constructorConstructor; - } - - @Override - public TypeAdapter create(Gson gson, TypeToken typeToken) { - Type type = typeToken.getType(); - - Class rawType = typeToken.getRawType(); - if (!Collection.class.isAssignableFrom(rawType)) { - return null; - } - - Type elementType = $Gson$Types.getCollectionElementType(type, rawType); - TypeAdapter elementTypeAdapter = gson.getAdapter(TypeToken.get(elementType)); - ObjectConstructor constructor = constructorConstructor.get(typeToken); - - @SuppressWarnings({"unchecked", "rawtypes"}) // create() doesn't define a type parameter - TypeAdapter result = new Adapter(gson, elementType, elementTypeAdapter, constructor); - return result; - } - - private static final class Adapter extends TypeAdapter> { - private final TypeAdapter elementTypeAdapter; - private final ObjectConstructor> constructor; - - public Adapter(Gson context, Type elementType, - TypeAdapter elementTypeAdapter, - ObjectConstructor> constructor) { - this.elementTypeAdapter = - new TypeAdapterRuntimeTypeWrapper(context, elementTypeAdapter, elementType); - this.constructor = constructor; - } - - @Override public Collection read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - - Collection collection = constructor.construct(); - in.beginArray(); - while (in.hasNext()) { - E instance = elementTypeAdapter.read(in); - collection.add(instance); - } - in.endArray(); - return collection; - } - - @Override public void write(JsonWriter out, Collection collection) throws IOException { - if (collection == null) { - out.nullValue(); - return; - } - - out.beginArray(); - for (E element : collection) { - elementTypeAdapter.write(out, element); - } - out.endArray(); - } - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/DateTypeAdapter.java b/minecraft_server/com/google/gson/internal/bind/DateTypeAdapter.java deleted file mode 100644 index 6e84969..0000000 --- a/minecraft_server/com/google/gson/internal/bind/DateTypeAdapter.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import com.google.gson.Gson; -import com.google.gson.JsonSyntaxException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.internal.JavaVersion; -import com.google.gson.internal.PreJava9DateFormatProvider; -import com.google.gson.internal.bind.util.ISO8601Utils; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; - -import java.io.IOException; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.ParsePosition; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Locale; - -/** - * Adapter for Date. Although this class appears stateless, it is not. - * DateFormat captures its time zone and locale when it is created, which gives - * this class state. DateFormat isn't thread safe either, so this class has - * to synchronize its read and write methods. - */ -public final class DateTypeAdapter extends TypeAdapter { - public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { - @SuppressWarnings("unchecked") // we use a runtime check to make sure the 'T's equal - @Override public TypeAdapter create(Gson gson, TypeToken typeToken) { - return typeToken.getRawType() == Date.class ? (TypeAdapter) new DateTypeAdapter() : null; - } - }; - - /** - * List of 1 or more different date formats used for de-serialization attempts. - * The first of them (default US format) is used for serialization as well. - */ - private final List dateFormats = new ArrayList(); - - public DateTypeAdapter() { - dateFormats.add(DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.US)); - if (!Locale.getDefault().equals(Locale.US)) { - dateFormats.add(DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT)); - } - if (JavaVersion.isJava9OrLater()) { - dateFormats.add(PreJava9DateFormatProvider.getUSDateTimeFormat(DateFormat.DEFAULT, DateFormat.DEFAULT)); - } - } - - @Override public Date read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return deserializeToDate(in.nextString()); - } - - private synchronized Date deserializeToDate(String json) { - for (DateFormat dateFormat : dateFormats) { - try { - return dateFormat.parse(json); - } catch (ParseException ignored) {} - } - try { - return ISO8601Utils.parse(json, new ParsePosition(0)); - } catch (ParseException e) { - throw new JsonSyntaxException(json, e); - } - } - - @Override public synchronized void write(JsonWriter out, Date value) throws IOException { - if (value == null) { - out.nullValue(); - return; - } - String dateFormatAsString = dateFormats.get(0).format(value); - out.value(dateFormatAsString); - } - - -} diff --git a/minecraft_server/com/google/gson/internal/bind/DefaultDateTypeAdapter.java b/minecraft_server/com/google/gson/internal/bind/DefaultDateTypeAdapter.java deleted file mode 100644 index f56faee..0000000 --- a/minecraft_server/com/google/gson/internal/bind/DefaultDateTypeAdapter.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import java.io.IOException; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.ParsePosition; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Locale; - -import com.google.gson.JsonSyntaxException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.internal.$Gson$Preconditions; -import com.google.gson.internal.JavaVersion; -import com.google.gson.internal.PreJava9DateFormatProvider; -import com.google.gson.internal.bind.util.ISO8601Utils; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; - -/** - * This type adapter supports subclasses of date by defining a - * {@link DefaultDateTypeAdapter.DateType} and then using its {@code createAdapterFactory} - * methods. - * - * @author Inderjeet Singh - * @author Joel Leitch - */ -public final class DefaultDateTypeAdapter extends TypeAdapter { - private static final String SIMPLE_NAME = "DefaultDateTypeAdapter"; - - public static abstract class DateType { - public static final DateType DATE = new DateType(Date.class) { - @Override protected Date deserialize(Date date) { - return date; - } - }; - - private final Class dateClass; - - protected DateType(Class dateClass) { - this.dateClass = dateClass; - } - - protected abstract T deserialize(Date date); - - private final TypeAdapterFactory createFactory(DefaultDateTypeAdapter adapter) { - return TypeAdapters.newFactory(dateClass, adapter); - } - - public final TypeAdapterFactory createAdapterFactory(String datePattern) { - return createFactory(new DefaultDateTypeAdapter(this, datePattern)); - } - - public final TypeAdapterFactory createAdapterFactory(int style) { - return createFactory(new DefaultDateTypeAdapter(this, style)); - } - - public final TypeAdapterFactory createAdapterFactory(int dateStyle, int timeStyle) { - return createFactory(new DefaultDateTypeAdapter(this, dateStyle, timeStyle)); - } - - public final TypeAdapterFactory createDefaultsAdapterFactory() { - return createFactory(new DefaultDateTypeAdapter(this, DateFormat.DEFAULT, DateFormat.DEFAULT)); - } - } - - private final DateType dateType; - - /** - * List of 1 or more different date formats used for de-serialization attempts. - * The first of them is used for serialization as well. - */ - private final List dateFormats = new ArrayList(); - - private DefaultDateTypeAdapter(DateType dateType, String datePattern) { - this.dateType = $Gson$Preconditions.checkNotNull(dateType); - dateFormats.add(new SimpleDateFormat(datePattern, Locale.US)); - if (!Locale.getDefault().equals(Locale.US)) { - dateFormats.add(new SimpleDateFormat(datePattern)); - } - } - - private DefaultDateTypeAdapter(DateType dateType, int style) { - this.dateType = $Gson$Preconditions.checkNotNull(dateType); - dateFormats.add(DateFormat.getDateInstance(style, Locale.US)); - if (!Locale.getDefault().equals(Locale.US)) { - dateFormats.add(DateFormat.getDateInstance(style)); - } - if (JavaVersion.isJava9OrLater()) { - dateFormats.add(PreJava9DateFormatProvider.getUSDateFormat(style)); - } - } - - private DefaultDateTypeAdapter(DateType dateType, int dateStyle, int timeStyle) { - this.dateType = $Gson$Preconditions.checkNotNull(dateType); - dateFormats.add(DateFormat.getDateTimeInstance(dateStyle, timeStyle, Locale.US)); - if (!Locale.getDefault().equals(Locale.US)) { - dateFormats.add(DateFormat.getDateTimeInstance(dateStyle, timeStyle)); - } - if (JavaVersion.isJava9OrLater()) { - dateFormats.add(PreJava9DateFormatProvider.getUSDateTimeFormat(dateStyle, timeStyle)); - } - } - - // These methods need to be synchronized since JDK DateFormat classes are not thread-safe - // See issue 162 - @Override - public void write(JsonWriter out, Date value) throws IOException { - if (value == null) { - out.nullValue(); - return; - } - synchronized(dateFormats) { - String dateFormatAsString = dateFormats.get(0).format(value); - out.value(dateFormatAsString); - } - } - - @Override - public T read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - Date date = deserializeToDate(in.nextString()); - return dateType.deserialize(date); - } - - private Date deserializeToDate(String s) { - synchronized (dateFormats) { - for (DateFormat dateFormat : dateFormats) { - try { - return dateFormat.parse(s); - } catch (ParseException ignored) {} - } - } - - try { - return ISO8601Utils.parse(s, new ParsePosition(0)); - } catch (ParseException e) { - throw new JsonSyntaxException(s, e); - } - } - - @Override - public String toString() { - DateFormat defaultFormat = dateFormats.get(0); - if (defaultFormat instanceof SimpleDateFormat) { - return SIMPLE_NAME + '(' + ((SimpleDateFormat) defaultFormat).toPattern() + ')'; - } else { - return SIMPLE_NAME + '(' + defaultFormat.getClass().getSimpleName() + ')'; - } - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/JsonAdapterAnnotationTypeAdapterFactory.java b/minecraft_server/com/google/gson/internal/bind/JsonAdapterAnnotationTypeAdapterFactory.java deleted file mode 100644 index 13a7bb7..0000000 --- a/minecraft_server/com/google/gson/internal/bind/JsonAdapterAnnotationTypeAdapterFactory.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2014 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import com.google.gson.Gson; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonSerializer; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.internal.ConstructorConstructor; -import com.google.gson.reflect.TypeToken; - -/** - * Given a type T, looks for the annotation {@link JsonAdapter} and uses an instance of the - * specified class as the default type adapter. - * - * @since 2.3 - */ -public final class JsonAdapterAnnotationTypeAdapterFactory implements TypeAdapterFactory { - private final ConstructorConstructor constructorConstructor; - - public JsonAdapterAnnotationTypeAdapterFactory(ConstructorConstructor constructorConstructor) { - this.constructorConstructor = constructorConstructor; - } - - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken targetType) { - Class rawType = targetType.getRawType(); - JsonAdapter annotation = rawType.getAnnotation(JsonAdapter.class); - if (annotation == null) { - return null; - } - return (TypeAdapter) getTypeAdapter(constructorConstructor, gson, targetType, annotation); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) // Casts guarded by conditionals. - TypeAdapter getTypeAdapter(ConstructorConstructor constructorConstructor, Gson gson, - TypeToken type, JsonAdapter annotation) { - Object instance = constructorConstructor.get(TypeToken.get(annotation.value())).construct(); - - TypeAdapter typeAdapter; - if (instance instanceof TypeAdapter) { - typeAdapter = (TypeAdapter) instance; - } else if (instance instanceof TypeAdapterFactory) { - typeAdapter = ((TypeAdapterFactory) instance).create(gson, type); - } else if (instance instanceof JsonSerializer || instance instanceof JsonDeserializer) { - JsonSerializer serializer = instance instanceof JsonSerializer - ? (JsonSerializer) instance - : null; - JsonDeserializer deserializer = instance instanceof JsonDeserializer - ? (JsonDeserializer) instance - : null; - typeAdapter = new TreeTypeAdapter(serializer, deserializer, gson, type, null); - } else { - throw new IllegalArgumentException("Invalid attempt to bind an instance of " - + instance.getClass().getName() + " as a @JsonAdapter for " + type.toString() - + ". @JsonAdapter value must be a TypeAdapter, TypeAdapterFactory," - + " JsonSerializer or JsonDeserializer."); - } - - if (typeAdapter != null && annotation.nullSafe()) { - typeAdapter = typeAdapter.nullSafe(); - } - - return typeAdapter; - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/JsonTreeReader.java b/minecraft_server/com/google/gson/internal/bind/JsonTreeReader.java deleted file mode 100644 index 0954fb3..0000000 --- a/minecraft_server/com/google/gson/internal/bind/JsonTreeReader.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonNull; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import java.io.IOException; -import java.io.Reader; -import java.util.Iterator; -import java.util.Map; -import java.util.Arrays; - -/** - * This reader walks the elements of a JsonElement as if it was coming from a - * character stream. - * - * @author Jesse Wilson - */ -public final class JsonTreeReader extends JsonReader { - private static final Reader UNREADABLE_READER = new Reader() { - @Override public int read(char[] buffer, int offset, int count) throws IOException { - throw new AssertionError(); - } - @Override public void close() throws IOException { - throw new AssertionError(); - } - }; - private static final Object SENTINEL_CLOSED = new Object(); - - /* - * The nesting stack. Using a manual array rather than an ArrayList saves 20%. - */ - private Object[] stack = new Object[32]; - private int stackSize = 0; - - /* - * The path members. It corresponds directly to stack: At indices where the - * stack contains an object (EMPTY_OBJECT, DANGLING_NAME or NONEMPTY_OBJECT), - * pathNames contains the name at this scope. Where it contains an array - * (EMPTY_ARRAY, NONEMPTY_ARRAY) pathIndices contains the current index in - * that array. Otherwise the value is undefined, and we take advantage of that - * by incrementing pathIndices when doing so isn't useful. - */ - private String[] pathNames = new String[32]; - private int[] pathIndices = new int[32]; - - public JsonTreeReader(JsonElement element) { - super(UNREADABLE_READER); - push(element); - } - - @Override public void beginArray() throws IOException { - expect(JsonToken.BEGIN_ARRAY); - JsonArray array = (JsonArray) peekStack(); - push(array.iterator()); - pathIndices[stackSize - 1] = 0; - } - - @Override public void endArray() throws IOException { - expect(JsonToken.END_ARRAY); - popStack(); // empty iterator - popStack(); // array - if (stackSize > 0) { - pathIndices[stackSize - 1]++; - } - } - - @Override public void beginObject() throws IOException { - expect(JsonToken.BEGIN_OBJECT); - JsonObject object = (JsonObject) peekStack(); - push(object.entrySet().iterator()); - } - - @Override public void endObject() throws IOException { - expect(JsonToken.END_OBJECT); - popStack(); // empty iterator - popStack(); // object - if (stackSize > 0) { - pathIndices[stackSize - 1]++; - } - } - - @Override public boolean hasNext() throws IOException { - JsonToken token = peek(); - return token != JsonToken.END_OBJECT && token != JsonToken.END_ARRAY; - } - - @Override public JsonToken peek() throws IOException { - if (stackSize == 0) { - return JsonToken.END_DOCUMENT; - } - - Object o = peekStack(); - if (o instanceof Iterator) { - boolean isObject = stack[stackSize - 2] instanceof JsonObject; - Iterator iterator = (Iterator) o; - if (iterator.hasNext()) { - if (isObject) { - return JsonToken.NAME; - } else { - push(iterator.next()); - return peek(); - } - } else { - return isObject ? JsonToken.END_OBJECT : JsonToken.END_ARRAY; - } - } else if (o instanceof JsonObject) { - return JsonToken.BEGIN_OBJECT; - } else if (o instanceof JsonArray) { - return JsonToken.BEGIN_ARRAY; - } else if (o instanceof JsonPrimitive) { - JsonPrimitive primitive = (JsonPrimitive) o; - if (primitive.isString()) { - return JsonToken.STRING; - } else if (primitive.isBoolean()) { - return JsonToken.BOOLEAN; - } else if (primitive.isNumber()) { - return JsonToken.NUMBER; - } else { - throw new AssertionError(); - } - } else if (o instanceof JsonNull) { - return JsonToken.NULL; - } else if (o == SENTINEL_CLOSED) { - throw new IllegalStateException("JsonReader is closed"); - } else { - throw new AssertionError(); - } - } - - private Object peekStack() { - return stack[stackSize - 1]; - } - - private Object popStack() { - Object result = stack[--stackSize]; - stack[stackSize] = null; - return result; - } - - private void expect(JsonToken expected) throws IOException { - if (peek() != expected) { - throw new IllegalStateException( - "Expected " + expected + " but was " + peek() + locationString()); - } - } - - @Override public String nextName() throws IOException { - expect(JsonToken.NAME); - Iterator i = (Iterator) peekStack(); - Map.Entry entry = (Map.Entry) i.next(); - String result = (String) entry.getKey(); - pathNames[stackSize - 1] = result; - push(entry.getValue()); - return result; - } - - @Override public String nextString() throws IOException { - JsonToken token = peek(); - if (token != JsonToken.STRING && token != JsonToken.NUMBER) { - throw new IllegalStateException( - "Expected " + JsonToken.STRING + " but was " + token + locationString()); - } - String result = ((JsonPrimitive) popStack()).getAsString(); - if (stackSize > 0) { - pathIndices[stackSize - 1]++; - } - return result; - } - - @Override public boolean nextBoolean() throws IOException { - expect(JsonToken.BOOLEAN); - boolean result = ((JsonPrimitive) popStack()).getAsBoolean(); - if (stackSize > 0) { - pathIndices[stackSize - 1]++; - } - return result; - } - - @Override public void nextNull() throws IOException { - expect(JsonToken.NULL); - popStack(); - if (stackSize > 0) { - pathIndices[stackSize - 1]++; - } - } - - @Override public double nextDouble() throws IOException { - JsonToken token = peek(); - if (token != JsonToken.NUMBER && token != JsonToken.STRING) { - throw new IllegalStateException( - "Expected " + JsonToken.NUMBER + " but was " + token + locationString()); - } - double result = ((JsonPrimitive) peekStack()).getAsDouble(); - if (!isLenient() && (Double.isNaN(result) || Double.isInfinite(result))) { - throw new NumberFormatException("JSON forbids NaN and infinities: " + result); - } - popStack(); - if (stackSize > 0) { - pathIndices[stackSize - 1]++; - } - return result; - } - - @Override public long nextLong() throws IOException { - JsonToken token = peek(); - if (token != JsonToken.NUMBER && token != JsonToken.STRING) { - throw new IllegalStateException( - "Expected " + JsonToken.NUMBER + " but was " + token + locationString()); - } - long result = ((JsonPrimitive) peekStack()).getAsLong(); - popStack(); - if (stackSize > 0) { - pathIndices[stackSize - 1]++; - } - return result; - } - - @Override public int nextInt() throws IOException { - JsonToken token = peek(); - if (token != JsonToken.NUMBER && token != JsonToken.STRING) { - throw new IllegalStateException( - "Expected " + JsonToken.NUMBER + " but was " + token + locationString()); - } - int result = ((JsonPrimitive) peekStack()).getAsInt(); - popStack(); - if (stackSize > 0) { - pathIndices[stackSize - 1]++; - } - return result; - } - - JsonElement nextJsonElement() throws IOException { - final JsonToken peeked = peek(); - if (peeked == JsonToken.NAME - || peeked == JsonToken.END_ARRAY - || peeked == JsonToken.END_OBJECT - || peeked == JsonToken.END_DOCUMENT) { - throw new IllegalStateException("Unexpected " + peeked + " when reading a JsonElement."); - } - final JsonElement element = (JsonElement) peekStack(); - skipValue(); - return element; - } - - @Override public void close() throws IOException { - stack = new Object[] { SENTINEL_CLOSED }; - stackSize = 1; - } - - @Override public void skipValue() throws IOException { - if (peek() == JsonToken.NAME) { - nextName(); - pathNames[stackSize - 2] = "null"; - } else { - popStack(); - if (stackSize > 0) { - pathNames[stackSize - 1] = "null"; - } - } - if (stackSize > 0) { - pathIndices[stackSize - 1]++; - } - } - - @Override public String toString() { - return getClass().getSimpleName() + locationString(); - } - - public void promoteNameToValue() throws IOException { - expect(JsonToken.NAME); - Iterator i = (Iterator) peekStack(); - Map.Entry entry = (Map.Entry) i.next(); - push(entry.getValue()); - push(new JsonPrimitive((String) entry.getKey())); - } - - private void push(Object newTop) { - if (stackSize == stack.length) { - int newLength = stackSize * 2; - stack = Arrays.copyOf(stack, newLength); - pathIndices = Arrays.copyOf(pathIndices, newLength); - pathNames = Arrays.copyOf(pathNames, newLength); - } - stack[stackSize++] = newTop; - } - - @Override public String getPath() { - StringBuilder result = new StringBuilder().append('$'); - for (int i = 0; i < stackSize; i++) { - if (stack[i] instanceof JsonArray) { - if (++i < stackSize && stack[i] instanceof Iterator) { - result.append('[').append(pathIndices[i]).append(']'); - } - } else if (stack[i] instanceof JsonObject) { - if (++i < stackSize && stack[i] instanceof Iterator) { - result.append('.'); - if (pathNames[i] != null) { - result.append(pathNames[i]); - } - } - } - } - return result.toString(); - } - - private String locationString() { - return " at path " + getPath(); - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/JsonTreeWriter.java b/minecraft_server/com/google/gson/internal/bind/JsonTreeWriter.java deleted file mode 100644 index ee91e6b..0000000 --- a/minecraft_server/com/google/gson/internal/bind/JsonTreeWriter.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonNull; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.List; - -/** - * This writer creates a JsonElement. - */ -public final class JsonTreeWriter extends JsonWriter { - private static final Writer UNWRITABLE_WRITER = new Writer() { - @Override public void write(char[] buffer, int offset, int counter) { - throw new AssertionError(); - } - @Override public void flush() throws IOException { - throw new AssertionError(); - } - @Override public void close() throws IOException { - throw new AssertionError(); - } - }; - /** Added to the top of the stack when this writer is closed to cause following ops to fail. */ - private static final JsonPrimitive SENTINEL_CLOSED = new JsonPrimitive("closed"); - - /** The JsonElements and JsonArrays under modification, outermost to innermost. */ - private final List stack = new ArrayList(); - - /** The name for the next JSON object value. If non-null, the top of the stack is a JsonObject. */ - private String pendingName; - - /** the JSON element constructed by this writer. */ - private JsonElement product = JsonNull.INSTANCE; // TODO: is this really what we want?; - - public JsonTreeWriter() { - super(UNWRITABLE_WRITER); - } - - /** - * Returns the top level object produced by this writer. - */ - public JsonElement get() { - if (!stack.isEmpty()) { - throw new IllegalStateException("Expected one JSON element but was " + stack); - } - return product; - } - - private JsonElement peek() { - return stack.get(stack.size() - 1); - } - - private void put(JsonElement value) { - if (pendingName != null) { - if (!value.isJsonNull() || getSerializeNulls()) { - JsonObject object = (JsonObject) peek(); - object.add(pendingName, value); - } - pendingName = null; - } else if (stack.isEmpty()) { - product = value; - } else { - JsonElement element = peek(); - if (element instanceof JsonArray) { - ((JsonArray) element).add(value); - } else { - throw new IllegalStateException(); - } - } - } - - @Override public JsonWriter beginArray() throws IOException { - JsonArray array = new JsonArray(); - put(array); - stack.add(array); - return this; - } - - @Override public JsonWriter endArray() throws IOException { - if (stack.isEmpty() || pendingName != null) { - throw new IllegalStateException(); - } - JsonElement element = peek(); - if (element instanceof JsonArray) { - stack.remove(stack.size() - 1); - return this; - } - throw new IllegalStateException(); - } - - @Override public JsonWriter beginObject() throws IOException { - JsonObject object = new JsonObject(); - put(object); - stack.add(object); - return this; - } - - @Override public JsonWriter endObject() throws IOException { - if (stack.isEmpty() || pendingName != null) { - throw new IllegalStateException(); - } - JsonElement element = peek(); - if (element instanceof JsonObject) { - stack.remove(stack.size() - 1); - return this; - } - throw new IllegalStateException(); - } - - @Override public JsonWriter name(String name) throws IOException { - if (name == null) { - throw new NullPointerException("name == null"); - } - if (stack.isEmpty() || pendingName != null) { - throw new IllegalStateException(); - } - JsonElement element = peek(); - if (element instanceof JsonObject) { - pendingName = name; - return this; - } - throw new IllegalStateException(); - } - - @Override public JsonWriter value(String value) throws IOException { - if (value == null) { - return nullValue(); - } - put(new JsonPrimitive(value)); - return this; - } - - @Override public JsonWriter nullValue() throws IOException { - put(JsonNull.INSTANCE); - return this; - } - - @Override public JsonWriter value(boolean value) throws IOException { - put(new JsonPrimitive(value)); - return this; - } - - @Override public JsonWriter value(Boolean value) throws IOException { - if (value == null) { - return nullValue(); - } - put(new JsonPrimitive(value)); - return this; - } - - @Override public JsonWriter value(double value) throws IOException { - if (!isLenient() && (Double.isNaN(value) || Double.isInfinite(value))) { - throw new IllegalArgumentException("JSON forbids NaN and infinities: " + value); - } - put(new JsonPrimitive(value)); - return this; - } - - @Override public JsonWriter value(long value) throws IOException { - put(new JsonPrimitive(value)); - return this; - } - - @Override public JsonWriter value(Number value) throws IOException { - if (value == null) { - return nullValue(); - } - - if (!isLenient()) { - double d = value.doubleValue(); - if (Double.isNaN(d) || Double.isInfinite(d)) { - throw new IllegalArgumentException("JSON forbids NaN and infinities: " + value); - } - } - - put(new JsonPrimitive(value)); - return this; - } - - @Override public void flush() throws IOException { - } - - @Override public void close() throws IOException { - if (!stack.isEmpty()) { - throw new IOException("Incomplete document"); - } - stack.add(SENTINEL_CLOSED); - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/MapTypeAdapterFactory.java b/minecraft_server/com/google/gson/internal/bind/MapTypeAdapterFactory.java deleted file mode 100644 index 5a34a5d..0000000 --- a/minecraft_server/com/google/gson/internal/bind/MapTypeAdapterFactory.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSyntaxException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.internal.$Gson$Types; -import com.google.gson.internal.ConstructorConstructor; -import com.google.gson.internal.JsonReaderInternalAccess; -import com.google.gson.internal.ObjectConstructor; -import com.google.gson.internal.Streams; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Adapts maps to either JSON objects or JSON arrays. - * - *

Maps as JSON objects

- * For primitive keys or when complex map key serialization is not enabled, this - * converts Java {@link Map Maps} to JSON Objects. This requires that map keys - * can be serialized as strings; this is insufficient for some key types. For - * example, consider a map whose keys are points on a grid. The default JSON - * form encodes reasonably:
   {@code
- *   Map original = new LinkedHashMap();
- *   original.put(new Point(5, 6), "a");
- *   original.put(new Point(8, 8), "b");
- *   System.out.println(gson.toJson(original, type));
- * }
- * The above code prints this JSON object:
   {@code
- *   {
- *     "(5,6)": "a",
- *     "(8,8)": "b"
- *   }
- * }
- * But GSON is unable to deserialize this value because the JSON string name is - * just the {@link Object#toString() toString()} of the map key. Attempting to - * convert the above JSON to an object fails with a parse exception: - *
com.google.gson.JsonParseException: Expecting object found: "(5,6)"
- *   at com.google.gson.JsonObjectDeserializationVisitor.visitFieldUsingCustomHandler
- *   at com.google.gson.ObjectNavigator.navigateClassFields
- *   ...
- * - *

Maps as JSON arrays

- * An alternative approach taken by this type adapter when it is required and - * complex map key serialization is enabled is to encode maps as arrays of map - * entries. Each map entry is a two element array containing a key and a value. - * This approach is more flexible because any type can be used as the map's key; - * not just strings. But it's also less portable because the receiver of such - * JSON must be aware of the map entry convention. - * - *

Register this adapter when you are creating your GSON instance. - *

   {@code
- *   Gson gson = new GsonBuilder()
- *     .registerTypeAdapter(Map.class, new MapAsArrayTypeAdapter())
- *     .create();
- * }
- * This will change the structure of the JSON emitted by the code above. Now we - * get an array. In this case the arrays elements are map entries: - *
   {@code
- *   [
- *     [
- *       {
- *         "x": 5,
- *         "y": 6
- *       },
- *       "a",
- *     ],
- *     [
- *       {
- *         "x": 8,
- *         "y": 8
- *       },
- *       "b"
- *     ]
- *   ]
- * }
- * This format will serialize and deserialize just fine as long as this adapter - * is registered. - */ -public final class MapTypeAdapterFactory implements TypeAdapterFactory { - private final ConstructorConstructor constructorConstructor; - final boolean complexMapKeySerialization; - - public MapTypeAdapterFactory(ConstructorConstructor constructorConstructor, - boolean complexMapKeySerialization) { - this.constructorConstructor = constructorConstructor; - this.complexMapKeySerialization = complexMapKeySerialization; - } - - @Override public TypeAdapter create(Gson gson, TypeToken typeToken) { - Type type = typeToken.getType(); - - Class rawType = typeToken.getRawType(); - if (!Map.class.isAssignableFrom(rawType)) { - return null; - } - - Class rawTypeOfSrc = $Gson$Types.getRawType(type); - Type[] keyAndValueTypes = $Gson$Types.getMapKeyAndValueTypes(type, rawTypeOfSrc); - TypeAdapter keyAdapter = getKeyAdapter(gson, keyAndValueTypes[0]); - TypeAdapter valueAdapter = gson.getAdapter(TypeToken.get(keyAndValueTypes[1])); - ObjectConstructor constructor = constructorConstructor.get(typeToken); - - @SuppressWarnings({"unchecked", "rawtypes"}) - // we don't define a type parameter for the key or value types - TypeAdapter result = new Adapter(gson, keyAndValueTypes[0], keyAdapter, - keyAndValueTypes[1], valueAdapter, constructor); - return result; - } - - /** - * Returns a type adapter that writes the value as a string. - */ - private TypeAdapter getKeyAdapter(Gson context, Type keyType) { - return (keyType == boolean.class || keyType == Boolean.class) - ? TypeAdapters.BOOLEAN_AS_STRING - : context.getAdapter(TypeToken.get(keyType)); - } - - private final class Adapter extends TypeAdapter> { - private final TypeAdapter keyTypeAdapter; - private final TypeAdapter valueTypeAdapter; - private final ObjectConstructor> constructor; - - public Adapter(Gson context, Type keyType, TypeAdapter keyTypeAdapter, - Type valueType, TypeAdapter valueTypeAdapter, - ObjectConstructor> constructor) { - this.keyTypeAdapter = - new TypeAdapterRuntimeTypeWrapper(context, keyTypeAdapter, keyType); - this.valueTypeAdapter = - new TypeAdapterRuntimeTypeWrapper(context, valueTypeAdapter, valueType); - this.constructor = constructor; - } - - @Override public Map read(JsonReader in) throws IOException { - JsonToken peek = in.peek(); - if (peek == JsonToken.NULL) { - in.nextNull(); - return null; - } - - Map map = constructor.construct(); - - if (peek == JsonToken.BEGIN_ARRAY) { - in.beginArray(); - while (in.hasNext()) { - in.beginArray(); // entry array - K key = keyTypeAdapter.read(in); - V value = valueTypeAdapter.read(in); - V replaced = map.put(key, value); - if (replaced != null) { - throw new JsonSyntaxException("duplicate key: " + key); - } - in.endArray(); - } - in.endArray(); - } else { - in.beginObject(); - while (in.hasNext()) { - JsonReaderInternalAccess.INSTANCE.promoteNameToValue(in); - K key = keyTypeAdapter.read(in); - V value = valueTypeAdapter.read(in); - V replaced = map.put(key, value); - if (replaced != null) { - throw new JsonSyntaxException("duplicate key: " + key); - } - } - in.endObject(); - } - return map; - } - - @Override public void write(JsonWriter out, Map map) throws IOException { - if (map == null) { - out.nullValue(); - return; - } - - if (!complexMapKeySerialization) { - out.beginObject(); - for (Map.Entry entry : map.entrySet()) { - out.name(String.valueOf(entry.getKey())); - valueTypeAdapter.write(out, entry.getValue()); - } - out.endObject(); - return; - } - - boolean hasComplexKeys = false; - List keys = new ArrayList(map.size()); - - List values = new ArrayList(map.size()); - for (Map.Entry entry : map.entrySet()) { - JsonElement keyElement = keyTypeAdapter.toJsonTree(entry.getKey()); - keys.add(keyElement); - values.add(entry.getValue()); - hasComplexKeys |= keyElement.isJsonArray() || keyElement.isJsonObject(); - } - - if (hasComplexKeys) { - out.beginArray(); - for (int i = 0, size = keys.size(); i < size; i++) { - out.beginArray(); // entry array - Streams.write(keys.get(i), out); - valueTypeAdapter.write(out, values.get(i)); - out.endArray(); - } - out.endArray(); - } else { - out.beginObject(); - for (int i = 0, size = keys.size(); i < size; i++) { - JsonElement keyElement = keys.get(i); - out.name(keyToString(keyElement)); - valueTypeAdapter.write(out, values.get(i)); - } - out.endObject(); - } - } - - private String keyToString(JsonElement keyElement) { - if (keyElement.isJsonPrimitive()) { - JsonPrimitive primitive = keyElement.getAsJsonPrimitive(); - if (primitive.isNumber()) { - return String.valueOf(primitive.getAsNumber()); - } else if (primitive.isBoolean()) { - return Boolean.toString(primitive.getAsBoolean()); - } else if (primitive.isString()) { - return primitive.getAsString(); - } else { - throw new AssertionError(); - } - } else if (keyElement.isJsonNull()) { - return "null"; - } else { - throw new AssertionError(); - } - } - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/NumberTypeAdapter.java b/minecraft_server/com/google/gson/internal/bind/NumberTypeAdapter.java deleted file mode 100644 index f5efff2..0000000 --- a/minecraft_server/com/google/gson/internal/bind/NumberTypeAdapter.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2020 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import com.google.gson.Gson; -import com.google.gson.JsonSyntaxException; -import com.google.gson.ToNumberStrategy; -import com.google.gson.ToNumberPolicy; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; - -import java.io.IOException; - -/** - * Type adapter for {@link Number}. - */ -public final class NumberTypeAdapter extends TypeAdapter { - /** - * Gson default factory using {@link ToNumberPolicy#LAZILY_PARSED_NUMBER}. - */ - private static final TypeAdapterFactory LAZILY_PARSED_NUMBER_FACTORY = newFactory(ToNumberPolicy.LAZILY_PARSED_NUMBER); - - private final ToNumberStrategy toNumberStrategy; - - private NumberTypeAdapter(ToNumberStrategy toNumberStrategy) { - this.toNumberStrategy = toNumberStrategy; - } - - private static TypeAdapterFactory newFactory(ToNumberStrategy toNumberStrategy) { - final NumberTypeAdapter adapter = new NumberTypeAdapter(toNumberStrategy); - return new TypeAdapterFactory() { - @SuppressWarnings("unchecked") - @Override public TypeAdapter create(Gson gson, TypeToken type) { - return type.getRawType() == Number.class ? (TypeAdapter) adapter : null; - } - }; - } - - public static TypeAdapterFactory getFactory(ToNumberStrategy toNumberStrategy) { - if (toNumberStrategy == ToNumberPolicy.LAZILY_PARSED_NUMBER) { - return LAZILY_PARSED_NUMBER_FACTORY; - } else { - return newFactory(toNumberStrategy); - } - } - - @Override public Number read(JsonReader in) throws IOException { - JsonToken jsonToken = in.peek(); - switch (jsonToken) { - case NULL: - in.nextNull(); - return null; - case NUMBER: - case STRING: - return toNumberStrategy.readNumber(in); - default: - throw new JsonSyntaxException("Expecting number, got: " + jsonToken); - } - } - - @Override public void write(JsonWriter out, Number value) throws IOException { - out.value(value); - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/ObjectTypeAdapter.java b/minecraft_server/com/google/gson/internal/bind/ObjectTypeAdapter.java deleted file mode 100644 index b50f61e..0000000 --- a/minecraft_server/com/google/gson/internal/bind/ObjectTypeAdapter.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import com.google.gson.Gson; -import com.google.gson.ToNumberStrategy; -import com.google.gson.ToNumberPolicy; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.internal.LinkedTreeMap; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Adapts types whose static type is only 'Object'. Uses getClass() on - * serialization and a primitive/Map/List on deserialization. - */ -public final class ObjectTypeAdapter extends TypeAdapter { - /** - * Gson default factory using {@link ToNumberPolicy#DOUBLE}. - */ - private static final TypeAdapterFactory DOUBLE_FACTORY = newFactory(ToNumberPolicy.DOUBLE); - - private final Gson gson; - private final ToNumberStrategy toNumberStrategy; - - private ObjectTypeAdapter(Gson gson, ToNumberStrategy toNumberStrategy) { - this.gson = gson; - this.toNumberStrategy = toNumberStrategy; - } - - private static TypeAdapterFactory newFactory(final ToNumberStrategy toNumberStrategy) { - return new TypeAdapterFactory() { - @SuppressWarnings("unchecked") - @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (type.getRawType() == Object.class) { - return (TypeAdapter) new ObjectTypeAdapter(gson, toNumberStrategy); - } - return null; - } - }; - } - - public static TypeAdapterFactory getFactory(ToNumberStrategy toNumberStrategy) { - if (toNumberStrategy == ToNumberPolicy.DOUBLE) { - return DOUBLE_FACTORY; - } else { - return newFactory(toNumberStrategy); - } - } - - @Override public Object read(JsonReader in) throws IOException { - JsonToken token = in.peek(); - switch (token) { - case BEGIN_ARRAY: - List list = new ArrayList(); - in.beginArray(); - while (in.hasNext()) { - list.add(read(in)); - } - in.endArray(); - return list; - - case BEGIN_OBJECT: - Map map = new LinkedTreeMap(); - in.beginObject(); - while (in.hasNext()) { - map.put(in.nextName(), read(in)); - } - in.endObject(); - return map; - - case STRING: - return in.nextString(); - - case NUMBER: - return toNumberStrategy.readNumber(in); - - case BOOLEAN: - return in.nextBoolean(); - - case NULL: - in.nextNull(); - return null; - - default: - throw new IllegalStateException(); - } - } - - @SuppressWarnings("unchecked") - @Override public void write(JsonWriter out, Object value) throws IOException { - if (value == null) { - out.nullValue(); - return; - } - - TypeAdapter typeAdapter = (TypeAdapter) gson.getAdapter(value.getClass()); - if (typeAdapter instanceof ObjectTypeAdapter) { - out.beginObject(); - out.endObject(); - return; - } - - typeAdapter.write(out, value); - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/ReflectiveTypeAdapterFactory.java b/minecraft_server/com/google/gson/internal/bind/ReflectiveTypeAdapterFactory.java deleted file mode 100644 index 777e7de..0000000 --- a/minecraft_server/com/google/gson/internal/bind/ReflectiveTypeAdapterFactory.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import com.google.gson.FieldNamingStrategy; -import com.google.gson.Gson; -import com.google.gson.JsonSyntaxException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.internal.$Gson$Types; -import com.google.gson.internal.ConstructorConstructor; -import com.google.gson.internal.Excluder; -import com.google.gson.internal.ObjectConstructor; -import com.google.gson.internal.Primitives; -import com.google.gson.internal.reflect.ReflectionAccessor; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * Type adapter that reflects over the fields and methods of a class. - */ -public final class ReflectiveTypeAdapterFactory implements TypeAdapterFactory { - private final ConstructorConstructor constructorConstructor; - private final FieldNamingStrategy fieldNamingPolicy; - private final Excluder excluder; - private final JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory; - private final ReflectionAccessor accessor = ReflectionAccessor.getInstance(); - - public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor, - FieldNamingStrategy fieldNamingPolicy, Excluder excluder, - JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory) { - this.constructorConstructor = constructorConstructor; - this.fieldNamingPolicy = fieldNamingPolicy; - this.excluder = excluder; - this.jsonAdapterFactory = jsonAdapterFactory; - } - - public boolean excludeField(Field f, boolean serialize) { - return excludeField(f, serialize, excluder); - } - - static boolean excludeField(Field f, boolean serialize, Excluder excluder) { - return !excluder.excludeClass(f.getType(), serialize) && !excluder.excludeField(f, serialize); - } - - /** first element holds the default name */ - private List getFieldNames(Field f) { - SerializedName annotation = f.getAnnotation(SerializedName.class); - if (annotation == null) { - String name = fieldNamingPolicy.translateName(f); - return Collections.singletonList(name); - } - - String serializedName = annotation.value(); - String[] alternates = annotation.alternate(); - if (alternates.length == 0) { - return Collections.singletonList(serializedName); - } - - List fieldNames = new ArrayList(alternates.length + 1); - fieldNames.add(serializedName); - for (String alternate : alternates) { - fieldNames.add(alternate); - } - return fieldNames; - } - - @Override public TypeAdapter create(Gson gson, final TypeToken type) { - Class raw = type.getRawType(); - - if (!Object.class.isAssignableFrom(raw)) { - return null; // it's a primitive! - } - - ObjectConstructor constructor = constructorConstructor.get(type); - return new Adapter(constructor, getBoundFields(gson, type, raw)); - } - - private ReflectiveTypeAdapterFactory.BoundField createBoundField( - final Gson context, final Field field, final String name, - final TypeToken fieldType, boolean serialize, boolean deserialize) { - final boolean isPrimitive = Primitives.isPrimitive(fieldType.getRawType()); - // special casing primitives here saves ~5% on Android... - JsonAdapter annotation = field.getAnnotation(JsonAdapter.class); - TypeAdapter mapped = null; - if (annotation != null) { - mapped = jsonAdapterFactory.getTypeAdapter( - constructorConstructor, context, fieldType, annotation); - } - final boolean jsonAdapterPresent = mapped != null; - if (mapped == null) mapped = context.getAdapter(fieldType); - - final TypeAdapter typeAdapter = mapped; - return new ReflectiveTypeAdapterFactory.BoundField(name, serialize, deserialize) { - @SuppressWarnings({"unchecked", "rawtypes"}) // the type adapter and field type always agree - @Override void write(JsonWriter writer, Object value) - throws IOException, IllegalAccessException { - Object fieldValue = field.get(value); - TypeAdapter t = jsonAdapterPresent ? typeAdapter - : new TypeAdapterRuntimeTypeWrapper(context, typeAdapter, fieldType.getType()); - t.write(writer, fieldValue); - } - @Override void read(JsonReader reader, Object value) - throws IOException, IllegalAccessException { - Object fieldValue = typeAdapter.read(reader); - if (fieldValue != null || !isPrimitive) { - field.set(value, fieldValue); - } - } - @Override public boolean writeField(Object value) throws IOException, IllegalAccessException { - if (!serialized) return false; - Object fieldValue = field.get(value); - return fieldValue != value; // avoid recursion for example for Throwable.cause - } - }; - } - - private Map getBoundFields(Gson context, TypeToken type, Class raw) { - Map result = new LinkedHashMap(); - if (raw.isInterface()) { - return result; - } - - Type declaredType = type.getType(); - while (raw != Object.class) { - Field[] fields = raw.getDeclaredFields(); - for (Field field : fields) { - boolean serialize = excludeField(field, true); - boolean deserialize = excludeField(field, false); - if (!serialize && !deserialize) { - continue; - } - accessor.makeAccessible(field); - Type fieldType = $Gson$Types.resolve(type.getType(), raw, field.getGenericType()); - List fieldNames = getFieldNames(field); - BoundField previous = null; - for (int i = 0, size = fieldNames.size(); i < size; ++i) { - String name = fieldNames.get(i); - if (i != 0) serialize = false; // only serialize the default name - BoundField boundField = createBoundField(context, field, name, - TypeToken.get(fieldType), serialize, deserialize); - BoundField replaced = result.put(name, boundField); - if (previous == null) previous = replaced; - } - if (previous != null) { - throw new IllegalArgumentException(declaredType - + " declares multiple JSON fields named " + previous.name); - } - } - type = TypeToken.get($Gson$Types.resolve(type.getType(), raw, raw.getGenericSuperclass())); - raw = type.getRawType(); - } - return result; - } - - static abstract class BoundField { - final String name; - final boolean serialized; - final boolean deserialized; - - protected BoundField(String name, boolean serialized, boolean deserialized) { - this.name = name; - this.serialized = serialized; - this.deserialized = deserialized; - } - abstract boolean writeField(Object value) throws IOException, IllegalAccessException; - abstract void write(JsonWriter writer, Object value) throws IOException, IllegalAccessException; - abstract void read(JsonReader reader, Object value) throws IOException, IllegalAccessException; - } - - public static final class Adapter extends TypeAdapter { - private final ObjectConstructor constructor; - private final Map boundFields; - - Adapter(ObjectConstructor constructor, Map boundFields) { - this.constructor = constructor; - this.boundFields = boundFields; - } - - @Override public T read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - - T instance = constructor.construct(); - - try { - in.beginObject(); - while (in.hasNext()) { - String name = in.nextName(); - BoundField field = boundFields.get(name); - if (field == null || !field.deserialized) { - in.skipValue(); - } else { - field.read(in, instance); - } - } - } catch (IllegalStateException e) { - throw new JsonSyntaxException(e); - } catch (IllegalAccessException e) { - throw new AssertionError(e); - } - in.endObject(); - return instance; - } - - @Override public void write(JsonWriter out, T value) throws IOException { - if (value == null) { - out.nullValue(); - return; - } - - out.beginObject(); - try { - for (BoundField boundField : boundFields.values()) { - if (boundField.writeField(value)) { - out.name(boundField.name); - boundField.write(out, value); - } - } - } catch (IllegalAccessException e) { - throw new AssertionError(e); - } - out.endObject(); - } - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/TreeTypeAdapter.java b/minecraft_server/com/google/gson/internal/bind/TreeTypeAdapter.java deleted file mode 100644 index a5c6c5d..0000000 --- a/minecraft_server/com/google/gson/internal/bind/TreeTypeAdapter.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import com.google.gson.Gson; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.internal.$Gson$Preconditions; -import com.google.gson.internal.Streams; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.lang.reflect.Type; - -/** - * Adapts a Gson 1.x tree-style adapter as a streaming TypeAdapter. Since the - * tree adapter may be serialization-only or deserialization-only, this class - * has a facility to lookup a delegate type adapter on demand. - */ -public final class TreeTypeAdapter extends TypeAdapter { - private final JsonSerializer serializer; - private final JsonDeserializer deserializer; - final Gson gson; - private final TypeToken typeToken; - private final TypeAdapterFactory skipPast; - private final GsonContextImpl context = new GsonContextImpl(); - - /** The delegate is lazily created because it may not be needed, and creating it may fail. */ - private TypeAdapter delegate; - - public TreeTypeAdapter(JsonSerializer serializer, JsonDeserializer deserializer, - Gson gson, TypeToken typeToken, TypeAdapterFactory skipPast) { - this.serializer = serializer; - this.deserializer = deserializer; - this.gson = gson; - this.typeToken = typeToken; - this.skipPast = skipPast; - } - - @Override public T read(JsonReader in) throws IOException { - if (deserializer == null) { - return delegate().read(in); - } - JsonElement value = Streams.parse(in); - if (value.isJsonNull()) { - return null; - } - return deserializer.deserialize(value, typeToken.getType(), context); - } - - @Override public void write(JsonWriter out, T value) throws IOException { - if (serializer == null) { - delegate().write(out, value); - return; - } - if (value == null) { - out.nullValue(); - return; - } - JsonElement tree = serializer.serialize(value, typeToken.getType(), context); - Streams.write(tree, out); - } - - private TypeAdapter delegate() { - TypeAdapter d = delegate; - return d != null - ? d - : (delegate = gson.getDelegateAdapter(skipPast, typeToken)); - } - - /** - * Returns a new factory that will match each type against {@code exactType}. - */ - public static TypeAdapterFactory newFactory(TypeToken exactType, Object typeAdapter) { - return new SingleTypeFactory(typeAdapter, exactType, false, null); - } - - /** - * Returns a new factory that will match each type and its raw type against - * {@code exactType}. - */ - public static TypeAdapterFactory newFactoryWithMatchRawType( - TypeToken exactType, Object typeAdapter) { - // only bother matching raw types if exact type is a raw type - boolean matchRawType = exactType.getType() == exactType.getRawType(); - return new SingleTypeFactory(typeAdapter, exactType, matchRawType, null); - } - - /** - * Returns a new factory that will match each type's raw type for assignability - * to {@code hierarchyType}. - */ - public static TypeAdapterFactory newTypeHierarchyFactory( - Class hierarchyType, Object typeAdapter) { - return new SingleTypeFactory(typeAdapter, null, false, hierarchyType); - } - - private static final class SingleTypeFactory implements TypeAdapterFactory { - private final TypeToken exactType; - private final boolean matchRawType; - private final Class hierarchyType; - private final JsonSerializer serializer; - private final JsonDeserializer deserializer; - - SingleTypeFactory(Object typeAdapter, TypeToken exactType, boolean matchRawType, - Class hierarchyType) { - serializer = typeAdapter instanceof JsonSerializer - ? (JsonSerializer) typeAdapter - : null; - deserializer = typeAdapter instanceof JsonDeserializer - ? (JsonDeserializer) typeAdapter - : null; - $Gson$Preconditions.checkArgument(serializer != null || deserializer != null); - this.exactType = exactType; - this.matchRawType = matchRawType; - this.hierarchyType = hierarchyType; - } - - @SuppressWarnings("unchecked") // guarded by typeToken.equals() call - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - boolean matches = exactType != null - ? exactType.equals(type) || matchRawType && exactType.getType() == type.getRawType() - : hierarchyType.isAssignableFrom(type.getRawType()); - return matches - ? new TreeTypeAdapter((JsonSerializer) serializer, - (JsonDeserializer) deserializer, gson, type, this) - : null; - } - } - - private final class GsonContextImpl implements JsonSerializationContext, JsonDeserializationContext { - @Override public JsonElement serialize(Object src) { - return gson.toJsonTree(src); - } - @Override public JsonElement serialize(Object src, Type typeOfSrc) { - return gson.toJsonTree(src, typeOfSrc); - } - @SuppressWarnings("unchecked") - @Override public R deserialize(JsonElement json, Type typeOfT) throws JsonParseException { - return (R) gson.fromJson(json, typeOfT); - } - }; -} diff --git a/minecraft_server/com/google/gson/internal/bind/TypeAdapterRuntimeTypeWrapper.java b/minecraft_server/com/google/gson/internal/bind/TypeAdapterRuntimeTypeWrapper.java deleted file mode 100644 index 5bca700..0000000 --- a/minecraft_server/com/google/gson/internal/bind/TypeAdapterRuntimeTypeWrapper.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.gson.internal.bind; - -import java.io.IOException; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -final class TypeAdapterRuntimeTypeWrapper extends TypeAdapter { - private final Gson context; - private final TypeAdapter delegate; - private final Type type; - - TypeAdapterRuntimeTypeWrapper(Gson context, TypeAdapter delegate, Type type) { - this.context = context; - this.delegate = delegate; - this.type = type; - } - - @Override - public T read(JsonReader in) throws IOException { - return delegate.read(in); - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public void write(JsonWriter out, T value) throws IOException { - // Order of preference for choosing type adapters - // First preference: a type adapter registered for the runtime type - // Second preference: a type adapter registered for the declared type - // Third preference: reflective type adapter for the runtime type (if it is a sub class of the declared type) - // Fourth preference: reflective type adapter for the declared type - - TypeAdapter chosen = delegate; - Type runtimeType = getRuntimeTypeIfMoreSpecific(type, value); - if (runtimeType != type) { - TypeAdapter runtimeTypeAdapter = context.getAdapter(TypeToken.get(runtimeType)); - if (!(runtimeTypeAdapter instanceof ReflectiveTypeAdapterFactory.Adapter)) { - // The user registered a type adapter for the runtime type, so we will use that - chosen = runtimeTypeAdapter; - } else if (!(delegate instanceof ReflectiveTypeAdapterFactory.Adapter)) { - // The user registered a type adapter for Base class, so we prefer it over the - // reflective type adapter for the runtime type - chosen = delegate; - } else { - // Use the type adapter for runtime type - chosen = runtimeTypeAdapter; - } - } - chosen.write(out, value); - } - - /** - * Finds a compatible runtime type if it is more specific - */ - private Type getRuntimeTypeIfMoreSpecific(Type type, Object value) { - if (value != null - && (type == Object.class || type instanceof TypeVariable || type instanceof Class)) { - type = value.getClass(); - } - return type; - } -} diff --git a/minecraft_server/com/google/gson/internal/bind/TypeAdapters.java b/minecraft_server/com/google/gson/internal/bind/TypeAdapters.java deleted file mode 100644 index cd5ba2e..0000000 --- a/minecraft_server/com/google/gson/internal/bind/TypeAdapters.java +++ /dev/null @@ -1,880 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.bind; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.net.InetAddress; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.Calendar; -import java.util.Currency; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.StringTokenizer; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicIntegerArray; - -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonIOException; -import com.google.gson.JsonNull; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSyntaxException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.internal.LazilyParsedNumber; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; - -/** - * Type adapters for basic types. - */ -public final class TypeAdapters { - private TypeAdapters() { - throw new UnsupportedOperationException(); - } - - @SuppressWarnings("rawtypes") - public static final TypeAdapter CLASS = new TypeAdapter() { - @Override - public void write(JsonWriter out, Class value) throws IOException { - throw new UnsupportedOperationException("Attempted to serialize java.lang.Class: " - + value.getName() + ". Forgot to register a type adapter?"); - } - @Override - public Class read(JsonReader in) throws IOException { - throw new UnsupportedOperationException( - "Attempted to deserialize a java.lang.Class. Forgot to register a type adapter?"); - } - }.nullSafe(); - - public static final TypeAdapterFactory CLASS_FACTORY = newFactory(Class.class, CLASS); - - public static final TypeAdapter BIT_SET = new TypeAdapter() { - @Override public BitSet read(JsonReader in) throws IOException { - BitSet bitset = new BitSet(); - in.beginArray(); - int i = 0; - JsonToken tokenType = in.peek(); - while (tokenType != JsonToken.END_ARRAY) { - boolean set; - switch (tokenType) { - case NUMBER: - set = in.nextInt() != 0; - break; - case BOOLEAN: - set = in.nextBoolean(); - break; - case STRING: - String stringValue = in.nextString(); - try { - set = Integer.parseInt(stringValue) != 0; - } catch (NumberFormatException e) { - throw new JsonSyntaxException( - "Error: Expecting: bitset number value (1, 0), Found: " + stringValue); - } - break; - default: - throw new JsonSyntaxException("Invalid bitset value type: " + tokenType); - } - if (set) { - bitset.set(i); - } - ++i; - tokenType = in.peek(); - } - in.endArray(); - return bitset; - } - - @Override public void write(JsonWriter out, BitSet src) throws IOException { - out.beginArray(); - for (int i = 0, length = src.length(); i < length; i++) { - int value = (src.get(i)) ? 1 : 0; - out.value(value); - } - out.endArray(); - } - }.nullSafe(); - - public static final TypeAdapterFactory BIT_SET_FACTORY = newFactory(BitSet.class, BIT_SET); - - public static final TypeAdapter BOOLEAN = new TypeAdapter() { - @Override - public Boolean read(JsonReader in) throws IOException { - JsonToken peek = in.peek(); - if (peek == JsonToken.NULL) { - in.nextNull(); - return null; - } else if (peek == JsonToken.STRING) { - // support strings for compatibility with GSON 1.7 - return Boolean.parseBoolean(in.nextString()); - } - return in.nextBoolean(); - } - @Override - public void write(JsonWriter out, Boolean value) throws IOException { - out.value(value); - } - }; - - /** - * Writes a boolean as a string. Useful for map keys, where booleans aren't - * otherwise permitted. - */ - public static final TypeAdapter BOOLEAN_AS_STRING = new TypeAdapter() { - @Override public Boolean read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return Boolean.valueOf(in.nextString()); - } - - @Override public void write(JsonWriter out, Boolean value) throws IOException { - out.value(value == null ? "null" : value.toString()); - } - }; - - public static final TypeAdapterFactory BOOLEAN_FACTORY - = newFactory(boolean.class, Boolean.class, BOOLEAN); - - public static final TypeAdapter BYTE = new TypeAdapter() { - @Override - public Number read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - try { - int intValue = in.nextInt(); - return (byte) intValue; - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - @Override - public void write(JsonWriter out, Number value) throws IOException { - out.value(value); - } - }; - - public static final TypeAdapterFactory BYTE_FACTORY - = newFactory(byte.class, Byte.class, BYTE); - - public static final TypeAdapter SHORT = new TypeAdapter() { - @Override - public Number read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - try { - return (short) in.nextInt(); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - @Override - public void write(JsonWriter out, Number value) throws IOException { - out.value(value); - } - }; - - public static final TypeAdapterFactory SHORT_FACTORY - = newFactory(short.class, Short.class, SHORT); - - public static final TypeAdapter INTEGER = new TypeAdapter() { - @Override - public Number read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - try { - return in.nextInt(); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - @Override - public void write(JsonWriter out, Number value) throws IOException { - out.value(value); - } - }; - public static final TypeAdapterFactory INTEGER_FACTORY - = newFactory(int.class, Integer.class, INTEGER); - - public static final TypeAdapter ATOMIC_INTEGER = new TypeAdapter() { - @Override public AtomicInteger read(JsonReader in) throws IOException { - try { - return new AtomicInteger(in.nextInt()); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - @Override public void write(JsonWriter out, AtomicInteger value) throws IOException { - out.value(value.get()); - } - }.nullSafe(); - public static final TypeAdapterFactory ATOMIC_INTEGER_FACTORY = - newFactory(AtomicInteger.class, TypeAdapters.ATOMIC_INTEGER); - - public static final TypeAdapter ATOMIC_BOOLEAN = new TypeAdapter() { - @Override public AtomicBoolean read(JsonReader in) throws IOException { - return new AtomicBoolean(in.nextBoolean()); - } - @Override public void write(JsonWriter out, AtomicBoolean value) throws IOException { - out.value(value.get()); - } - }.nullSafe(); - public static final TypeAdapterFactory ATOMIC_BOOLEAN_FACTORY = - newFactory(AtomicBoolean.class, TypeAdapters.ATOMIC_BOOLEAN); - - public static final TypeAdapter ATOMIC_INTEGER_ARRAY = new TypeAdapter() { - @Override public AtomicIntegerArray read(JsonReader in) throws IOException { - List list = new ArrayList(); - in.beginArray(); - while (in.hasNext()) { - try { - int integer = in.nextInt(); - list.add(integer); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - in.endArray(); - int length = list.size(); - AtomicIntegerArray array = new AtomicIntegerArray(length); - for (int i = 0; i < length; ++i) { - array.set(i, list.get(i)); - } - return array; - } - @Override public void write(JsonWriter out, AtomicIntegerArray value) throws IOException { - out.beginArray(); - for (int i = 0, length = value.length(); i < length; i++) { - out.value(value.get(i)); - } - out.endArray(); - } - }.nullSafe(); - public static final TypeAdapterFactory ATOMIC_INTEGER_ARRAY_FACTORY = - newFactory(AtomicIntegerArray.class, TypeAdapters.ATOMIC_INTEGER_ARRAY); - - public static final TypeAdapter LONG = new TypeAdapter() { - @Override - public Number read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - try { - return in.nextLong(); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - @Override - public void write(JsonWriter out, Number value) throws IOException { - out.value(value); - } - }; - - public static final TypeAdapter FLOAT = new TypeAdapter() { - @Override - public Number read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return (float) in.nextDouble(); - } - @Override - public void write(JsonWriter out, Number value) throws IOException { - out.value(value); - } - }; - - public static final TypeAdapter DOUBLE = new TypeAdapter() { - @Override - public Number read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return in.nextDouble(); - } - @Override - public void write(JsonWriter out, Number value) throws IOException { - out.value(value); - } - }; - - public static final TypeAdapter CHARACTER = new TypeAdapter() { - @Override - public Character read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - String str = in.nextString(); - if (str.length() != 1) { - throw new JsonSyntaxException("Expecting character, got: " + str); - } - return str.charAt(0); - } - @Override - public void write(JsonWriter out, Character value) throws IOException { - out.value(value == null ? null : String.valueOf(value)); - } - }; - - public static final TypeAdapterFactory CHARACTER_FACTORY - = newFactory(char.class, Character.class, CHARACTER); - - public static final TypeAdapter STRING = new TypeAdapter() { - @Override - public String read(JsonReader in) throws IOException { - JsonToken peek = in.peek(); - if (peek == JsonToken.NULL) { - in.nextNull(); - return null; - } - /* coerce booleans to strings for backwards compatibility */ - if (peek == JsonToken.BOOLEAN) { - return Boolean.toString(in.nextBoolean()); - } - return in.nextString(); - } - @Override - public void write(JsonWriter out, String value) throws IOException { - out.value(value); - } - }; - - public static final TypeAdapter BIG_DECIMAL = new TypeAdapter() { - @Override public BigDecimal read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - try { - return new BigDecimal(in.nextString()); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - - @Override public void write(JsonWriter out, BigDecimal value) throws IOException { - out.value(value); - } - }; - - public static final TypeAdapter BIG_INTEGER = new TypeAdapter() { - @Override public BigInteger read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - try { - return new BigInteger(in.nextString()); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - - @Override public void write(JsonWriter out, BigInteger value) throws IOException { - out.value(value); - } - }; - - public static final TypeAdapterFactory STRING_FACTORY = newFactory(String.class, STRING); - - public static final TypeAdapter STRING_BUILDER = new TypeAdapter() { - @Override - public StringBuilder read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return new StringBuilder(in.nextString()); - } - @Override - public void write(JsonWriter out, StringBuilder value) throws IOException { - out.value(value == null ? null : value.toString()); - } - }; - - public static final TypeAdapterFactory STRING_BUILDER_FACTORY = - newFactory(StringBuilder.class, STRING_BUILDER); - - public static final TypeAdapter STRING_BUFFER = new TypeAdapter() { - @Override - public StringBuffer read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return new StringBuffer(in.nextString()); - } - @Override - public void write(JsonWriter out, StringBuffer value) throws IOException { - out.value(value == null ? null : value.toString()); - } - }; - - public static final TypeAdapterFactory STRING_BUFFER_FACTORY = - newFactory(StringBuffer.class, STRING_BUFFER); - - public static final TypeAdapter URL = new TypeAdapter() { - @Override - public URL read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - String nextString = in.nextString(); - return "null".equals(nextString) ? null : new URL(nextString); - } - @Override - public void write(JsonWriter out, URL value) throws IOException { - out.value(value == null ? null : value.toExternalForm()); - } - }; - - public static final TypeAdapterFactory URL_FACTORY = newFactory(URL.class, URL); - - public static final TypeAdapter URI = new TypeAdapter() { - @Override - public URI read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - try { - String nextString = in.nextString(); - return "null".equals(nextString) ? null : new URI(nextString); - } catch (URISyntaxException e) { - throw new JsonIOException(e); - } - } - @Override - public void write(JsonWriter out, URI value) throws IOException { - out.value(value == null ? null : value.toASCIIString()); - } - }; - - public static final TypeAdapterFactory URI_FACTORY = newFactory(URI.class, URI); - - public static final TypeAdapter INET_ADDRESS = new TypeAdapter() { - @Override - public InetAddress read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - // regrettably, this should have included both the host name and the host address - return InetAddress.getByName(in.nextString()); - } - @Override - public void write(JsonWriter out, InetAddress value) throws IOException { - out.value(value == null ? null : value.getHostAddress()); - } - }; - - public static final TypeAdapterFactory INET_ADDRESS_FACTORY = - newTypeHierarchyFactory(InetAddress.class, INET_ADDRESS); - - public static final TypeAdapter UUID = new TypeAdapter() { - @Override - public UUID read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return java.util.UUID.fromString(in.nextString()); - } - @Override - public void write(JsonWriter out, UUID value) throws IOException { - out.value(value == null ? null : value.toString()); - } - }; - - public static final TypeAdapterFactory UUID_FACTORY = newFactory(UUID.class, UUID); - - public static final TypeAdapter CURRENCY = new TypeAdapter() { - @Override - public Currency read(JsonReader in) throws IOException { - return Currency.getInstance(in.nextString()); - } - @Override - public void write(JsonWriter out, Currency value) throws IOException { - out.value(value.getCurrencyCode()); - } - }.nullSafe(); - public static final TypeAdapterFactory CURRENCY_FACTORY = newFactory(Currency.class, CURRENCY); - - public static final TypeAdapter CALENDAR = new TypeAdapter() { - private static final String YEAR = "year"; - private static final String MONTH = "month"; - private static final String DAY_OF_MONTH = "dayOfMonth"; - private static final String HOUR_OF_DAY = "hourOfDay"; - private static final String MINUTE = "minute"; - private static final String SECOND = "second"; - - @Override - public Calendar read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - in.beginObject(); - int year = 0; - int month = 0; - int dayOfMonth = 0; - int hourOfDay = 0; - int minute = 0; - int second = 0; - while (in.peek() != JsonToken.END_OBJECT) { - String name = in.nextName(); - int value = in.nextInt(); - if (YEAR.equals(name)) { - year = value; - } else if (MONTH.equals(name)) { - month = value; - } else if (DAY_OF_MONTH.equals(name)) { - dayOfMonth = value; - } else if (HOUR_OF_DAY.equals(name)) { - hourOfDay = value; - } else if (MINUTE.equals(name)) { - minute = value; - } else if (SECOND.equals(name)) { - second = value; - } - } - in.endObject(); - return new GregorianCalendar(year, month, dayOfMonth, hourOfDay, minute, second); - } - - @Override - public void write(JsonWriter out, Calendar value) throws IOException { - if (value == null) { - out.nullValue(); - return; - } - out.beginObject(); - out.name(YEAR); - out.value(value.get(Calendar.YEAR)); - out.name(MONTH); - out.value(value.get(Calendar.MONTH)); - out.name(DAY_OF_MONTH); - out.value(value.get(Calendar.DAY_OF_MONTH)); - out.name(HOUR_OF_DAY); - out.value(value.get(Calendar.HOUR_OF_DAY)); - out.name(MINUTE); - out.value(value.get(Calendar.MINUTE)); - out.name(SECOND); - out.value(value.get(Calendar.SECOND)); - out.endObject(); - } - }; - - public static final TypeAdapterFactory CALENDAR_FACTORY = - newFactoryForMultipleTypes(Calendar.class, GregorianCalendar.class, CALENDAR); - - public static final TypeAdapter LOCALE = new TypeAdapter() { - @Override - public Locale read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - String locale = in.nextString(); - StringTokenizer tokenizer = new StringTokenizer(locale, "_"); - String language = null; - String country = null; - String variant = null; - if (tokenizer.hasMoreElements()) { - language = tokenizer.nextToken(); - } - if (tokenizer.hasMoreElements()) { - country = tokenizer.nextToken(); - } - if (tokenizer.hasMoreElements()) { - variant = tokenizer.nextToken(); - } - if (country == null && variant == null) { - return new Locale(language); - } else if (variant == null) { - return new Locale(language, country); - } else { - return new Locale(language, country, variant); - } - } - @Override - public void write(JsonWriter out, Locale value) throws IOException { - out.value(value == null ? null : value.toString()); - } - }; - - public static final TypeAdapterFactory LOCALE_FACTORY = newFactory(Locale.class, LOCALE); - - public static final TypeAdapter JSON_ELEMENT = new TypeAdapter() { - @Override public JsonElement read(JsonReader in) throws IOException { - if (in instanceof JsonTreeReader) { - return ((JsonTreeReader) in).nextJsonElement(); - } - - switch (in.peek()) { - case STRING: - return new JsonPrimitive(in.nextString()); - case NUMBER: - String number = in.nextString(); - return new JsonPrimitive(new LazilyParsedNumber(number)); - case BOOLEAN: - return new JsonPrimitive(in.nextBoolean()); - case NULL: - in.nextNull(); - return JsonNull.INSTANCE; - case BEGIN_ARRAY: - JsonArray array = new JsonArray(); - in.beginArray(); - while (in.hasNext()) { - array.add(read(in)); - } - in.endArray(); - return array; - case BEGIN_OBJECT: - JsonObject object = new JsonObject(); - in.beginObject(); - while (in.hasNext()) { - object.add(in.nextName(), read(in)); - } - in.endObject(); - return object; - case END_DOCUMENT: - case NAME: - case END_OBJECT: - case END_ARRAY: - default: - throw new IllegalArgumentException(); - } - } - - @Override public void write(JsonWriter out, JsonElement value) throws IOException { - if (value == null || value.isJsonNull()) { - out.nullValue(); - } else if (value.isJsonPrimitive()) { - JsonPrimitive primitive = value.getAsJsonPrimitive(); - if (primitive.isNumber()) { - out.value(primitive.getAsNumber()); - } else if (primitive.isBoolean()) { - out.value(primitive.getAsBoolean()); - } else { - out.value(primitive.getAsString()); - } - - } else if (value.isJsonArray()) { - out.beginArray(); - for (JsonElement e : value.getAsJsonArray()) { - write(out, e); - } - out.endArray(); - - } else if (value.isJsonObject()) { - out.beginObject(); - for (Map.Entry e : value.getAsJsonObject().entrySet()) { - out.name(e.getKey()); - write(out, e.getValue()); - } - out.endObject(); - - } else { - throw new IllegalArgumentException("Couldn't write " + value.getClass()); - } - } - }; - - public static final TypeAdapterFactory JSON_ELEMENT_FACTORY - = newTypeHierarchyFactory(JsonElement.class, JSON_ELEMENT); - - private static final class EnumTypeAdapter> extends TypeAdapter { - private final Map nameToConstant = new HashMap(); - private final Map constantToName = new HashMap(); - - public EnumTypeAdapter(Class classOfT) { - try { - for (final Field field : classOfT.getDeclaredFields()) { - if (!field.isEnumConstant()) { - continue; - } - AccessController.doPrivileged(new PrivilegedAction() { - @Override public Void run() { - field.setAccessible(true); - return null; - } - }); - @SuppressWarnings("unchecked") - T constant = (T)(field.get(null)); - String name = constant.name(); - SerializedName annotation = field.getAnnotation(SerializedName.class); - if (annotation != null) { - name = annotation.value(); - for (String alternate : annotation.alternate()) { - nameToConstant.put(alternate, constant); - } - } - nameToConstant.put(name, constant); - constantToName.put(constant, name); - } - } catch (IllegalAccessException e) { - throw new AssertionError(e); - } - } - @Override public T read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - return nameToConstant.get(in.nextString()); - } - - @Override public void write(JsonWriter out, T value) throws IOException { - out.value(value == null ? null : constantToName.get(value)); - } - } - - public static final TypeAdapterFactory ENUM_FACTORY = new TypeAdapterFactory() { - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override public TypeAdapter create(Gson gson, TypeToken typeToken) { - Class rawType = typeToken.getRawType(); - if (!Enum.class.isAssignableFrom(rawType) || rawType == Enum.class) { - return null; - } - if (!rawType.isEnum()) { - rawType = rawType.getSuperclass(); // handle anonymous subclasses - } - return (TypeAdapter) new EnumTypeAdapter(rawType); - } - }; - - public static TypeAdapterFactory newFactory( - final TypeToken type, final TypeAdapter typeAdapter) { - return new TypeAdapterFactory() { - @SuppressWarnings("unchecked") // we use a runtime check to make sure the 'T's equal - @Override public TypeAdapter create(Gson gson, TypeToken typeToken) { - return typeToken.equals(type) ? (TypeAdapter) typeAdapter : null; - } - }; - } - - public static TypeAdapterFactory newFactory( - final Class type, final TypeAdapter typeAdapter) { - return new TypeAdapterFactory() { - @SuppressWarnings("unchecked") // we use a runtime check to make sure the 'T's equal - @Override public TypeAdapter create(Gson gson, TypeToken typeToken) { - return typeToken.getRawType() == type ? (TypeAdapter) typeAdapter : null; - } - @Override public String toString() { - return "Factory[type=" + type.getName() + ",adapter=" + typeAdapter + "]"; - } - }; - } - - public static TypeAdapterFactory newFactory( - final Class unboxed, final Class boxed, final TypeAdapter typeAdapter) { - return new TypeAdapterFactory() { - @SuppressWarnings("unchecked") // we use a runtime check to make sure the 'T's equal - @Override public TypeAdapter create(Gson gson, TypeToken typeToken) { - Class rawType = typeToken.getRawType(); - return (rawType == unboxed || rawType == boxed) ? (TypeAdapter) typeAdapter : null; - } - @Override public String toString() { - return "Factory[type=" + boxed.getName() - + "+" + unboxed.getName() + ",adapter=" + typeAdapter + "]"; - } - }; - } - - public static TypeAdapterFactory newFactoryForMultipleTypes(final Class base, - final Class sub, final TypeAdapter typeAdapter) { - return new TypeAdapterFactory() { - @SuppressWarnings("unchecked") // we use a runtime check to make sure the 'T's equal - @Override public TypeAdapter create(Gson gson, TypeToken typeToken) { - Class rawType = typeToken.getRawType(); - return (rawType == base || rawType == sub) ? (TypeAdapter) typeAdapter : null; - } - @Override public String toString() { - return "Factory[type=" + base.getName() - + "+" + sub.getName() + ",adapter=" + typeAdapter + "]"; - } - }; - } - - /** - * Returns a factory for all subtypes of {@code typeAdapter}. We do a runtime check to confirm - * that the deserialized type matches the type requested. - */ - public static TypeAdapterFactory newTypeHierarchyFactory( - final Class clazz, final TypeAdapter typeAdapter) { - return new TypeAdapterFactory() { - @SuppressWarnings("unchecked") - @Override public TypeAdapter create(Gson gson, TypeToken typeToken) { - final Class requestedType = typeToken.getRawType(); - if (!clazz.isAssignableFrom(requestedType)) { - return null; - } - return (TypeAdapter) new TypeAdapter() { - @Override public void write(JsonWriter out, T1 value) throws IOException { - typeAdapter.write(out, value); - } - - @Override public T1 read(JsonReader in) throws IOException { - T1 result = typeAdapter.read(in); - if (result != null && !requestedType.isInstance(result)) { - throw new JsonSyntaxException("Expected a " + requestedType.getName() - + " but was " + result.getClass().getName()); - } - return result; - } - }; - } - @Override public String toString() { - return "Factory[typeHierarchy=" + clazz.getName() + ",adapter=" + typeAdapter + "]"; - } - }; - } -} \ No newline at end of file diff --git a/minecraft_server/com/google/gson/internal/bind/util/ISO8601Utils.java b/minecraft_server/com/google/gson/internal/bind/util/ISO8601Utils.java deleted file mode 100644 index 99ec679..0000000 --- a/minecraft_server/com/google/gson/internal/bind/util/ISO8601Utils.java +++ /dev/null @@ -1,352 +0,0 @@ -package com.google.gson.internal.bind.util; - -import java.text.ParseException; -import java.text.ParsePosition; -import java.util.*; - -/** - * Utilities methods for manipulating dates in iso8601 format. This is much much faster and GC friendly than using SimpleDateFormat so - * highly suitable if you (un)serialize lots of date objects. - * - * Supported parse format: [yyyy-MM-dd|yyyyMMdd][T(hh:mm[:ss[.sss]]|hhmm[ss[.sss]])]?[Z|[+-]hh[:]mm]] - * - * @see this specification - */ -//Date parsing code from Jackson databind ISO8601Utils.java -// https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/util/ISO8601Utils.java -public class ISO8601Utils -{ - /** - * ID to represent the 'UTC' string, default timezone since Jackson 2.7 - * - * @since 2.7 - */ - private static final String UTC_ID = "UTC"; - /** - * The UTC timezone, prefetched to avoid more lookups. - * - * @since 2.7 - */ - private static final TimeZone TIMEZONE_UTC = TimeZone.getTimeZone(UTC_ID); - - /* - /********************************************************** - /* Formatting - /********************************************************** - */ - - /** - * Format a date into 'yyyy-MM-ddThh:mm:ssZ' (default timezone, no milliseconds precision) - * - * @param date the date to format - * @return the date formatted as 'yyyy-MM-ddThh:mm:ssZ' - */ - public static String format(Date date) { - return format(date, false, TIMEZONE_UTC); - } - - /** - * Format a date into 'yyyy-MM-ddThh:mm:ss[.sss]Z' (GMT timezone) - * - * @param date the date to format - * @param millis true to include millis precision otherwise false - * @return the date formatted as 'yyyy-MM-ddThh:mm:ss[.sss]Z' - */ - public static String format(Date date, boolean millis) { - return format(date, millis, TIMEZONE_UTC); - } - - /** - * Format date into yyyy-MM-ddThh:mm:ss[.sss][Z|[+-]hh:mm] - * - * @param date the date to format - * @param millis true to include millis precision otherwise false - * @param tz timezone to use for the formatting (UTC will produce 'Z') - * @return the date formatted as yyyy-MM-ddThh:mm:ss[.sss][Z|[+-]hh:mm] - */ - public static String format(Date date, boolean millis, TimeZone tz) { - Calendar calendar = new GregorianCalendar(tz, Locale.US); - calendar.setTime(date); - - // estimate capacity of buffer as close as we can (yeah, that's pedantic ;) - int capacity = "yyyy-MM-ddThh:mm:ss".length(); - capacity += millis ? ".sss".length() : 0; - capacity += tz.getRawOffset() == 0 ? "Z".length() : "+hh:mm".length(); - StringBuilder formatted = new StringBuilder(capacity); - - padInt(formatted, calendar.get(Calendar.YEAR), "yyyy".length()); - formatted.append('-'); - padInt(formatted, calendar.get(Calendar.MONTH) + 1, "MM".length()); - formatted.append('-'); - padInt(formatted, calendar.get(Calendar.DAY_OF_MONTH), "dd".length()); - formatted.append('T'); - padInt(formatted, calendar.get(Calendar.HOUR_OF_DAY), "hh".length()); - formatted.append(':'); - padInt(formatted, calendar.get(Calendar.MINUTE), "mm".length()); - formatted.append(':'); - padInt(formatted, calendar.get(Calendar.SECOND), "ss".length()); - if (millis) { - formatted.append('.'); - padInt(formatted, calendar.get(Calendar.MILLISECOND), "sss".length()); - } - - int offset = tz.getOffset(calendar.getTimeInMillis()); - if (offset != 0) { - int hours = Math.abs((offset / (60 * 1000)) / 60); - int minutes = Math.abs((offset / (60 * 1000)) % 60); - formatted.append(offset < 0 ? '-' : '+'); - padInt(formatted, hours, "hh".length()); - formatted.append(':'); - padInt(formatted, minutes, "mm".length()); - } else { - formatted.append('Z'); - } - - return formatted.toString(); - } - - /* - /********************************************************** - /* Parsing - /********************************************************** - */ - - /** - * Parse a date from ISO-8601 formatted string. It expects a format - * [yyyy-MM-dd|yyyyMMdd][T(hh:mm[:ss[.sss]]|hhmm[ss[.sss]])]?[Z|[+-]hh[:mm]]] - * - * @param date ISO string to parse in the appropriate format. - * @param pos The position to start parsing from, updated to where parsing stopped. - * @return the parsed date - * @throws ParseException if the date is not in the appropriate format - */ - public static Date parse(String date, ParsePosition pos) throws ParseException { - Exception fail = null; - try { - int offset = pos.getIndex(); - - // extract year - int year = parseInt(date, offset, offset += 4); - if (checkOffset(date, offset, '-')) { - offset += 1; - } - - // extract month - int month = parseInt(date, offset, offset += 2); - if (checkOffset(date, offset, '-')) { - offset += 1; - } - - // extract day - int day = parseInt(date, offset, offset += 2); - // default time value - int hour = 0; - int minutes = 0; - int seconds = 0; - int milliseconds = 0; // always use 0 otherwise returned date will include millis of current time - - // if the value has no time component (and no time zone), we are done - boolean hasT = checkOffset(date, offset, 'T'); - - if (!hasT && (date.length() <= offset)) { - Calendar calendar = new GregorianCalendar(year, month - 1, day); - - pos.setIndex(offset); - return calendar.getTime(); - } - - if (hasT) { - - // extract hours, minutes, seconds and milliseconds - hour = parseInt(date, offset += 1, offset += 2); - if (checkOffset(date, offset, ':')) { - offset += 1; - } - - minutes = parseInt(date, offset, offset += 2); - if (checkOffset(date, offset, ':')) { - offset += 1; - } - // second and milliseconds can be optional - if (date.length() > offset) { - char c = date.charAt(offset); - if (c != 'Z' && c != '+' && c != '-') { - seconds = parseInt(date, offset, offset += 2); - if (seconds > 59 && seconds < 63) seconds = 59; // truncate up to 3 leap seconds - // milliseconds can be optional in the format - if (checkOffset(date, offset, '.')) { - offset += 1; - int endOffset = indexOfNonDigit(date, offset + 1); // assume at least one digit - int parseEndOffset = Math.min(endOffset, offset + 3); // parse up to 3 digits - int fraction = parseInt(date, offset, parseEndOffset); - // compensate for "missing" digits - switch (parseEndOffset - offset) { // number of digits parsed - case 2: - milliseconds = fraction * 10; - break; - case 1: - milliseconds = fraction * 100; - break; - default: - milliseconds = fraction; - } - offset = endOffset; - } - } - } - } - - // extract timezone - if (date.length() <= offset) { - throw new IllegalArgumentException("No time zone indicator"); - } - - TimeZone timezone = null; - char timezoneIndicator = date.charAt(offset); - - if (timezoneIndicator == 'Z') { - timezone = TIMEZONE_UTC; - offset += 1; - } else if (timezoneIndicator == '+' || timezoneIndicator == '-') { - String timezoneOffset = date.substring(offset); - - // When timezone has no minutes, we should append it, valid timezones are, for example: +00:00, +0000 and +00 - timezoneOffset = timezoneOffset.length() >= 5 ? timezoneOffset : timezoneOffset + "00"; - - offset += timezoneOffset.length(); - // 18-Jun-2015, tatu: Minor simplification, skip offset of "+0000"/"+00:00" - if ("+0000".equals(timezoneOffset) || "+00:00".equals(timezoneOffset)) { - timezone = TIMEZONE_UTC; - } else { - // 18-Jun-2015, tatu: Looks like offsets only work from GMT, not UTC... - // not sure why, but that's the way it looks. Further, Javadocs for - // `java.util.TimeZone` specifically instruct use of GMT as base for - // custom timezones... odd. - String timezoneId = "GMT" + timezoneOffset; -// String timezoneId = "UTC" + timezoneOffset; - - timezone = TimeZone.getTimeZone(timezoneId); - - String act = timezone.getID(); - if (!act.equals(timezoneId)) { - /* 22-Jan-2015, tatu: Looks like canonical version has colons, but we may be given - * one without. If so, don't sweat. - * Yes, very inefficient. Hopefully not hit often. - * If it becomes a perf problem, add 'loose' comparison instead. - */ - String cleaned = act.replace(":", ""); - if (!cleaned.equals(timezoneId)) { - throw new IndexOutOfBoundsException("Mismatching time zone indicator: "+timezoneId+" given, resolves to " - +timezone.getID()); - } - } - } - } else { - throw new IndexOutOfBoundsException("Invalid time zone indicator '" + timezoneIndicator+"'"); - } - - Calendar calendar = new GregorianCalendar(timezone); - calendar.setLenient(false); - calendar.set(Calendar.YEAR, year); - calendar.set(Calendar.MONTH, month - 1); - calendar.set(Calendar.DAY_OF_MONTH, day); - calendar.set(Calendar.HOUR_OF_DAY, hour); - calendar.set(Calendar.MINUTE, minutes); - calendar.set(Calendar.SECOND, seconds); - calendar.set(Calendar.MILLISECOND, milliseconds); - - pos.setIndex(offset); - return calendar.getTime(); - // If we get a ParseException it'll already have the right message/offset. - // Other exception types can convert here. - } catch (IndexOutOfBoundsException e) { - fail = e; - } catch (NumberFormatException e) { - fail = e; - } catch (IllegalArgumentException e) { - fail = e; - } - String input = (date == null) ? null : ('"' + date + '"'); - String msg = fail.getMessage(); - if (msg == null || msg.isEmpty()) { - msg = "("+fail.getClass().getName()+")"; - } - ParseException ex = new ParseException("Failed to parse date [" + input + "]: " + msg, pos.getIndex()); - ex.initCause(fail); - throw ex; - } - - /** - * Check if the expected character exist at the given offset in the value. - * - * @param value the string to check at the specified offset - * @param offset the offset to look for the expected character - * @param expected the expected character - * @return true if the expected character exist at the given offset - */ - private static boolean checkOffset(String value, int offset, char expected) { - return (offset < value.length()) && (value.charAt(offset) == expected); - } - - /** - * Parse an integer located between 2 given offsets in a string - * - * @param value the string to parse - * @param beginIndex the start index for the integer in the string - * @param endIndex the end index for the integer in the string - * @return the int - * @throws NumberFormatException if the value is not a number - */ - private static int parseInt(String value, int beginIndex, int endIndex) throws NumberFormatException { - if (beginIndex < 0 || endIndex > value.length() || beginIndex > endIndex) { - throw new NumberFormatException(value); - } - // use same logic as in Integer.parseInt() but less generic we're not supporting negative values - int i = beginIndex; - int result = 0; - int digit; - if (i < endIndex) { - digit = Character.digit(value.charAt(i++), 10); - if (digit < 0) { - throw new NumberFormatException("Invalid number: " + value.substring(beginIndex, endIndex)); - } - result = -digit; - } - while (i < endIndex) { - digit = Character.digit(value.charAt(i++), 10); - if (digit < 0) { - throw new NumberFormatException("Invalid number: " + value.substring(beginIndex, endIndex)); - } - result *= 10; - result -= digit; - } - return -result; - } - - /** - * Zero pad a number to a specified length - * - * @param buffer buffer to use for padding - * @param value the integer value to pad if necessary. - * @param length the length of the string we should zero pad - */ - private static void padInt(StringBuilder buffer, int value, int length) { - String strValue = Integer.toString(value); - for (int i = length - strValue.length(); i > 0; i--) { - buffer.append('0'); - } - buffer.append(strValue); - } - - /** - * Returns the index of the first character in the string that is not a digit, starting at offset. - */ - private static int indexOfNonDigit(String string, int offset) { - for (int i = offset; i < string.length(); i++) { - char c = string.charAt(i); - if (c < '0' || c > '9') return i; - } - return string.length(); - } - -} diff --git a/minecraft_server/com/google/gson/internal/package-info.java b/minecraft_server/com/google/gson/internal/package-info.java deleted file mode 100644 index b5139b6..0000000 --- a/minecraft_server/com/google/gson/internal/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Do NOT use any class in this package as they are meant for internal use in Gson. - * These classes will very likely change incompatibly in future versions. You have been warned. - * - * @author Inderjeet Singh, Joel Leitch, Jesse Wilson - */ -package com.google.gson.internal; \ No newline at end of file diff --git a/minecraft_server/com/google/gson/internal/reflect/PreJava9ReflectionAccessor.java b/minecraft_server/com/google/gson/internal/reflect/PreJava9ReflectionAccessor.java deleted file mode 100644 index 325274e..0000000 --- a/minecraft_server/com/google/gson/internal/reflect/PreJava9ReflectionAccessor.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2017 The Gson authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.gson.internal.reflect; - -import java.lang.reflect.AccessibleObject; - -/** - * A basic implementation of {@link ReflectionAccessor} which is suitable for Java 8 and below. - *

- * This implementation just calls {@link AccessibleObject#setAccessible(boolean) setAccessible(true)}, which worked - * fine before Java 9. - */ -final class PreJava9ReflectionAccessor extends ReflectionAccessor { - - /** {@inheritDoc} */ - @Override - public void makeAccessible(AccessibleObject ao) { - ao.setAccessible(true); - } -} diff --git a/minecraft_server/com/google/gson/internal/reflect/ReflectionAccessor.java b/minecraft_server/com/google/gson/internal/reflect/ReflectionAccessor.java deleted file mode 100644 index 6816fea..0000000 --- a/minecraft_server/com/google/gson/internal/reflect/ReflectionAccessor.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2017 The Gson authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.gson.internal.reflect; - -import java.lang.reflect.AccessibleObject; - -import com.google.gson.internal.JavaVersion; - -/** - * Provides a replacement for {@link AccessibleObject#setAccessible(boolean)}, which may be used to - * avoid reflective access issues appeared in Java 9, like {@link java.lang.reflect.InaccessibleObjectException} - * thrown or warnings like - *

- *   WARNING: An illegal reflective access operation has occurred
- *   WARNING: Illegal reflective access by ...
- * 
- *

- * Works both for Java 9 and earlier Java versions. - */ -public abstract class ReflectionAccessor { - - // the singleton instance, use getInstance() to obtain - private static final ReflectionAccessor instance = JavaVersion.getMajorJavaVersion() < 9 ? new PreJava9ReflectionAccessor() : new UnsafeReflectionAccessor(); - - /** - * Does the same as {@code ao.setAccessible(true)}, but never throws - * {@link java.lang.reflect.InaccessibleObjectException} - */ - public abstract void makeAccessible(AccessibleObject ao); - - /** - * Obtains a {@link ReflectionAccessor} instance suitable for the current Java version. - *

- * You may need one a reflective operation in your code throws {@link java.lang.reflect.InaccessibleObjectException}. - * In such a case, use {@link ReflectionAccessor#makeAccessible(AccessibleObject)} on a field, method or constructor - * (instead of basic {@link AccessibleObject#setAccessible(boolean)}). - */ - public static ReflectionAccessor getInstance() { - return instance; - } -} diff --git a/minecraft_server/com/google/gson/internal/reflect/UnsafeReflectionAccessor.java b/minecraft_server/com/google/gson/internal/reflect/UnsafeReflectionAccessor.java deleted file mode 100644 index b23d7ba..0000000 --- a/minecraft_server/com/google/gson/internal/reflect/UnsafeReflectionAccessor.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2017 The Gson authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.gson.internal.reflect; - -import java.lang.reflect.AccessibleObject; -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import com.google.gson.JsonIOException; - -/** - * An implementation of {@link ReflectionAccessor} based on {@link Unsafe}. - *

- * NOTE: This implementation is designed for Java 9. Although it should work with earlier Java releases, it is better to - * use {@link PreJava9ReflectionAccessor} for them. - */ -@SuppressWarnings({"unchecked", "rawtypes"}) -final class UnsafeReflectionAccessor extends ReflectionAccessor { - - private static Class unsafeClass; - private final Object theUnsafe = getUnsafeInstance(); - private final Field overrideField = getOverrideField(); - - /** {@inheritDoc} */ - @Override - public void makeAccessible(AccessibleObject ao) { - boolean success = makeAccessibleWithUnsafe(ao); - if (!success) { - try { - // unsafe couldn't be found, so try using accessible anyway - ao.setAccessible(true); - } catch (SecurityException e) { - throw new JsonIOException("Gson couldn't modify fields for " + ao - + "\nand sun.misc.Unsafe not found.\nEither write a custom type adapter," - + " or make fields accessible, or include sun.misc.Unsafe.", e); - } - } - } - - // Visible for testing only - boolean makeAccessibleWithUnsafe(AccessibleObject ao) { - if (theUnsafe != null && overrideField != null) { - try { - Method method = unsafeClass.getMethod("objectFieldOffset", Field.class); - long overrideOffset = (Long) method.invoke(theUnsafe, overrideField); // long overrideOffset = theUnsafe.objectFieldOffset(overrideField); - Method putBooleanMethod = unsafeClass.getMethod("putBoolean", Object.class, long.class, boolean.class); - putBooleanMethod.invoke(theUnsafe, ao, overrideOffset, true); // theUnsafe.putBoolean(ao, overrideOffset, true); - return true; - } catch (Exception ignored) { // do nothing - } - } - return false; - } - - private static Object getUnsafeInstance() { - try { - unsafeClass = Class.forName("sun.misc.Unsafe"); - Field unsafeField = unsafeClass.getDeclaredField("theUnsafe"); - unsafeField.setAccessible(true); - return unsafeField.get(null); - } catch (Exception e) { - return null; - } - } - - private static Field getOverrideField() { - try { - return AccessibleObject.class.getDeclaredField("override"); - } catch (Exception e) { - return null; - } - } -} diff --git a/minecraft_server/com/google/gson/internal/sql/SqlDateTypeAdapter.java b/minecraft_server/com/google/gson/internal/sql/SqlDateTypeAdapter.java deleted file mode 100644 index b3da1fe..0000000 --- a/minecraft_server/com/google/gson/internal/sql/SqlDateTypeAdapter.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.sql; - -import com.google.gson.Gson; -import com.google.gson.JsonSyntaxException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; - -/** - * Adapter for java.sql.Date. Although this class appears stateless, it is not. - * DateFormat captures its time zone and locale when it is created, which gives - * this class state. DateFormat isn't thread safe either, so this class has - * to synchronize its read and write methods. - */ -final class SqlDateTypeAdapter extends TypeAdapter { - static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { - @SuppressWarnings("unchecked") // we use a runtime check to make sure the 'T's equal - @Override public TypeAdapter create(Gson gson, TypeToken typeToken) { - return typeToken.getRawType() == java.sql.Date.class - ? (TypeAdapter) new SqlDateTypeAdapter() : null; - } - }; - - private final DateFormat format = new SimpleDateFormat("MMM d, yyyy"); - - private SqlDateTypeAdapter() { - } - - @Override - public synchronized java.sql.Date read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - try { - final long utilDate = format.parse(in.nextString()).getTime(); - return new java.sql.Date(utilDate); - } catch (ParseException e) { - throw new JsonSyntaxException(e); - } - } - - @Override - public synchronized void write(JsonWriter out, java.sql.Date value) throws IOException { - out.value(value == null ? null : format.format(value)); - } -} diff --git a/minecraft_server/com/google/gson/internal/sql/SqlTimeTypeAdapter.java b/minecraft_server/com/google/gson/internal/sql/SqlTimeTypeAdapter.java deleted file mode 100644 index ee65726..0000000 --- a/minecraft_server/com/google/gson/internal/sql/SqlTimeTypeAdapter.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.internal.sql; - -import com.google.gson.Gson; -import com.google.gson.JsonSyntaxException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.sql.Time; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * Adapter for java.sql.Time. Although this class appears stateless, it is not. - * DateFormat captures its time zone and locale when it is created, which gives - * this class state. DateFormat isn't thread safe either, so this class has - * to synchronize its read and write methods. - */ -final class SqlTimeTypeAdapter extends TypeAdapter

If {@link #SUPPORTS_SQL_TYPES} is {@code true}, all other - * constants of this class will be non-{@code null}. However, if - * it is {@code false} all other constants will be {@code null} and - * there will be no support for {@code java.sql} types. - */ -public final class SqlTypesSupport { - /** - * {@code true} if {@code java.sql} types are supported, - * {@code false} otherwise - */ - public static final boolean SUPPORTS_SQL_TYPES; - - public static final DateType DATE_DATE_TYPE; - public static final DateType TIMESTAMP_DATE_TYPE; - - public static final TypeAdapterFactory DATE_FACTORY; - public static final TypeAdapterFactory TIME_FACTORY; - public static final TypeAdapterFactory TIMESTAMP_FACTORY; - - static { - boolean sqlTypesSupport; - try { - Class.forName("java.sql.Date"); - sqlTypesSupport = true; - } catch (ClassNotFoundException classNotFoundException) { - sqlTypesSupport = false; - } - SUPPORTS_SQL_TYPES = sqlTypesSupport; - - if (SUPPORTS_SQL_TYPES) { - DATE_DATE_TYPE = new DateType(java.sql.Date.class) { - @Override protected java.sql.Date deserialize(Date date) { - return new java.sql.Date(date.getTime()); - } - }; - TIMESTAMP_DATE_TYPE = new DateType(Timestamp.class) { - @Override protected Timestamp deserialize(Date date) { - return new Timestamp(date.getTime()); - } - }; - - DATE_FACTORY = SqlDateTypeAdapter.FACTORY; - TIME_FACTORY = SqlTimeTypeAdapter.FACTORY; - TIMESTAMP_FACTORY = SqlTimestampTypeAdapter.FACTORY; - } else { - DATE_DATE_TYPE = null; - TIMESTAMP_DATE_TYPE = null; - - DATE_FACTORY = null; - TIME_FACTORY = null; - TIMESTAMP_FACTORY = null; - } - } - - private SqlTypesSupport() { - } -} diff --git a/minecraft_server/com/google/gson/package-info.java b/minecraft_server/com/google/gson/package-info.java deleted file mode 100644 index 428e280..0000000 --- a/minecraft_server/com/google/gson/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This package provides the {@link com.google.gson.Gson} class to convert Json to Java and - * vice-versa. - * - *

The primary class to use is {@link com.google.gson.Gson} which can be constructed with - * {@code new Gson()} (using default settings) or by using {@link com.google.gson.GsonBuilder} - * (to configure various options such as using versioning and so on).

- * - * @author Inderjeet Singh, Joel Leitch - */ -package com.google.gson; \ No newline at end of file diff --git a/minecraft_server/com/google/gson/reflect/TypeToken.java b/minecraft_server/com/google/gson/reflect/TypeToken.java deleted file mode 100644 index 3fb8af2..0000000 --- a/minecraft_server/com/google/gson/reflect/TypeToken.java +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.reflect; - -import com.google.gson.internal.$Gson$Types; -import com.google.gson.internal.$Gson$Preconditions; -import java.lang.reflect.GenericArrayType; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.util.HashMap; -import java.util.Map; - -/** - * Represents a generic type {@code T}. Java doesn't yet provide a way to - * represent generic types, so this class does. Forces clients to create a - * subclass of this class which enables retrieval the type information even at - * runtime. - * - *

For example, to create a type literal for {@code List}, you can - * create an empty anonymous inner class: - * - *

- * {@code TypeToken> list = new TypeToken>() {};} - * - *

This syntax cannot be used to create type literals that have wildcard - * parameters, such as {@code Class} or {@code List}. - * - * @author Bob Lee - * @author Sven Mawson - * @author Jesse Wilson - */ -public class TypeToken { - final Class rawType; - final Type type; - final int hashCode; - - /** - * Constructs a new type literal. Derives represented class from type - * parameter. - * - *

Clients create an empty anonymous subclass. Doing so embeds the type - * parameter in the anonymous class's type hierarchy so we can reconstitute it - * at runtime despite erasure. - */ - @SuppressWarnings("unchecked") - protected TypeToken() { - this.type = getSuperclassTypeParameter(getClass()); - this.rawType = (Class) $Gson$Types.getRawType(type); - this.hashCode = type.hashCode(); - } - - /** - * Unsafe. Constructs a type literal manually. - */ - @SuppressWarnings("unchecked") - TypeToken(Type type) { - this.type = $Gson$Types.canonicalize($Gson$Preconditions.checkNotNull(type)); - this.rawType = (Class) $Gson$Types.getRawType(this.type); - this.hashCode = this.type.hashCode(); - } - - /** - * Returns the type from super class's type parameter in {@link $Gson$Types#canonicalize - * canonical form}. - */ - static Type getSuperclassTypeParameter(Class subclass) { - Type superclass = subclass.getGenericSuperclass(); - if (superclass instanceof Class) { - throw new RuntimeException("Missing type parameter."); - } - ParameterizedType parameterized = (ParameterizedType) superclass; - return $Gson$Types.canonicalize(parameterized.getActualTypeArguments()[0]); - } - - /** - * Returns the raw (non-generic) type for this type. - */ - public final Class getRawType() { - return rawType; - } - - /** - * Gets underlying {@code Type} instance. - */ - public final Type getType() { - return type; - } - - /** - * Check if this type is assignable from the given class object. - * - * @deprecated this implementation may be inconsistent with javac for types - * with wildcards. - */ - @Deprecated - public boolean isAssignableFrom(Class cls) { - return isAssignableFrom((Type) cls); - } - - /** - * Check if this type is assignable from the given Type. - * - * @deprecated this implementation may be inconsistent with javac for types - * with wildcards. - */ - @Deprecated - public boolean isAssignableFrom(Type from) { - if (from == null) { - return false; - } - - if (type.equals(from)) { - return true; - } - - if (type instanceof Class) { - return rawType.isAssignableFrom($Gson$Types.getRawType(from)); - } else if (type instanceof ParameterizedType) { - return isAssignableFrom(from, (ParameterizedType) type, - new HashMap()); - } else if (type instanceof GenericArrayType) { - return rawType.isAssignableFrom($Gson$Types.getRawType(from)) - && isAssignableFrom(from, (GenericArrayType) type); - } else { - throw buildUnexpectedTypeError( - type, Class.class, ParameterizedType.class, GenericArrayType.class); - } - } - - /** - * Check if this type is assignable from the given type token. - * - * @deprecated this implementation may be inconsistent with javac for types - * with wildcards. - */ - @Deprecated - public boolean isAssignableFrom(TypeToken token) { - return isAssignableFrom(token.getType()); - } - - /** - * Private helper function that performs some assignability checks for - * the provided GenericArrayType. - */ - private static boolean isAssignableFrom(Type from, GenericArrayType to) { - Type toGenericComponentType = to.getGenericComponentType(); - if (toGenericComponentType instanceof ParameterizedType) { - Type t = from; - if (from instanceof GenericArrayType) { - t = ((GenericArrayType) from).getGenericComponentType(); - } else if (from instanceof Class) { - Class classType = (Class) from; - while (classType.isArray()) { - classType = classType.getComponentType(); - } - t = classType; - } - return isAssignableFrom(t, (ParameterizedType) toGenericComponentType, - new HashMap()); - } - // No generic defined on "to"; therefore, return true and let other - // checks determine assignability - return true; - } - - /** - * Private recursive helper function to actually do the type-safe checking - * of assignability. - */ - private static boolean isAssignableFrom(Type from, ParameterizedType to, - Map typeVarMap) { - - if (from == null) { - return false; - } - - if (to.equals(from)) { - return true; - } - - // First figure out the class and any type information. - Class clazz = $Gson$Types.getRawType(from); - ParameterizedType ptype = null; - if (from instanceof ParameterizedType) { - ptype = (ParameterizedType) from; - } - - // Load up parameterized variable info if it was parameterized. - if (ptype != null) { - Type[] tArgs = ptype.getActualTypeArguments(); - TypeVariable[] tParams = clazz.getTypeParameters(); - for (int i = 0; i < tArgs.length; i++) { - Type arg = tArgs[i]; - TypeVariable var = tParams[i]; - while (arg instanceof TypeVariable) { - TypeVariable v = (TypeVariable) arg; - arg = typeVarMap.get(v.getName()); - } - typeVarMap.put(var.getName(), arg); - } - - // check if they are equivalent under our current mapping. - if (typeEquals(ptype, to, typeVarMap)) { - return true; - } - } - - for (Type itype : clazz.getGenericInterfaces()) { - if (isAssignableFrom(itype, to, new HashMap(typeVarMap))) { - return true; - } - } - - // Interfaces didn't work, try the superclass. - Type sType = clazz.getGenericSuperclass(); - return isAssignableFrom(sType, to, new HashMap(typeVarMap)); - } - - /** - * Checks if two parameterized types are exactly equal, under the variable - * replacement described in the typeVarMap. - */ - private static boolean typeEquals(ParameterizedType from, - ParameterizedType to, Map typeVarMap) { - if (from.getRawType().equals(to.getRawType())) { - Type[] fromArgs = from.getActualTypeArguments(); - Type[] toArgs = to.getActualTypeArguments(); - for (int i = 0; i < fromArgs.length; i++) { - if (!matches(fromArgs[i], toArgs[i], typeVarMap)) { - return false; - } - } - return true; - } - return false; - } - - private static AssertionError buildUnexpectedTypeError( - Type token, Class... expected) { - - // Build exception message - StringBuilder exceptionMessage = - new StringBuilder("Unexpected type. Expected one of: "); - for (Class clazz : expected) { - exceptionMessage.append(clazz.getName()).append(", "); - } - exceptionMessage.append("but got: ").append(token.getClass().getName()) - .append(", for type token: ").append(token.toString()).append('.'); - - return new AssertionError(exceptionMessage.toString()); - } - - /** - * Checks if two types are the same or are equivalent under a variable mapping - * given in the type map that was provided. - */ - private static boolean matches(Type from, Type to, Map typeMap) { - return to.equals(from) - || (from instanceof TypeVariable - && to.equals(typeMap.get(((TypeVariable) from).getName()))); - - } - - @Override public final int hashCode() { - return this.hashCode; - } - - @Override public final boolean equals(Object o) { - return o instanceof TypeToken - && $Gson$Types.equals(type, ((TypeToken) o).type); - } - - @Override public final String toString() { - return $Gson$Types.typeToString(type); - } - - /** - * Gets type literal for the given {@code Type} instance. - */ - public static TypeToken get(Type type) { - return new TypeToken(type); - } - - /** - * Gets type literal for the given {@code Class} instance. - */ - public static TypeToken get(Class type) { - return new TypeToken(type); - } - - /** - * Gets type literal for the parameterized type represented by applying {@code typeArguments} to - * {@code rawType}. - */ - public static TypeToken getParameterized(Type rawType, Type... typeArguments) { - return new TypeToken($Gson$Types.newParameterizedTypeWithOwner(null, rawType, typeArguments)); - } - - /** - * Gets type literal for the array type whose elements are all instances of {@code componentType}. - */ - public static TypeToken getArray(Type componentType) { - return new TypeToken($Gson$Types.arrayOf(componentType)); - } -} diff --git a/minecraft_server/com/google/gson/reflect/package-info.java b/minecraft_server/com/google/gson/reflect/package-info.java deleted file mode 100644 index 5e43ee9..0000000 --- a/minecraft_server/com/google/gson/reflect/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * This package provides utility classes for finding type information for generic types. - * - * @author Inderjeet Singh, Joel Leitch - */ -package com.google.gson.reflect; \ No newline at end of file diff --git a/minecraft_server/com/google/gson/stream/JsonReader.java b/minecraft_server/com/google/gson/stream/JsonReader.java deleted file mode 100644 index e71fbab..0000000 --- a/minecraft_server/com/google/gson/stream/JsonReader.java +++ /dev/null @@ -1,1611 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.gson.stream; - -import com.google.gson.internal.JsonReaderInternalAccess; -import com.google.gson.internal.bind.JsonTreeReader; -import java.io.Closeable; -import java.io.EOFException; -import java.io.IOException; -import java.io.Reader; -import java.util.Arrays; - -/** - * Reads a JSON (RFC 7159) - * encoded value as a stream of tokens. This stream includes both literal - * values (strings, numbers, booleans, and nulls) as well as the begin and - * end delimiters of objects and arrays. The tokens are traversed in - * depth-first order, the same order that they appear in the JSON document. - * Within JSON objects, name/value pairs are represented by a single token. - * - *

Parsing JSON

- * To create a recursive descent parser for your own JSON streams, first create - * an entry point method that creates a {@code JsonReader}. - * - *

Next, create handler methods for each structure in your JSON text. You'll - * need a method for each object type and for each array type. - *

    - *
  • Within array handling methods, first call {@link - * #beginArray} to consume the array's opening bracket. Then create a - * while loop that accumulates values, terminating when {@link #hasNext} - * is false. Finally, read the array's closing bracket by calling {@link - * #endArray}. - *
  • Within object handling methods, first call {@link - * #beginObject} to consume the object's opening brace. Then create a - * while loop that assigns values to local variables based on their name. - * This loop should terminate when {@link #hasNext} is false. Finally, - * read the object's closing brace by calling {@link #endObject}. - *
- *

When a nested object or array is encountered, delegate to the - * corresponding handler method. - * - *

When an unknown name is encountered, strict parsers should fail with an - * exception. Lenient parsers should call {@link #skipValue()} to recursively - * skip the value's nested tokens, which may otherwise conflict. - * - *

If a value may be null, you should first check using {@link #peek()}. - * Null literals can be consumed using either {@link #nextNull()} or {@link - * #skipValue()}. - * - *

Example

- * Suppose we'd like to parse a stream of messages such as the following:
 {@code
- * [
- *   {
- *     "id": 912345678901,
- *     "text": "How do I read a JSON stream in Java?",
- *     "geo": null,
- *     "user": {
- *       "name": "json_newb",
- *       "followers_count": 41
- *      }
- *   },
- *   {
- *     "id": 912345678902,
- *     "text": "@json_newb just use JsonReader!",
- *     "geo": [50.454722, -104.606667],
- *     "user": {
- *       "name": "jesse",
- *       "followers_count": 2
- *     }
- *   }
- * ]}
- * This code implements the parser for the above structure:
   {@code
- *
- *   public List readJsonStream(InputStream in) throws IOException {
- *     JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
- *     try {
- *       return readMessagesArray(reader);
- *     } finally {
- *       reader.close();
- *     }
- *   }
- *
- *   public List readMessagesArray(JsonReader reader) throws IOException {
- *     List messages = new ArrayList();
- *
- *     reader.beginArray();
- *     while (reader.hasNext()) {
- *       messages.add(readMessage(reader));
- *     }
- *     reader.endArray();
- *     return messages;
- *   }
- *
- *   public Message readMessage(JsonReader reader) throws IOException {
- *     long id = -1;
- *     String text = null;
- *     User user = null;
- *     List geo = null;
- *
- *     reader.beginObject();
- *     while (reader.hasNext()) {
- *       String name = reader.nextName();
- *       if (name.equals("id")) {
- *         id = reader.nextLong();
- *       } else if (name.equals("text")) {
- *         text = reader.nextString();
- *       } else if (name.equals("geo") && reader.peek() != JsonToken.NULL) {
- *         geo = readDoublesArray(reader);
- *       } else if (name.equals("user")) {
- *         user = readUser(reader);
- *       } else {
- *         reader.skipValue();
- *       }
- *     }
- *     reader.endObject();
- *     return new Message(id, text, user, geo);
- *   }
- *
- *   public List readDoublesArray(JsonReader reader) throws IOException {
- *     List doubles = new ArrayList();
- *
- *     reader.beginArray();
- *     while (reader.hasNext()) {
- *       doubles.add(reader.nextDouble());
- *     }
- *     reader.endArray();
- *     return doubles;
- *   }
- *
- *   public User readUser(JsonReader reader) throws IOException {
- *     String username = null;
- *     int followersCount = -1;
- *
- *     reader.beginObject();
- *     while (reader.hasNext()) {
- *       String name = reader.nextName();
- *       if (name.equals("name")) {
- *         username = reader.nextString();
- *       } else if (name.equals("followers_count")) {
- *         followersCount = reader.nextInt();
- *       } else {
- *         reader.skipValue();
- *       }
- *     }
- *     reader.endObject();
- *     return new User(username, followersCount);
- *   }}
- * - *

Number Handling

- * This reader permits numeric values to be read as strings and string values to - * be read as numbers. For example, both elements of the JSON array {@code - * [1, "1"]} may be read using either {@link #nextInt} or {@link #nextString}. - * This behavior is intended to prevent lossy numeric conversions: double is - * JavaScript's only numeric type and very large values like {@code - * 9007199254740993} cannot be represented exactly on that platform. To minimize - * precision loss, extremely large values should be written and read as strings - * in JSON. - * - *

Non-Execute Prefix

- * Web servers that serve private data using JSON may be vulnerable to
Cross-site - * request forgery attacks. In such an attack, a malicious site gains access - * to a private JSON file by executing it with an HTML {@code