-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
68 additions
and
9 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
38 changes: 38 additions & 0 deletions
38
src/main/java/info/ata4/minecraft/mineshot/util/reflection/RenderGlobalAccessor.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 @@ | ||
/* | ||
** 2014 August 22 | ||
** | ||
** The author disclaims copyright to this source code. In place of | ||
** a legal notice, here is a blessing: | ||
** May you do good and not evil. | ||
** May you find forgiveness for yourself and forgive others. | ||
** May you share freely, never taking more than you give. | ||
*/ | ||
package info.ata4.minecraft.mineshot.util.reflection; | ||
|
||
import cpw.mods.fml.relauncher.ReflectionHelper; | ||
import net.minecraft.client.renderer.RenderGlobal; | ||
import net.minecraft.client.renderer.WorldRenderer; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
/** | ||
* | ||
* @author Nico Bergemann <barracuda415 at yahoo.de> | ||
*/ | ||
public class RenderGlobalAccessor { | ||
|
||
private static final Logger L = LogManager.getLogger(); | ||
private static final String[] FIELD_WORLDRENDERERS = new String[] {"worldRenderers", "field_72765_l"}; | ||
|
||
private RenderGlobalAccessor() { | ||
} | ||
|
||
public static WorldRenderer[] getWorldRenderers(RenderGlobal rg) { | ||
try { | ||
return ReflectionHelper.getPrivateValue(RenderGlobal.class, rg, FIELD_WORLDRENDERERS); | ||
} catch (Exception ex) { | ||
L.error("getWordRenderers() failed", ex); | ||
return new WorldRenderer[]{}; | ||
} | ||
} | ||
} |
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