forked from iguanaman/HungerOverhaul
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unneeded ReflectionModule once and for all! (reverted from com…
…mit a11def2)
- Loading branch information
alexbegt
committed
Jan 22, 2018
1 parent
ba0f059
commit e74b946
Showing
4 changed files
with
67 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/iguanaman/hungeroverhaul/module/reflection/ReflectionModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package iguanaman.hungeroverhaul.module.reflection; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
import com.pam.harvestcraft.blocks.growables.BlockPamCrop; | ||
|
||
import net.minecraft.block.properties.PropertyInteger; | ||
import net.minecraftforge.fml.common.Loader; | ||
import net.minecraftforge.fml.relauncher.ReflectionHelper; | ||
|
||
//TODO: REMOVE REFLECTION HELPER IN 1.13 | ||
public class ReflectionModule | ||
{ | ||
//@formatter:off | ||
public static PropertyInteger pamCropAge = null; | ||
|
||
public static boolean pamCropAgeFound = false; | ||
//@formatter:on | ||
|
||
public static void postInit() | ||
{ | ||
if (Loader.isModLoaded("harvestcraft")) | ||
{ | ||
Field pamCropAgeField = ReflectionHelper.findField(BlockPamCrop.class, "AGE"); | ||
pamCropAgeField.setAccessible(true); | ||
|
||
try | ||
{ | ||
pamCropAge = (PropertyInteger) pamCropAgeField.get(null); | ||
pamCropAgeFound = pamCropAge != null; | ||
} | ||
catch (Exception e) | ||
{ | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
} |