Add logging for data manager key registration errors (#5129)

This commit is contained in:
ichttt authored and mezz committed 2018-12-01 16:28:02 -08:00
1 parent f8879b1316
commit 7731e1cd75
1 file changed
+22
@@ -0,0 +1,22 @@
--- ../src-base/minecraft/net/minecraft/network/datasync/EntityDataManager.java
+++ ../src-work/minecraft/net/minecraft/network/datasync/EntityDataManager.java
@@ -38,7 +38,7 @@
public static <T> DataParameter<T> func_187226_a(Class <? extends Entity > p_187226_0_, DataSerializer<T> p_187226_1_)
{
- if (field_190303_a.isDebugEnabled())
+ if (true || field_190303_a.isDebugEnabled()) //Forge: This is very useful for mods that register keys on classes that are not their own
{
try
{
@@ -46,7 +46,9 @@
if (!oclass.equals(p_187226_0_))
{
- field_190303_a.debug("defineId called for: {} from {}", p_187226_0_, oclass, new RuntimeException());
+ //Forge: log at warn, mods should not add to classes that they don't own, and only add stacktrace when in debug is enabled as it is mostly not needed and consumes time
+ if (field_190303_a.isDebugEnabled()) field_190303_a.warn("defineId called for: {} from {}", p_187226_0_, oclass, new RuntimeException());
+ else field_190303_a.warn("defineId called for: {} from {}", p_187226_0_, oclass);
}
}
catch (ClassNotFoundException var5)