Added config option to disable Forge's fix of Stair/Slab face culling.

Some vanilla resource packs exploit this issue in their custom models causing unintended rendering issues.
This commit is contained in:
LexManos committed 2016-07-30 10:31:46 -07:00
1 parent 4694152124
commit 0f6b16cada
8 files changed
+59 -13

No files matched your search

@@ -72,6 +72,7 @@ import net.minecraftforge.fml.client.FMLFileResourcePack;
import net.minecraftforge.fml.client.FMLFolderResourcePack;
import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent;
import net.minecraftforge.fml.common.DummyModContainer;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ICrashCallable;
import net.minecraftforge.fml.common.LoadController;
@@ -105,6 +106,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
public static boolean forgeLightPipelineEnabled = true;
public static boolean replaceVanillaBucketModel = true;
public static long java8Reminder = 0;
public static boolean disableStairSlabCulling = false; // Also known as the "DontCullStairsBecauseIUseACrappyTexturePackThatBreaksBasicBlockShapesSoICantTrustBasicBlockCulling" flag
private static Configuration config;
private static ForgeModContainer INSTANCE;
@@ -285,6 +287,12 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
prop.setLanguageKey("forge.configgui.java8Reminder");
propOrder.add(prop.getName());
prop = config.get(Configuration.CATEGORY_CLIENT, "disableStairSlabCulling", disableStairSlabCulling,
"Disable culling of hidden faces next to stairs and slabs. Causes extra rendering, but may fix some resource packs that exploit this vanilla mechanic.");
disableStairSlabCulling = prop.getBoolean(disableStairSlabCulling);
prop.setLanguageKey("forge.configgui.disableStairSlabCulling").setRequiresMcRestart(false);
propOrder.add(prop.getName());
config.setCategoryPropertyOrder(CATEGORY_CLIENT, propOrder);
if (config.hasChanged())
@@ -307,20 +315,32 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
@SubscribeEvent
public void onConfigChanged(OnConfigChangedEvent event)
{
if (getMetadata().modId.equals(event.getModID()) && !event.isWorldRunning())
if (getMetadata().modId.equals(event.getModID()))
{
if (Configuration.CATEGORY_GENERAL.equals(event.getConfigID()))
if (!event.isWorldRunning())
{
syncConfig(false);
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);
}
}
else if ("chunkLoader".equals(event.getConfigID()))
else
{
ForgeChunkManager.syncConfigDefaults();
ForgeChunkManager.loadConfiguration();
}
else if (VERSION_CHECK_CAT.equals(event.getConfigID()))
{
syncConfig(false);
boolean tmp = config.get(Configuration.CATEGORY_CLIENT, "disableStairSlabCulling", disableStairSlabCulling).getBoolean();
if (disableStairSlabCulling != tmp)
{
disableStairSlabCulling = tmp;
FMLCommonHandler.instance().reloadRenderers();
}
}
}
}
@@ -1032,4 +1032,10 @@ public class FMLClientHandler implements IFMLSidedHandler
// We can't handle many unicode points in the splash renderer
return CharMatcher.anyOf(ALLOWED_CHARS).retainFrom(StringUtils.stripControlCodes(message));
}
@Override
public void reloadRenderers()
{
this.client.renderGlobal.loadRenderers();
}
}
@@ -742,4 +742,8 @@ public class FMLCommonHandler
{
return sidedDelegate != null ? sidedDelegate.stripSpecialChars(message) : message;
}
public void reloadRenderers() {
sidedDelegate.reloadRenderers();
}
}
@@ -73,4 +73,6 @@ public interface IFMLSidedHandler
void processWindowMessages();
String stripSpecialChars(String message);
void reloadRenderers();
}
@@ -328,4 +328,10 @@ public class FMLServerHandler implements IFMLSidedHandler
{
return message;
}
@Override
public void reloadRenderers() {
// NOOP
}
}