From 45759a9d9defd64a546608d557a05207419110ff Mon Sep 17 00:00:00 2001 From: loveyanbei <452104285@qq.com> Date: Wed, 28 Jun 2017 08:37:27 +0800 Subject: [PATCH] Port to 1.12 forge 14.21.0.2379 --- build.gradle | 6 +++--- gradle.properties | 3 --- gradle/wrapper/gradle-wrapper.properties | 4 ++-- .../gecgooden/chunkgen/client/gui/GuiFactory.java | 13 +++++-------- .../chunkgen/commands/ChunkGenCommand.java | 8 ++++---- .../gecgooden/chunkgen/handlers/TickHandler.java | 8 ++++---- .../java/com/gecgooden/chunkgen/util/Utilities.java | 6 +++--- 7 files changed, 21 insertions(+), 27 deletions(-) diff --git a/build.gradle b/build.gradle index 0665786..bcbdb1a 100644 --- a/build.gradle +++ b/build.gradle @@ -13,12 +13,12 @@ apply plugin: 'net.minecraftforge.gradle.forge' sourceCompatibility = 1.8 targetCompatibility = 1.8 -version = "1.10.2-1.5.0" +version = "1.12-1.5.0" group= "com.gecgooden.chunkgen" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "chunkgen" minecraft { - version = "1.10.2-12.18.3.2185" + version = "1.12-14.21.0.2375" runDir = "run" // the mappings can be changed at any time, and must be in the following format. @@ -26,7 +26,7 @@ minecraft { // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not allways work. // simply re-run your setup task after changing the mappings to update your workspace. - mappings = "snapshot_20161111" + mappings = "snapshot_20170627" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } diff --git a/gradle.properties b/gradle.properties index e9b9fd5..e69de29 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +0,0 @@ -# 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 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index adb2b51..426193c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Apr 15 11:39:30 CEST 2017 +#Wed Jun 28 02:21:32 CST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip diff --git a/src/main/java/com/gecgooden/chunkgen/client/gui/GuiFactory.java b/src/main/java/com/gecgooden/chunkgen/client/gui/GuiFactory.java index 137c70d..e18392f 100644 --- a/src/main/java/com/gecgooden/chunkgen/client/gui/GuiFactory.java +++ b/src/main/java/com/gecgooden/chunkgen/client/gui/GuiFactory.java @@ -13,20 +13,17 @@ public void initialize(Minecraft minecraftInstance) { } @Override - public Class mainConfigGuiClass() { - return ModGuiConfig.class; + public boolean hasConfigGui() { + return false; } @Override - public Set runtimeGuiCategories() { - return null; + public GuiScreen createConfigGui(GuiScreen guiScreen) { + return new ModGuiConfig(guiScreen); } @Override - public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { + public Set runtimeGuiCategories() { return null; } - - - } diff --git a/src/main/java/com/gecgooden/chunkgen/commands/ChunkGenCommand.java b/src/main/java/com/gecgooden/chunkgen/commands/ChunkGenCommand.java index 50b7af1..c5330ae 100644 --- a/src/main/java/com/gecgooden/chunkgen/commands/ChunkGenCommand.java +++ b/src/main/java/com/gecgooden/chunkgen/commands/ChunkGenCommand.java @@ -25,12 +25,12 @@ public ChunkGenCommand() { } @Override - public String getCommandName() { + public String getName() { return "chunkgen"; } @Override - public String getCommandUsage(ICommandSender icommandsender) { + public String getUsage(ICommandSender icommandsender) { return "commands.chunkgen.usage"; } @@ -79,14 +79,14 @@ public void execute(MinecraftServer server, ICommandSender icommandsender, Strin break; case SUB_CMD_STOP: Reference.toGenerate.clear(); - icommandsender.addChatMessage(new TextComponentTranslation("commands.chunkgen.stopped")); + icommandsender.sendMessage(new TextComponentTranslation("commands.chunkgen.stopped")); break; } } } @Override - public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { + public List getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { switch (args.length) { case 1: return getListOfStringsMatchingLastWord(args, SUB_CMD_HELP, SUB_CMD_ZONE, SUB_CMD_RADIUS, SUB_CMD_STOP); diff --git a/src/main/java/com/gecgooden/chunkgen/handlers/TickHandler.java b/src/main/java/com/gecgooden/chunkgen/handlers/TickHandler.java index 8bf8460..4d61f0d 100644 --- a/src/main/java/com/gecgooden/chunkgen/handlers/TickHandler.java +++ b/src/main/java/com/gecgooden/chunkgen/handlers/TickHandler.java @@ -20,7 +20,7 @@ public class TickHandler { private int getChunksLoaded(MinecraftServer server) { int total = 0; - for (WorldServer worldServer : server.worldServers) { + for (WorldServer worldServer : server.worlds) { total += worldServer.getChunkProvider().getLoadedChunkCount(); } return total; @@ -46,12 +46,12 @@ public void onServerTick(TickEvent.ServerTickEvent event) { ConfigurationHandler.UpdateSkipChunks(); } if (cp.logToChat()) { - cp.getICommandSender().addChatMessage(new TextComponentTranslation("chunkgen.genat", cp.getX(), cp.getZ(), getChunkDescription(cp), String.format("%.3f", completedPercentage))); + cp.getICommandSender().sendMessage(new TextComponentTranslation("chunkgen.genat", cp.getX(), cp.getZ(), getChunkDescription(cp), String.format("%.3f", completedPercentage))); } if (Reference.toGenerate.peek() == null) { TextComponentTranslation chatTranslation = new TextComponentTranslation("chunkgen.success"); - server.addChatMessage(chatTranslation); - cp.getICommandSender().addChatMessage(new TextComponentString(chatTranslation.getUnformattedComponentText())); + server.sendMessage(chatTranslation); + cp.getICommandSender().sendMessage(new TextComponentString(chatTranslation.getUnformattedComponentText())); server.saveAllWorlds(true); } } diff --git a/src/main/java/com/gecgooden/chunkgen/util/Utilities.java b/src/main/java/com/gecgooden/chunkgen/util/Utilities.java index 34deefe..7b18a7f 100644 --- a/src/main/java/com/gecgooden/chunkgen/util/Utilities.java +++ b/src/main/java/com/gecgooden/chunkgen/util/Utilities.java @@ -17,18 +17,18 @@ public class Utilities { private static boolean chunksExist(MinecraftServer server, int x, int z, int dimensionID) { WorldServer world = DimensionManager.getWorld(dimensionID); - ChunkProviderServer chunkProvider = server.worldServerForDimension(dimensionID).getChunkProvider(); + ChunkProviderServer chunkProvider = server.getWorld(dimensionID).getChunkProvider(); return chunkProvider.chunkExists(x, z) || RegionFileCache.createOrLoadRegionFile(world.getChunkSaveLocation(), x, z).chunkExists(x & 0x1F, z & 0x1F); } public static boolean generateChunk(MinecraftServer server, int x, int z, int dimensionID) { - ChunkProviderServer chunkProvider = server.worldServerForDimension(dimensionID).getChunkProvider(); + ChunkProviderServer chunkProvider = server.getWorld(dimensionID).getChunkProvider(); if (chunkProvider.chunkExists(x, z)) { return false; } if (chunkProvider.getLoadedChunkCount() > Reference.maxChunksLoaded) { chunkProvider.saveChunks(true); - chunkProvider.unloadAllChunks(); + chunkProvider.queueUnloadAll(); } chunkProvider.provideChunk(x, z); return true;