diff options
author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2022-12-15 16:53:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-15 16:53:12 +0100 |
commit | 8a581938862a4d612f510a8afed88727a34c3916 (patch) | |
tree | 0307ca87f3c06bbeda6d699aabbc2247b6f38efb /src/main/java/kubatech/api/helpers | |
parent | 24a9953b153529191c855af0ae2d10f35844095f (diff) | |
download | GT5-Unofficial-8a581938862a4d612f510a8afed88727a34c3916.tar.gz GT5-Unofficial-8a581938862a4d612f510a8afed88727a34c3916.tar.bz2 GT5-Unofficial-8a581938862a4d612f510a8afed88727a34c3916.zip |
MODULAR UI (#34)
* MODULAR UUUUUUUUIIIIIIIIIII
* Tea
* Add recipe to ULTIMATE TEA
* Stupid MT Scripts. I hate it
* Yeet
* More TEA
* Add blocks
* More Modular UIs
* Textures
* Fix custom UI containers
* Texture, tooltip
* UI with tabs
* ButtonWidget
* fix
* Fix
* Texture
* Color is fixed
* More UI work
* Modular UI is hard dependency now
* Spotless
* Simplify
* Format numbers
* A
* Update TeaAcceptorTile.java
* Shadow is fixed, lets gooooo
* hardness
* Mixins mixins mixins
* Tab icons
* Fix crash
* Shop concept
* Bump ModularUI
* Bump Modular UI
* Nooooooooooo
* GREY -> GRAY
* Bump ModularUI
* Bump GT5
* EEC with MUI test
* Include incomplete structure
* REFLECTIONS !!
* Just use slot filter
* Update pos when needed
* Update GT_MetaTileEntity_ExtremeExterminationChamber.java
* Spawner status
* Nice toggle button
* Send messages
* Next toggle button
* Start work on IAADDS
* Scrollable inventory test
* Draw queen slots
* Fix
* Update dependencies.gradle
* Use sync widget
* Add button to enable/disable working
* Configuration in Mega Apiary
* Refactor a bit
* Update ModularUI
* Bump ModularUI
* Bump GT5
* Fix build
* Update dependencies.gradle
* Update build.gradle
* Update dependencies.gradle
* spotless
* Begin working on configuration window
* Update dependencies.gradle
* Deprecated
* Update dependencies.gradle
* Optimize bee storage rendering (2 fps -> 100 fps)
* Make Mega Apiary storage GUI usable
* Configuration window looks ok
* Color is fixed
* TC research
* Disable for now
* Finish tea command
* ok
* Fix
* Update en_US.lang
* ZzZ
* Stuff changed
Diffstat (limited to 'src/main/java/kubatech/api/helpers')
-rw-r--r-- | src/main/java/kubatech/api/helpers/ReflectionHelper.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/kubatech/api/helpers/ReflectionHelper.java b/src/main/java/kubatech/api/helpers/ReflectionHelper.java index 1d7449afc4..7b02fe6c82 100644 --- a/src/main/java/kubatech/api/helpers/ReflectionHelper.java +++ b/src/main/java/kubatech/api/helpers/ReflectionHelper.java @@ -45,6 +45,7 @@ public class ReflectionHelper { boolean exceptionDetected = false; Field f = null; do { + exceptionDetected = false; try { f = cl.getDeclaredField(fieldName); f.setAccessible(true); @@ -61,6 +62,38 @@ public class ReflectionHelper { } } + public static <T> boolean setField(Object obj, String fieldName, T value) { + Class<?> cl = obj.getClass(); + String clName = cl.getName(); + HashMap<String, Field> classmap = classes.computeIfAbsent(clName, s -> new _FieldsMethods()).fields; + try { + if (classmap.containsKey(fieldName)) { + Field f = classmap.get(fieldName); + if (f == null) return false; + f.set(obj, value); + return true; + } + boolean exceptionDetected = false; + Field f = null; + do { + exceptionDetected = false; + try { + f = cl.getDeclaredField(fieldName); + f.setAccessible(true); + } catch (Exception ex) { + exceptionDetected = true; + cl = cl.getSuperclass(); + } + } while (exceptionDetected && !cl.equals(Object.class)); + classmap.put(fieldName, f); + if (f == null) return false; + f.set(obj, value); + return true; + } catch (Exception ex) { + return false; + } + } + public static <T> T getField(Object obj, String fieldName) { return getField(obj, fieldName, null); } @@ -87,6 +120,7 @@ public class ReflectionHelper { boolean exceptionDetected = false; Method m = null; do { + exceptionDetected = false; try { m = cl.getDeclaredMethod(methodName, argsTypes); m.setAccessible(true); |