diff --git a/build.gradle b/build.gradle index a09560e..f81aff0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,100 +1,138 @@ buildscript { repositories { + maven { url = 'https://files.minecraftforge.net/maven' } +// maven { +// url "https://www.cursemaven.com" +// } + jcenter() mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } + } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:3.+' } } +// this adds support for grabbing bspkrscore from curse +plugins { +id "com.wynprice.cursemaven" version "2.1.1" +} + +apply plugin: 'net.minecraftforge.gradle' +// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. +apply plugin: 'eclipse' +apply plugin: 'maven-publish' -apply plugin: "forge" +version = '1.12.2.a01' +group = 'floatingruins' // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = '[1.12.2]FloatingRuins' -// define the properties file -ext.configFile = file "build.properties" +sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. -configFile.withReader { - // read config. it shall from now on be referenced as simply config or as project.config - def prop = new Properties() - prop.load(it) - project.ext.config = new ConfigSlurper().parse prop -} +// TODO: this does not work. will need to add deobf to ivy repo, or convert to github call. currently have to manually add bspkrsCore as dep +//repositories { +// ivy { +// url "http://bspk.rs/MC" +// layout "pattern", { +// artifact "[module]/deobf/%5B1.12.2%5D[module]-deobf-[revision].[ext]" +// artifact "[module]/deobf/[1.12.2][module]-deobf-[revision].[ext]" +// } +// } +//} + +minecraft { + // The mappings can be changed at any time, and must be in the following format. + // snapshot_YYYYMMDD Snapshot are built nightly. + // stable_# Stables are built at the discretion of the MCP team. + // Use non-default mappings at your own risk. they may not always work. + // Simply re-run your setup task after changing the mappings to update your workspace. + //mappings channel: 'snapshot', version: '20171003-1.12' + mappings channel: 'snapshot', version: '20171003-1.12' -repositories { - ivy { - url "http://bspk.rs/MC" - layout "pattern", { - artifact "[module]/deobf/%5B${config.minecraft_version}%5D[module]-deobf-[revision].[ext]" - artifact "[module]/deobf/[${config.minecraft_version}][module]-deobf-[revision].[ext]" + // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + + // Default run configurations. + // These can be tweaked, removed, or duplicated as needed. + runs { + client { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' + } + + server { + + // Recommended logging data for a userdev environment + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + // Recommended logging level for the console + property 'forge.logging.console.level', 'debug' } } } dependencies { - compile name: 'bspkrsCore', version: "${config.bscore_version}", ext: 'jar' -} + // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed + // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. + // The userdev artifact is a special name and will get all sorts of transformations applied to it. + minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2854' -group = config.group_name -version = "${config.minecraft_version}.${config.mod_version}" -archivesBaseName = "[${config.minecraft_version}]${config.mod_id}" + // You may put jars on which you depend on in ./libs or you may define them like so.. + // compile "some.group:artifact:version:classifier" + // compile "some.group:artifact:version" -minecraft { - version = config.minecraft_version + "-" + config.forge_version // grab latest forge - mappings = config.mappings_version - runDir = "run" - replace '@MOD_VERSION@', "${config.minecraft_version}.${config.mod_version}" - replace '@BSCORE_VERSION@', config.bscore_version -} + // Real examples + // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env + // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env + compile "curse.maven:bspkrscore-59218:2996325" + + // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. + // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' -processResources { - // replace stuff in the files we want. - from(sourceSets.main.resources.srcDirs) { - include '**/*.info' - include '**/*.properties' - - // replaces - expand ([ - 'mod_version': version, - 'bscore_version': config.bscore_version, - 'bscore_jar': "[${config.minecraft_version}]bspkrsCore-universal-${config.bscore_version}.jar", - 'pattern': "\\\\[.+?\\\\](\\\\w+).*?([\\\\d\\\\.]+)[-\\\\w]*\\\\.[^\\\\d]+", - 'forge_version': config.forge_version, - 'minecraft_version': config.minecraft_version - ]) - } + // These dependencies get remapped to your current MCP mappings + // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' + + // For more info... + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html - // copy everything else, thats we didnt do before - from(sourceSets.main.resources.srcDirs) { - exclude '**/*.info' - exclude '**/*.properties' - } } -// change the name of my obfuscated jar +// Example for how to get properties into the manifest for reading by the runtime.. jar { - appendix = config.appendix + manifest { + attributes([ + "Specification-Title": "examplemod", + "Specification-Vendor": "examplemodsareus", + "Specification-Version": "1", // We are version 1 of ourselves + "Implementation-Title": project.name, + "Implementation-Version": "${version}", + "Implementation-Vendor" :"examplemodsareus", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) + } } -// add a source jar -task sourceJar(type: Jar) { - from sourceSets.main.allSource - appendix = 'src' -} +// Example configuration to allow publishing using the maven-publish task +// This is the preferred method to reobfuscate your jar file +jar.finalizedBy('reobfJar') +// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing +//publish.dependsOn('reobfJar') -// because the normal output has been made to be obfuscated -task deobfJar(type: Jar) { - from sourceSets.main.output - appendix = 'deobf' +publishing { + publications { + mavenJava(MavenPublication) { + artifact jar + } + } + repositories { + maven { + url "file:///${project.projectDir}/mcmodsrepo" + } + } } - -artifacts { - archives sourceJar - archives deobfJar -} \ No newline at end of file diff --git a/build.properties b/build.properties deleted file mode 100644 index c04938a..0000000 --- a/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -minecraft_version=1.8 -forge_version=11.14.1.1334 -mappings_version=stable_16 -mod_version=r01 -bscore_version=7.01 -mod_id=FloatingRuins -group_name=floatingruins -appendix=universal \ No newline at end of file diff --git a/change.log b/change.log index 7bf7337..cf943fd 100644 --- a/change.log +++ b/change.log @@ -1,3 +1,5 @@ +1.12.2 - Mar-2021 +- 1.12.2 update 1.8.r01 - 06-Mar-2015 - 1.8 update - removed retry attempts code (had potential to cause differing generation with the same seed on different world saves) @@ -112,7 +114,7 @@ - updated for 1.3.1 - added version checking 1.2.5.d - 20-May-2012 -- added code to reset the seed of the Random object passed in by ModLoader since it can't be guaranteed that another mod has not ­ed with it (I'm looking at YOU Better Dungeons...) +- added code to reset the seed of the Random object passed in by ModLoader since it can't be guaranteed that another mod has not ­ed with it (I'm looking at YOU Better Dungeons...) 1.2.3.c - 08-Mar-2012 - new config option for island radius variation - changed the dungeon frame blocks from bricks to stone bricks (I likes them better) @@ -121,4 +123,4 @@ - support for Jungle biome - support for y>127 1.2.3.a - 05-Mar-2012 -- initial 1.2.3 update \ No newline at end of file +- initial 1.2.3 update diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..878bf1f --- /dev/null +++ b/gradle.properties @@ -0,0 +1,4 @@ +# Sets default memory used for gradle commands. Can be overridden by user or command line properties. +# This is required to provide enough memory for the Minecraft decompilation process. +org.gradle.jvmargs=-Xmx3G +org.gradle.daemon=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index b761216..7a3265e 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 678d9d8..949819d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Wed Jul 02 15:54:47 CDT 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip diff --git a/gradlew b/gradlew index 91a7e26..cccdd3d 100644 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$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="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -90,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -114,6 +113,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 8a0b282..f955316 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@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= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@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= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/src/main/java/bspkrs/floatingruins/CommandFRGen.java b/src/main/java/bspkrs/floatingruins/CommandFRGen.java index 8ce4276..57b7010 100644 --- a/src/main/java/bspkrs/floatingruins/CommandFRGen.java +++ b/src/main/java/bspkrs/floatingruins/CommandFRGen.java @@ -3,21 +3,23 @@ import java.util.Random; import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; public class CommandFRGen extends CommandBase { @Override - public String getCommandName() + public String getName() { return "frgen"; } @Override - public String getCommandUsage(ICommandSender icommandsender) + public String getUsage(ICommandSender icommandsender) { return "commands.frgen.usage"; } @@ -33,7 +35,7 @@ public int getRequiredPermissionLevel() * /frgen random */ @Override - public void processCommand(ICommandSender sender, String[] args) throws WrongUsageException + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws WrongUsageException { if (args.length == 1) { @@ -43,8 +45,8 @@ public void processCommand(ICommandSender sender, String[] args) throws WrongUsa { // TODO: fix apparent coordinate offset EntityPlayer player = (EntityPlayer) sender; - Random random = FloatingRuins.getRandom(player.worldObj, new BlockPos((int) player.posX, 0, (int) player.posZ)); - FloatingRuins.generateSurface(player.worldObj, random, (int) player.posX, (int) player.posZ, false); + Random random = FloatingRuins.getRandom(player.world, new BlockPos((int) player.posX, 0, (int) player.posZ)); + FloatingRuins.generateSurface(player.world, random, (int) player.posX, (int) player.posZ, false); } } else @@ -69,7 +71,7 @@ else if (args.length == 6) } @Override - public int compareTo(Object o) + public int compareTo(ICommand p_compareTo_1_) { // TODO Auto-generated method stub return 0; diff --git a/src/main/java/bspkrs/floatingruins/ConfigElement.java b/src/main/java/bspkrs/floatingruins/ConfigElement.java index 5d1b836..7a1941c 100644 --- a/src/main/java/bspkrs/floatingruins/ConfigElement.java +++ b/src/main/java/bspkrs/floatingruins/ConfigElement.java @@ -3,8 +3,9 @@ import static net.minecraftforge.common.config.Property.Type.BOOLEAN; import static net.minecraftforge.common.config.Property.Type.INTEGER; import static net.minecraftforge.common.config.Property.Type.STRING; -import net.minecraftforge.common.config.Property; + import bspkrs.floatingruins.fml.Reference; +import net.minecraftforge.common.config.Property; public enum ConfigElement { diff --git a/src/main/java/bspkrs/floatingruins/FRLog.java b/src/main/java/bspkrs/floatingruins/FRLog.java index e50c3fc..bf6ee80 100644 --- a/src/main/java/bspkrs/floatingruins/FRLog.java +++ b/src/main/java/bspkrs/floatingruins/FRLog.java @@ -1,13 +1,12 @@ package bspkrs.floatingruins; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; - import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import bspkrs.util.CommonUtils; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; public enum FRLog { diff --git a/src/main/java/bspkrs/floatingruins/FloatingRuins.java b/src/main/java/bspkrs/floatingruins/FloatingRuins.java index 0a12dd6..703a3fa 100644 --- a/src/main/java/bspkrs/floatingruins/FloatingRuins.java +++ b/src/main/java/bspkrs/floatingruins/FloatingRuins.java @@ -7,17 +7,20 @@ import java.util.Map.Entry; import java.util.Random; +import bspkrs.floatingruins.fml.Reference; +import bspkrs.util.CommonUtils; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.village.Village; import net.minecraft.world.World; import net.minecraft.world.WorldType; +import net.minecraft.world.biome.Biome; import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.fml.common.registry.GameData; -import bspkrs.floatingruins.fml.Reference; -import bspkrs.util.CommonUtils; +//import net.minecraftforge.registries.GameData; +//proper?: import net.minecraftforge.fml.common.registry.GameRegistry; +//old: import net.minecraftforge.fml.common.registry.GameData; // Test Seed: 5460896710218081688 // 1470679938 (large biomes) @@ -279,7 +282,7 @@ public static void generateSurface(World world, Random random, int x, int z, boo { if (((world.getWorldInfo().getTerrainType() != WorldType.FLAT) || allowInSuperFlat)) { - if (!CommonUtils.isIDInList(world.provider.getDimensionId(), dimensionIDBlacklist)) + if (!CommonUtils.isIDInList(world.provider.getDimension(), dimensionIDBlacklist)) { random = getRandom(world, new BlockPos(x, 1, z)); int tgtY = getWeightedInt(heightMin, heightMean, heightMax, heightNorm, random); @@ -365,8 +368,8 @@ public static Random getRandom(World world, BlockPos pos) public static boolean isVillageNearby(World world, BlockPos pos, int radius) { FRLog.debug("Checking Villages..."); - if (world.villageCollectionObj != null) - for (Village village : (List) world.villageCollectionObj.getVillageList()) + if (world.villageCollection != null) + for (Village village : (List) world.villageCollection.getVillageList()) { if (Math.sqrt(village.getCenter().distanceSq(pos)) < (village.getVillageRadius() + radius)) return true; @@ -382,7 +385,7 @@ public static int getBlacklistBiomeIDWithinRange(World world, int x, int z, int BlockPos pos = new BlockPos(x, 64, z); EnumFacing[] NSEW = EnumFacing.values(); - int biomeID = world.getBiomeGenForCoords(pos).biomeID; + int biomeID = Biome.getIdForBiome(world.getBiome(pos)); if (CommonUtils.isIDInList(biomeID, biomeIDBlacklist)) return biomeID; @@ -390,7 +393,7 @@ public static int getBlacklistBiomeIDWithinRange(World world, int x, int z, int { for (int i = radius; i > 0; i = i - 2) { - biomeID = world.getBiomeGenForCoords(pos.offset(fd, i)).biomeID; + biomeID = Biome.getIdForBiome(world.getBiome(pos.offset(fd, i))); if (CommonUtils.isIDInList(biomeID, biomeIDBlacklist)) return biomeID; } @@ -400,7 +403,7 @@ public static int getBlacklistBiomeIDWithinRange(World world, int x, int z, int for (int ew = 2; ew < 4; ew++) for (int r = adjRadius; r > 0; r = r - 2) { - biomeID = world.getBiomeGenForCoords(pos.offset(NSEW[ns], r).offset(NSEW[ew], r)).biomeID; + biomeID = Biome.getIdForBiome(world.getBiome(pos.offset(NSEW[ns], r).offset(NSEW[ew], r))); if (CommonUtils.isIDInList(biomeID, biomeIDBlacklist)) return biomeID; } @@ -467,45 +470,47 @@ else if (choice >= (totalWeight - shapeStalactiteWeight - shapeJetsonsWeight - s return WorldGenFloatingIsland.SPHEROID; } + //TODO: i need to rework this entire section. need to switch this all over to modname:blockname possibly see net.minecraftforge.fml.common.registry.GameRegistry.findRegistry + // dont know if this works, but i hope it does static { - blockIDBlacklistDefault = GameData.getBlockRegistry().getNameForObject(Blocks.bedrock) + ";"; - stringOfIdsDefault = GameData.getItemRegistry().getNameForObject(Items.arrow) + ", 10; " + - GameData.getItemRegistry().getNameForObject(Items.arrow) + ", 16; " + - GameData.getItemRegistry().getNameForObject(Items.coal) + ", 6; " + - GameData.getItemRegistry().getNameForObject(Items.diamond) + ", 1; " + - GameData.getItemRegistry().getNameForObject(Items.iron_ingot) + ", 3; " + - GameData.getItemRegistry().getNameForObject(Items.gold_ingot) + ", 2; " + - GameData.getItemRegistry().getNameForObject(Items.mushroom_stew) + ", 2; " + - GameData.getItemRegistry().getNameForObject(Items.feather) + ", 1; " + - GameData.getItemRegistry().getNameForObject(Items.chainmail_helmet) + ", 1; " + - GameData.getItemRegistry().getNameForObject(Items.chainmail_chestplate) + ", 1; " + - GameData.getItemRegistry().getNameForObject(Items.chainmail_leggings) + ", 1; " + - GameData.getItemRegistry().getNameForObject(Items.chainmail_boots) + ", 1; " + - GameData.getItemRegistry().getNameForObject(Items.painting) + ", 2; " + - GameData.getItemRegistry().getNameForObject(Items.painting) + ", 5; " + - GameData.getItemRegistry().getNameForObject(Items.golden_apple) + ", 1; " + - GameData.getItemRegistry().getNameForObject(Items.golden_apple) + ", 3; " + - GameData.getItemRegistry().getNameForObject(Items.bucket) + ", 2; " + - GameData.getItemRegistry().getNameForObject(Items.lava_bucket) + ", 1; " + - GameData.getItemRegistry().getNameForObject(Items.milk_bucket) + ", 1; " + - GameData.getItemRegistry().getNameForObject(Items.book) + ", 4; " + - GameData.getItemRegistry().getNameForObject(Items.slime_ball) + ", 6; " + - GameData.getItemRegistry().getNameForObject(Items.egg) + ", 4; " + - GameData.getItemRegistry().getNameForObject(Items.egg) + ", 8; " + - GameData.getItemRegistry().getNameForObject(Items.glowstone_dust) + ", 12; " + - GameData.getItemRegistry().getNameForObject(Items.glowstone_dust) + ", 8; " + - GameData.getItemRegistry().getNameForObject(Items.cooked_fish) + ", 3; " + - GameData.getItemRegistry().getNameForObject(Items.dye) + ", 5, 0; " + - GameData.getItemRegistry().getNameForObject(Items.cake) + ", 2; " + - GameData.getItemRegistry().getNameForObject(Items.blaze_rod) + ", 2; " + - GameData.getItemRegistry().getNameForObject(Items.nether_wart) + ", 6; " + - GameData.getItemRegistry().getNameForObject(Items.emerald) + ", 4; " + - GameData.getItemRegistry().getNameForObject(Items.emerald) + ", 6; " + - GameData.getItemRegistry().getNameForObject(Items.quartz) + ", 6; " + - GameData.getItemRegistry().getNameForObject(Items.map) + ", 1; " + - GameData.getBlockRegistry().getNameForObject(Blocks.obsidian) + ", 4; " + - GameData.getBlockRegistry().getNameForObject(Blocks.ice) + ", 3;"; + blockIDBlacklistDefault = Blocks.BEDROCK.toString() + ";"; + stringOfIdsDefault = Items.ARROW.toString() + ", 10; " + + Items.ARROW.toString() + ", 16; " + + Items.COAL.toString() + ", 6; " + + Items.DIAMOND.toString() + ", 1; " + + Items.IRON_INGOT.toString() + ", 3; " + + Items.GOLD_INGOT.toString() + ", 2; " + + Items.MUSHROOM_STEW.toString() + ", 2; " + + Items.FEATHER.toString() + ", 1; " + + Items.CHAINMAIL_HELMET.toString() + ", 1; " + + Items.CHAINMAIL_CHESTPLATE.toString() + ", 1; " + + Items.CHAINMAIL_LEGGINGS.toString() + ", 1; " + + Items.CHAINMAIL_BOOTS.toString() + ", 1; " + + Items.PAINTING.toString() + ", 2; " + + Items.PAINTING.toString() + ", 5; " + + Items.GOLDEN_APPLE.toString() + ", 1; " + + Items.GOLDEN_APPLE.toString() + ", 3; " + + Items.BUCKET.toString() + ", 2; " + + Items.LAVA_BUCKET.toString() + ", 1; " + + Items.MILK_BUCKET.toString() + ", 1; " + + Items.BOOK.toString() + ", 4; " + + Items.SLIME_BALL.toString() + ", 6; " + + Items.EGG.toString() + ", 4; " + + Items.EGG.toString() + ", 8; " + + Items.GLOWSTONE_DUST.toString() + ", 12; " + + Items.GLOWSTONE_DUST.toString() + ", 8; " + + Items.COOKED_FISH.toString() + ", 3; " + + Items.DYE.toString() + ", 5, 0; " + + Items.CAKE.toString() + ", 2; " + + Items.BLAZE_ROD.toString() + ", 2; " + + Items.NETHER_WART.toString() + ", 6; " + + Items.EMERALD.toString() + ", 4; " + + Items.EMERALD.toString() + ", 6; " + + Items.QUARTZ.toString() + ", 6; " + + Items.MAP.toString() + ", 1; " + + Blocks.OBSIDIAN.toString() + ", 4; " + + Blocks.ICE.toString() + ", 3;"; } } diff --git a/src/main/java/bspkrs/floatingruins/WorldGenFloatingIsland.java b/src/main/java/bspkrs/floatingruins/WorldGenFloatingIsland.java index 0e134d6..be7902b 100644 --- a/src/main/java/bspkrs/floatingruins/WorldGenFloatingIsland.java +++ b/src/main/java/bspkrs/floatingruins/WorldGenFloatingIsland.java @@ -2,15 +2,17 @@ import java.util.Random; +import bspkrs.util.BlockNotifyType; +import bspkrs.util.CommonUtils; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -import net.minecraftforge.fml.common.registry.GameData; -import bspkrs.util.BlockNotifyType; -import bspkrs.util.CommonUtils; +//import net.minecraftforge.registries.GameData; +//proper?: import net.minecraftforge.fml.common.registry.GameRegistry; +//old: import net.minecraftforge.fml.common.registry.GameData; public class WorldGenFloatingIsland extends WorldGenerator { @@ -100,10 +102,10 @@ public boolean isTgtBlockPosReplaceable(World world, BlockPos tgt, if (!world.isBlockLoaded(tgt, false)) failureReason = "Chunk does not exist."; else if (!world.isAirBlock(tgt) - && !(allowNonAirSpecialBlocks && block.equals(Blocks.water)) + && !(allowNonAirSpecialBlocks && block.equals(Blocks.WATER)) && !(allowNonAirSpecialBlocks && !world.isBlockNormalCube(tgt, true)) && !(allowNonAirSpecialBlocks && block.isWood(world, tgt)) - && !(allowNonAirSpecialBlocks && block.isLeaves(world, tgt))) + && !(allowNonAirSpecialBlocks && block.isLeaves(state, world, tgt))) failureReason = "Block at target is not replaceable."; return failureReason.isEmpty(); @@ -171,17 +173,20 @@ && isBlockInRange(islandType, world, delta, depth, radius)) IBlockState state = world.getBlockState(src); Block block = state.getBlock(); int metadata = block.getMetaFromState(state); + String SBlock = block.toString(); BlockPos tgt = tgtOrigin.add(delta); if (((y <= 0) - || (!block.equals(Blocks.water) && !block.equals(Blocks.flowing_water))) - && !CommonUtils.isIDInList(GameData.getBlockRegistry().getNameForObject(block).toString(), metadata, FloatingRuins.blockIDBlacklist)) + || (!block.equals(Blocks.WATER) && !block.equals(Blocks.FLOWING_WATER))) + //TODO: again, have to fix getBlockRegistry + // i think it is fixed, i need to test it once i can compile + && !CommonUtils.isIDInList(SBlock, metadata, FloatingRuins.blockIDBlacklist)) { - if (block.equals(Blocks.mob_spawner)) + if (block.equals(Blocks.MOB_SPAWNER)) debug += "+S(" + tgt + ") "; - else if (block.equals(Blocks.chest)) + else if (block.equals(Blocks.CHEST)) debug += "+C(" + tgt + ") "; - else if ((y >= -8) && !isLavaNearby && (block.equals(Blocks.lava) || block.equals(Blocks.flowing_lava))) + else if ((y >= -8) && !isLavaNearby && (block.equals(Blocks.LAVA) || block.equals(Blocks.FLOWING_LAVA))) { isLavaNearby = true; debug += "+L "; @@ -204,7 +209,7 @@ else if ((y >= -8) && !isLavaNearby && (block.equals(Blocks.lava) || block.equal blocksMoved++; } - if ((random.nextInt(3) == 0) && block.equals(Blocks.stone) && (Math.abs(x) <= 1) && (Math.abs(z) <= 1) && (Math.abs(y + (depth / 4)) <= 2)) + if ((random.nextInt(3) == 0) && block.equals(Blocks.STONE) && (Math.abs(x) <= 1) && (Math.abs(z) <= 1) && (Math.abs(y + (depth / 4)) <= 2)) world.setBlockState(tgt, specialOre.getDefaultState(), BlockNotifyType.NONE); } } @@ -219,13 +224,13 @@ else if ((y >= -8) && !isLavaNearby && (block.equals(Blocks.lava) || block.equal IBlockState state = world.getBlockState(tgt); Block block = state.getBlock(); if (!world.isAirBlock(tgt) && world.isAirBlock(tgt.down())) - if (block.equals(Blocks.gravel)) - world.setBlockState(tgt, Blocks.stone.getDefaultState(), BlockNotifyType.ALL); - else if (block.equals(Blocks.sand)) + if (block.equals(Blocks.GRAVEL)) + world.setBlockState(tgt, Blocks.STONE.getDefaultState(), BlockNotifyType.ALL); + else if (block.equals(Blocks.SAND)) if (block.getMetaFromState(state) == 1) - world.setBlockState(tgt, Blocks.hardened_clay.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(tgt, Blocks.HARDENED_CLAY.getDefaultState(), BlockNotifyType.ALL); else - world.setBlockState(tgt, Blocks.sandstone.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(tgt, Blocks.SANDSTONE.getDefaultState(), BlockNotifyType.ALL); } debug += "Blocks Moved: " + blocksMoved + " (" + groundBlocksMoved + " at or below origin, " + blockNotifications + " block notifications)"; @@ -274,26 +279,26 @@ private Block getSpecialOre() switch (random.nextInt(8)) { case 0: - return Blocks.diamond_ore; + return Blocks.DIAMOND_ORE; case 1: - return Blocks.gold_ore; + return Blocks.GOLD_ORE; case 2: - return Blocks.iron_ore; + return Blocks.IRON_ORE; case 3: - return Blocks.lapis_ore; + return Blocks.LAPIS_ORE; case 4: - return Blocks.redstone_ore; + return Blocks.REDSTONE_ORE; case 5: - return Blocks.emerald_ore; + return Blocks.EMERALD_ORE; case 6: - return Blocks.iron_ore; + return Blocks.IRON_ORE; } - return Blocks.coal_ore; + return Blocks.COAL_ORE; } } \ No newline at end of file diff --git a/src/main/java/bspkrs/floatingruins/WorldGenFloatingIslandRuin.java b/src/main/java/bspkrs/floatingruins/WorldGenFloatingIslandRuin.java index 98e4b93..b4edb70 100644 --- a/src/main/java/bspkrs/floatingruins/WorldGenFloatingIslandRuin.java +++ b/src/main/java/bspkrs/floatingruins/WorldGenFloatingIslandRuin.java @@ -5,6 +5,8 @@ import java.util.Locale; import java.util.Random; +import bspkrs.util.BlockNotifyType; +import bspkrs.util.CommonUtils; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.monster.EntitySlime; import net.minecraft.init.Blocks; @@ -15,16 +17,14 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.BiomeDictionary.Type; +//import net.minecraft.world.storage.loot.LootTable; import net.minecraftforge.common.ChestGenHooks; -import net.minecraftforge.fml.common.registry.GameData; -import bspkrs.util.BlockNotifyType; -import bspkrs.util.CommonUtils; +import net.minecraftforge.registries.GameData; public class WorldGenFloatingIslandRuin extends WorldGenerator { @@ -105,11 +105,11 @@ private void setDungeon(World world, Random random, BlockPos pos) { BiomeGenBase biomegenbase = world.getWorldChunkManager().getBiomeGenerator(pos); IBlockState dungeonBlock = getDungeonBlock(biomegenbase); - if (dungeonBlock.equals(Blocks.snow.getDefaultState())) + if (dungeonBlock.equals(Blocks.SNOW.getDefaultState())) setIgloo(world, pos, 5, dungeonBlock); - else if (dungeonBlock.equals(Blocks.sandstone.getDefaultState())) + else if (dungeonBlock.equals(Blocks.SANDSTONE.getDefaultState())) setPyramid(world, pos, 6, dungeonBlock); - else if (dungeonBlock.equals(Blocks.red_mushroom_block.getDefaultState())) + else if (dungeonBlock.equals(Blocks.RED_MUSHROOM_BLOCK.getDefaultState())) CommonUtils.setHugeMushroom(world, random, pos, dungeonBlock); else setBox(world, random, pos, 4, 4, getDungeonBlock(biomegenbase)); @@ -120,11 +120,11 @@ else if (dungeonBlock.equals(Blocks.red_mushroom_block.getDefaultState())) private void setChest(World world, Random random, BlockPos pos) { - world.setBlockState(pos, Blocks.chest.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(pos, Blocks.CHEST.getDefaultState(), BlockNotifyType.ALL); TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(pos); addItems(tileentitychest, random); - IBlockState blockingBlock = (FloatingRuins.harderDungeons ? Blocks.bedrock.getDefaultState() : Blocks.obsidian.getDefaultState()); + IBlockState blockingBlock = (FloatingRuins.harderDungeons ? Blocks.BEDROCK.getDefaultState() : Blocks.OBSIDIAN.getDefaultState()); world.setBlockState(pos.north(), blockingBlock, BlockNotifyType.ALL); world.setBlockState(pos.south(), blockingBlock, BlockNotifyType.ALL); @@ -133,15 +133,15 @@ private void setChest(World world, Random random, BlockPos pos) world.setBlockState(pos.down(), blockingBlock, BlockNotifyType.ALL); if (FloatingRuins.harderDungeons) - world.setBlockState(pos.up(), Blocks.obsidian.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(pos.up(), Blocks.OBSIDIAN.getDefaultState(), BlockNotifyType.ALL); else - world.setBlockState(pos.up(), Blocks.cobblestone.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(pos.up(), Blocks.COBBLESTONE.getDefaultState(), BlockNotifyType.ALL); } private void setSpawner(World world, BiomeGenBase biomegenbase, BlockPos pos) { - world.setBlockState(pos, Blocks.mob_spawner.getDefaultState(), BlockNotifyType.ALL); - IBlockState block = Blocks.obsidian.getDefaultState(); + world.setBlockState(pos, Blocks.MOB_SPAWNER.getDefaultState(), BlockNotifyType.ALL); + IBlockState block = Blocks.OBSIDIAN.getDefaultState(); world.setBlockState(pos.north(), block, BlockNotifyType.ALL); world.setBlockState(pos.south(), block, BlockNotifyType.ALL); @@ -150,8 +150,8 @@ private void setSpawner(World world, BiomeGenBase biomegenbase, BlockPos pos) world.setBlockState(pos.down(), block, BlockNotifyType.ALL); if (FloatingRuins.harderDungeons) { - world.setBlockState(pos.down(), Blocks.obsidian.getDefaultState(), BlockNotifyType.ALL); - world.setBlockState(pos.up(), Blocks.obsidian.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(pos.down(), Blocks.OBSIDIAN.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(pos.up(), Blocks.OBSIDIAN.getDefaultState(), BlockNotifyType.ALL); } TileEntityMobSpawner tileEntityMobSpawner = (TileEntityMobSpawner) world.getTileEntity(pos); @@ -355,36 +355,36 @@ private String applyEquipment(NBTTagList equipment, ArrayList 0) @@ -418,10 +418,10 @@ private ItemStack getItems(Random random) if (itemStack.length > 2) meta = CommonUtils.parseInt(itemStack[2].trim()); - Item item = GameData.getItemRegistry().getObject(id); + Item item = Item.getByNameOrId(id); if (item == null) - item = Items.egg; + item = Items.EGG; if (!item.getHasSubtypes() && (meta != 0)) meta = 0; @@ -540,8 +540,8 @@ public void setBox(World world, Random random, BlockPos pos, int width, int heig BlockPos delta = pos.add(new BlockPos(x, y, z)); if ((y == height) || ((Math.abs(x) == width) && (Math.abs(z) == width) && (y >= 0))) { - world.setBlockState(delta, Blocks.stonebrick.getDefaultState(), BlockNotifyType.ALL); - world.setBlockState(delta.up(), (FloatingRuins.harderDungeons ? Blocks.bedrock.getDefaultState() : Blocks.stonebrick.getDefaultState()), BlockNotifyType.ALL); + world.setBlockState(delta, Blocks.STONEBRICK.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(delta.up(), (FloatingRuins.harderDungeons ? Blocks.BEDROCK.getDefaultState() : Blocks.STONEBRICK.getDefaultState()), BlockNotifyType.ALL); } if ((y >= 1) && ((Math.abs(x) == width) ^ (Math.abs(z) == width))) @@ -551,13 +551,13 @@ public void setBox(World world, Random random, BlockPos pos, int width, int heig world.setBlockToAir(delta); if ((y == -1) || (y == 0)) - world.setBlockState(delta, Blocks.stonebrick.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(delta, Blocks.STONEBRICK.getDefaultState(), BlockNotifyType.ALL); if (y < -1) { int yg = CommonUtils.getHighestGroundBlock(world, delta); if (((Math.abs(x) == width) || (Math.abs(z) == width)) && !world.isBlockNormalCube(delta, false) && (yg < (y + pos.getY())) && (yg >= (pos.getY() - height))) - world.setBlockState(delta, Blocks.stonebrick.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(delta, Blocks.STONEBRICK.getDefaultState(), BlockNotifyType.ALL); } } } @@ -575,17 +575,17 @@ private void setIgloo(World world, BlockPos pos, int range, IBlockState block) if (y >= 0) { if (dist == range) - world.setBlockState(delta, (FloatingRuins.harderDungeons && (y > 2) ? Blocks.bedrock.getDefaultState() : block), BlockNotifyType.ALL); + world.setBlockState(delta, (FloatingRuins.harderDungeons && (y > 2) ? Blocks.BEDROCK.getDefaultState() : block), BlockNotifyType.ALL); // For wolves if ((y == 0) && (dist < range)) - world.setBlockState(delta, Blocks.grass.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(delta, Blocks.GRASS.getDefaultState(), BlockNotifyType.ALL); if ((y > 0) && (dist < range)) { world.setBlockToAir(delta); if (y == 1) - world.setBlockState(delta, Blocks.snow_layer.getDefaultState(), BlockNotifyType.ALL); + world.setBlockState(delta, Blocks.SNOW_LAYER.getDefaultState(), BlockNotifyType.ALL); } } else @@ -611,7 +611,7 @@ private void setPyramid(World world, BlockPos pos, int range, IBlockState block) if (y >= 0) { if (((Math.abs(x) == (range - y)) && (Math.abs(x) >= Math.abs(z))) || ((Math.abs(z) == (range - y)) && (Math.abs(z) >= Math.abs(x))) || (y == 0)) - world.setBlockState(delta, (FloatingRuins.harderDungeons && (y > 2) ? Blocks.bedrock.getDefaultState() : block), BlockNotifyType.ALL); + world.setBlockState(delta, (FloatingRuins.harderDungeons && (y > 2) ? Blocks.BEDROCK.getDefaultState() : block), BlockNotifyType.ALL); else if (((Math.abs(x) < (range - y)) && (Math.abs(x) >= Math.abs(z))) || ((Math.abs(z) < (range - y)) && (Math.abs(z) >= Math.abs(x)))) world.setBlockToAir(delta); } @@ -629,40 +629,40 @@ else if (((Math.abs(x) < (range - y)) && (Math.abs(x) >= Math.abs(z))) || ((Math static { - helmWeights.add(new SimpleEntry(new ItemStack(Items.leather_helmet, 1, 0), 3)); - helmWeights.add(new SimpleEntry(new ItemStack(Items.iron_helmet, 1, 0), 7)); - helmWeights.add(new SimpleEntry(new ItemStack(Items.chainmail_helmet, 1, 0), 9)); - helmWeights.add(new SimpleEntry(new ItemStack(Items.golden_helmet, 1, 0), 12)); - helmWeights.add(new SimpleEntry(new ItemStack(Items.diamond_helmet, 1, 0), 16)); - - plateWeights.add(new SimpleEntry(new ItemStack(Items.leather_chestplate, 1, 0), 3)); - plateWeights.add(new SimpleEntry(new ItemStack(Items.iron_chestplate, 1, 0), 7)); - plateWeights.add(new SimpleEntry(new ItemStack(Items.chainmail_chestplate, 1, 0), 9)); - plateWeights.add(new SimpleEntry(new ItemStack(Items.golden_chestplate, 1, 0), 12)); - plateWeights.add(new SimpleEntry(new ItemStack(Items.diamond_chestplate, 1, 0), 16)); - - leggingWeights.add(new SimpleEntry(new ItemStack(Items.leather_leggings, 1, 0), 3)); - leggingWeights.add(new SimpleEntry(new ItemStack(Items.iron_leggings, 1, 0), 7)); - leggingWeights.add(new SimpleEntry(new ItemStack(Items.chainmail_leggings, 1, 0), 9)); - leggingWeights.add(new SimpleEntry(new ItemStack(Items.golden_leggings, 1, 0), 12)); - leggingWeights.add(new SimpleEntry(new ItemStack(Items.diamond_leggings, 1, 0), 16)); - - bootWeights.add(new SimpleEntry(new ItemStack(Items.leather_boots, 1, 0), 3)); - bootWeights.add(new SimpleEntry(new ItemStack(Items.iron_boots, 1, 0), 7)); - bootWeights.add(new SimpleEntry(new ItemStack(Items.chainmail_boots, 1, 0), 9)); - bootWeights.add(new SimpleEntry(new ItemStack(Items.golden_boots, 1, 0), 12)); - bootWeights.add(new SimpleEntry(new ItemStack(Items.diamond_boots, 1, 0), 16)); - - skelWeapWeights.add(new SimpleEntry(new ItemStack(Items.bow, 1, 0), 46)); - skelWeapWeights.add(new SimpleEntry(new ItemStack(Items.iron_sword, 1, 0), 11)); - skelWeapWeights.add(new SimpleEntry(new ItemStack(Items.diamond_sword, 1, 0), 2)); - skelWeapWeights.add(new SimpleEntry(new ItemStack(Items.golden_sword, 1, 0), 5)); - - zombWeapWeights.add(new SimpleEntry(new ItemStack(Items.stone_sword, 1, 0), 10)); - zombWeapWeights.add(new SimpleEntry(new ItemStack(Items.diamond_sword, 1, 0), 4)); - zombWeapWeights.add(new SimpleEntry(new ItemStack(Items.golden_sword, 1, 0), 10)); - zombWeapWeights.add(new SimpleEntry(new ItemStack(Items.wooden_sword, 1, 0), 5)); - zombWeapWeights.add(new SimpleEntry(new ItemStack(Items.iron_sword, 1, 0), 11)); + helmWeights.add(new SimpleEntry(new ItemStack(Items.LEATHER_HELMET, 1, 0), 3)); + helmWeights.add(new SimpleEntry(new ItemStack(Items.IRON_HELMET, 1, 0), 7)); + helmWeights.add(new SimpleEntry(new ItemStack(Items.CHAINMAIL_HELMET, 1, 0), 9)); + helmWeights.add(new SimpleEntry(new ItemStack(Items.GOLDEN_HELMET, 1, 0), 12)); + helmWeights.add(new SimpleEntry(new ItemStack(Items.DIAMOND_HELMET, 1, 0), 16)); + + plateWeights.add(new SimpleEntry(new ItemStack(Items.LEATHER_CHESTPLATE, 1, 0), 3)); + plateWeights.add(new SimpleEntry(new ItemStack(Items.IRON_CHESTPLATE, 1, 0), 7)); + plateWeights.add(new SimpleEntry(new ItemStack(Items.CHAINMAIL_CHESTPLATE, 1, 0), 9)); + plateWeights.add(new SimpleEntry(new ItemStack(Items.GOLDEN_CHESTPLATE, 1, 0), 12)); + plateWeights.add(new SimpleEntry(new ItemStack(Items.DIAMOND_CHESTPLATE, 1, 0), 16)); + + leggingWeights.add(new SimpleEntry(new ItemStack(Items.LEATHER_LEGGINGS, 1, 0), 3)); + leggingWeights.add(new SimpleEntry(new ItemStack(Items.IRON_LEGGINGS, 1, 0), 7)); + leggingWeights.add(new SimpleEntry(new ItemStack(Items.CHAINMAIL_LEGGINGS, 1, 0), 9)); + leggingWeights.add(new SimpleEntry(new ItemStack(Items.GOLDEN_LEGGINGS, 1, 0), 12)); + leggingWeights.add(new SimpleEntry(new ItemStack(Items.DIAMOND_LEGGINGS, 1, 0), 16)); + + bootWeights.add(new SimpleEntry(new ItemStack(Items.LEATHER_BOOTS, 1, 0), 3)); + bootWeights.add(new SimpleEntry(new ItemStack(Items.IRON_BOOTS, 1, 0), 7)); + bootWeights.add(new SimpleEntry(new ItemStack(Items.CHAINMAIL_BOOTS, 1, 0), 9)); + bootWeights.add(new SimpleEntry(new ItemStack(Items.GOLDEN_BOOTS, 1, 0), 12)); + bootWeights.add(new SimpleEntry(new ItemStack(Items.DIAMOND_BOOTS, 1, 0), 16)); + + skelWeapWeights.add(new SimpleEntry(new ItemStack(Items.BOW, 1, 0), 46)); + skelWeapWeights.add(new SimpleEntry(new ItemStack(Items.IRON_SWORD, 1, 0), 11)); + skelWeapWeights.add(new SimpleEntry(new ItemStack(Items.DIAMOND_SWORD, 1, 0), 2)); + skelWeapWeights.add(new SimpleEntry(new ItemStack(Items.GOLDEN_SWORD, 1, 0), 5)); + + zombWeapWeights.add(new SimpleEntry(new ItemStack(Items.STONE_SWORD, 1, 0), 10)); + zombWeapWeights.add(new SimpleEntry(new ItemStack(Items.DIAMOND_SWORD, 1, 0), 4)); + zombWeapWeights.add(new SimpleEntry(new ItemStack(Items.GOLDEN_SWORD, 1, 0), 10)); + zombWeapWeights.add(new SimpleEntry(new ItemStack(Items.WOODEN_SWORD, 1, 0), 5)); + zombWeapWeights.add(new SimpleEntry(new ItemStack(Items.IRON_SWORD, 1, 0), 11)); allowedCtgys = new String[] { // ChestGenHooks.BONUS_CHEST, diff --git a/src/main/java/bspkrs/floatingruins/fml/DelayedWorldGenTicker.java b/src/main/java/bspkrs/floatingruins/fml/DelayedWorldGenTicker.java index e6e1491..656d1fd 100644 --- a/src/main/java/bspkrs/floatingruins/fml/DelayedWorldGenTicker.java +++ b/src/main/java/bspkrs/floatingruins/fml/DelayedWorldGenTicker.java @@ -2,8 +2,8 @@ import java.util.Random; -import net.minecraft.world.World; import bspkrs.floatingruins.FloatingRuins; +import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; diff --git a/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsMod.java b/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsMod.java index f0137a6..1be0cc0 100644 --- a/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsMod.java +++ b/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsMod.java @@ -2,6 +2,11 @@ import java.io.File; +import bspkrs.bspkrscore.fml.bspkrsCoreMod; +import bspkrs.floatingruins.FloatingRuins; +import bspkrs.util.CommonUtils; +import bspkrs.util.Const; +import bspkrs.util.ModVersionChecker; import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; @@ -15,11 +20,6 @@ import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; -import bspkrs.bspkrscore.fml.bspkrsCoreMod; -import bspkrs.floatingruins.FloatingRuins; -import bspkrs.util.CommonUtils; -import bspkrs.util.Const; -import bspkrs.util.ModVersionChecker; @Mod(modid = Reference.MODID, name = Reference.NAME, version = "@MOD_VERSION@", dependencies = "required-after:bspkrsCore@[@BSCORE_VERSION@,)", useMetadata = true, guiFactory = "bspkrs.floatingruins.fml.gui.ModGuiFactoryHandler") @@ -88,7 +88,7 @@ public void serverStarting(FMLServerStartingEvent event) @SubscribeEvent public void onConfigChanged(OnConfigChangedEvent event) { - if (event.modID.equals(Reference.MODID)) + if (event.getModID().equals(Reference.MODID)) { Reference.config.save(); FloatingRuins.syncConfig(false); diff --git a/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsTicker.java b/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsTicker.java index 922a622..18411b2 100644 --- a/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsTicker.java +++ b/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsTicker.java @@ -1,8 +1,8 @@ package bspkrs.floatingruins.fml; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentText; import bspkrs.bspkrscore.fml.bspkrsCoreMod; +import net.minecraft.client.Minecraft; +import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -30,14 +30,14 @@ public void onTick(ClientTickEvent event) if (event.phase.equals(Phase.START)) return; - boolean keepTicking = !(mcClient != null && mcClient.thePlayer != null && mcClient.theWorld != null); + boolean keepTicking = !(mcClient != null && mcClient.player != null && mcClient.world != null); if (!keepTicking && isRegistered) { if (bspkrsCoreMod.instance.allowUpdateCheck && FloatingRuinsMod.instance.versionChecker != null) if (!FloatingRuinsMod.instance.versionChecker.isCurrentVersion()) for (String msg : FloatingRuinsMod.instance.versionChecker.getInGameMessage()) - mcClient.thePlayer.addChatMessage(new ChatComponentText(msg)); + mcClient.player.sendMessage(new TextComponentString(msg)); FMLCommonHandler.instance().bus().unregister(this); isRegistered = false; diff --git a/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsWorldGenerator.java b/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsWorldGenerator.java index 2e6b2f9..76389e7 100644 --- a/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsWorldGenerator.java +++ b/src/main/java/bspkrs/floatingruins/fml/FloatingRuinsWorldGenerator.java @@ -2,10 +2,11 @@ import java.util.Random; +import bspkrs.floatingruins.FloatingRuins; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.fml.common.IWorldGenerator; -import bspkrs.floatingruins.FloatingRuins; public class FloatingRuinsWorldGenerator implements IWorldGenerator { @@ -13,11 +14,11 @@ public FloatingRuinsWorldGenerator() {} @Override - public void generate(Random random, int x, int z, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { if (FloatingRuins.enabled) - FloatingRuins.generateSurface(world, random, x << 4, z << 4, true); - //new DelayedWorldGenTicker(10, world, random, x << 4, z << 4); + FloatingRuins.generateSurface(world, random, chunkX << 4, chunkZ << 4, true); + //new DelayedWorldGenTicker(10, world, random, chunkX << 4, chunkZ << 4); } } diff --git a/src/main/java/bspkrs/floatingruins/fml/gui/GuiFRConfig.java b/src/main/java/bspkrs/floatingruins/fml/gui/GuiFRConfig.java deleted file mode 100644 index c1d6502..0000000 --- a/src/main/java/bspkrs/floatingruins/fml/gui/GuiFRConfig.java +++ /dev/null @@ -1,16 +0,0 @@ -package bspkrs.floatingruins.fml.gui; - -import net.minecraft.client.gui.GuiScreen; -import net.minecraftforge.common.config.ConfigElement; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.fml.client.config.GuiConfig; -import bspkrs.floatingruins.fml.Reference; - -public class GuiFRConfig extends GuiConfig -{ - public GuiFRConfig(GuiScreen parent) - { - super(parent, (new ConfigElement(Reference.config.getCategory(Configuration.CATEGORY_GENERAL))).getChildElements(), - Reference.MODID, false, false, GuiConfig.getAbridgedConfigPath(Reference.config.toString())); - } -} diff --git a/src/main/java/bspkrs/floatingruins/fml/gui/ModGuiFactoryHandler.java b/src/main/java/bspkrs/floatingruins/fml/gui/ModGuiFactoryHandler.java index 151fd20..42c2b4b 100644 --- a/src/main/java/bspkrs/floatingruins/fml/gui/ModGuiFactoryHandler.java +++ b/src/main/java/bspkrs/floatingruins/fml/gui/ModGuiFactoryHandler.java @@ -2,9 +2,13 @@ import java.util.Set; +import bspkrs.floatingruins.fml.Reference; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.common.config.ConfigElement; +import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.client.IModGuiFactory; +import net.minecraftforge.fml.client.config.GuiConfig; public class ModGuiFactoryHandler implements IModGuiFactory { @@ -15,20 +19,44 @@ public void initialize(Minecraft minecraftInstance) } @Override - public Class mainConfigGuiClass() + public boolean hasConfigGui() { - return GuiFRConfig.class; + return true; } - + @Override - public Set runtimeGuiCategories() + public GuiScreen createConfigGui(GuiScreen parentScreen) { - return null; + return new ConfigGui(parentScreen); + } + + public static class ConfigGui extends GuiConfig + { + public ConfigGui(GuiScreen parent) + { + super(parent, (new ConfigElement(Reference.config.getCategory(Configuration.CATEGORY_GENERAL))).getChildElements(), + Reference.MODID, false, false, GuiConfig.getAbridgedConfigPath(Reference.config.toString())); + } } + + //unfortunantly this was removed. it seems the contents of guiFRConfig needs to be moved in here... +// @Override +// public Class mainConfigGuiClass() +// { +// return GuiFRConfig.class; +// } @Override - public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) + public Set runtimeGuiCategories() { return null; } + + // unable to find a use for this method, cant find any reference to getHandlerFor() in old versions of forge + // deprecated in 1.11.2? +// @Override +// public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) +// { +// return null; +// } }