lisilew Posted May 5, 2020 Posted May 5, 2020 I am trying to modify a method in FirstPersonRenderer. Since it is not declared as a field in many classes, I chose to use reflection rather than coremod. I have a method shown below in my class that extends FirstPersonRenderer. public static void patch() { FirstPersonRenderer instance = new FirstPersonRenderer(Minecraft.getInstance()); ObfuscationReflectionHelper.setPrivateValue(Minecraft.class, Minecraft.getInstance(), instance, "field_175620_Y"); ObfuscationReflectionHelper.setPrivateValue(GameRenderer.class, Minecraft.getInstance().gameRenderer, instance, "field_78516_c"); ObfuscationReflectionHelper.setPrivateValue(GameRenderer.class, ObfuscationReflectionHelper.getPrivateValue(LightTexture.class, Minecraft.getInstance().gameRenderer.getLightTexture(), "field_205116_g"), instance, "field_78516_c"); } Is it correct that I cannot call this method in main class when FMLClientSetupEvent is fired as it accesses client only classes? If so, how can I apply these patches correctly? Quote
lisilew Posted May 5, 2020 Author Posted May 5, 2020 4 minutes ago, loordgek said: what are you trying to do I am trying to recreate sword blocking and it requires me to modify renderItemInFirstPerson method which is private. Quote
_Cruelar_ Posted May 5, 2020 Posted May 5, 2020 Just add a propertyOverride to your Item and change the position that way Quote My Projects: Cruelars Triforcemod (1.12 release; 1.14 alpha soon coming) Important: As my mod is on at least 10 different third party sites without my permission, I want to warn you about that with a link to StopModReposts
lisilew Posted May 5, 2020 Author Posted May 5, 2020 5 hours ago, _Cruelar_ said: Just add a propertyOverride to your Item and change the position that way I also have considered that but I wanted to use exact values that were used before 1.9 and I do not know how should I change those values to fit in JSON. Quote
_Cruelar_ Posted May 10, 2020 Posted May 10, 2020 Maybe try looking at shield_blocking.json or try applying the patches in your ClientProxy which should be Client-only, however note that any change to these should also be done in Client-only classes/methods Quote My Projects: Cruelars Triforcemod (1.12 release; 1.14 alpha soon coming) Important: As my mod is on at least 10 different third party sites without my permission, I want to warn you about that with a link to StopModReposts
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.