Skip to content

Commit

Permalink
Port to 1.12 forge 14.21.0.2379
Browse files Browse the repository at this point in the history
  • Loading branch information
loveyanbei committed Jun 28, 2017
1 parent 48426cf commit 45759a9
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 27 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ 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.
// 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 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.
}

Expand Down
3 changes: 0 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
13 changes: 5 additions & 8 deletions src/main/java/com/gecgooden/chunkgen/client/gui/GuiFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@ public void initialize(Minecraft minecraftInstance) {
}

@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return ModGuiConfig.class;
public boolean hasConfigGui() {
return false;
}

@Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null;
public GuiScreen createConfigGui(GuiScreen guiScreen) {
return new ModGuiConfig(guiScreen);
}

@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down Expand Up @@ -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<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) {
public List<String> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/gecgooden/chunkgen/util/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 45759a9

Please sign in to comment.