Skip to content

Commit

Permalink
New client config option to force all chunk rendering off the main th…
Browse files Browse the repository at this point in the history
…read.

This may help FPS issues, but may also result in world holes/rendering issues.
Also fix Forge configs not saving properly.
  • Loading branch information
LexManos committed Jan 17, 2017
1 parent 50bf03b commit 7da6c2d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@

this.func_180443_s();

@@ -933,7 +948,7 @@
BlockPos blockpos2 = renderchunk4.func_178568_j().func_177982_a(8, 8, 8);
boolean flag3 = blockpos2.func_177951_i(blockpos1) < 768.0D;

- if (!renderchunk4.func_188281_o() && !flag3)
+ if (net.minecraftforge.common.ForgeModContainer.alwaysSetupTerrainOffThread || (!renderchunk4.func_188281_o() && !flag3))
{
this.field_175009_l.add(renderchunk4);
}
@@ -1220,6 +1235,13 @@

public void func_174976_a(float p_174976_1_, int p_174976_2_)
Expand Down
34 changes: 17 additions & 17 deletions src/main/java/net/minecraftforge/common/ForgeModContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
public static boolean replaceVanillaBucketModel = true;
public static long java8Reminder = 0;
public static boolean disableStairSlabCulling = false; // Also known as the "DontCullStairsBecauseIUseACrappyTexturePackThatBreaksBasicBlockShapesSoICantTrustBasicBlockCulling" flag
public static boolean alwaysSetupTerrainOffThread = false; // In RenderGlobal.setupTerrain, always force the chunk render updates to be queued to the thread

private static Configuration config;
private static ForgeModContainer INSTANCE;
Expand Down Expand Up @@ -300,6 +301,13 @@ private static void syncConfig(boolean load)
prop.setLanguageKey("forge.configgui.disableStairSlabCulling").setRequiresMcRestart(false);
propOrder.add(prop.getName());

prop = config.get(Configuration.CATEGORY_CLIENT, "alwaysSetupTerrainOffThread", Boolean.FALSE,
"Enable forge to queue all chunk updates to the Chunk Update thread. May increase FPS significantly, but may also cause weird rendering lag. Not recommended for computers " +
"without a significant number of cores available.");
alwaysSetupTerrainOffThread = prop.getBoolean(Boolean.FALSE);
prop.setLanguageKey("forge.configgui.alwaysSetupTerrainOffThread");
propOrder.add(prop.getName());

config.setCategoryPropertyOrder(CATEGORY_CLIENT, propOrder);

if (config.hasChanged())
Expand All @@ -324,30 +332,22 @@ public void onConfigChanged(OnConfigChangedEvent event)
{
if (getMetadata().modId.equals(event.getModID()))
{
if (!event.isWorldRunning())
if ("chunkLoader".equals(event.getConfigID()))
{
if (Configuration.CATEGORY_GENERAL.equals(event.getConfigID()))
{
syncConfig(false);
}
else if ("chunkLoader".equals(event.getConfigID()))
{
ForgeChunkManager.syncConfigDefaults();
ForgeChunkManager.loadConfiguration();
}
else if (VERSION_CHECK_CAT.equals(event.getConfigID()))
{
syncConfig(false);
}
ForgeChunkManager.syncConfigDefaults();
ForgeChunkManager.loadConfiguration();
}
else
{
boolean tmp = config.get(Configuration.CATEGORY_CLIENT, "disableStairSlabCulling", disableStairSlabCulling).getBoolean();
if (disableStairSlabCulling != tmp)
boolean tmpStairs = disableStairSlabCulling;

syncConfig(false);

if (event.isWorldRunning() && tmpStairs != disableStairSlabCulling)
{
disableStairSlabCulling = tmp;
FMLCommonHandler.instance().reloadRenderers();
}

}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/forge/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ forge.configgui.forgeLightPipelineEnabled=Forge Light Pipeline Enabled
forge.configgui.java8Reminder=Java 8 Reminder timestamp
forge.configgui.disableStairSlabCulling=Disable Stair/Slab culling.
forge.configgui.disableStairSlabCulling.tooltip=Enable this if you see through blocks touching stairs/slabs with your resource pack.
forge.configgui.alwaysSetupTerrainOffThread=Force threaded chunk rendering
forge.configgui.alwaysSetupTerrainOffThread.tooltip=Enable forge to queue all chunk updates to the Chunk Update thread. May increase FPS significantly, but may also cause weird rendering lag. Not recommended for computers without a significant number of cores available.

forge.configgui.modID.tooltip=The mod ID that you want to define override settings for.
forge.configgui.modID=Mod ID
Expand Down

0 comments on commit 7da6c2d

Please sign in to comment.