Jump to content

About replacing base class with ClassTransformer


fihgu

Recommended Posts

I am using forge-1.7.10-10.13.0.1180.

I was trying to replace a base class to fire some my custom events.

 

I followed this tutorial (the replace whole base class section): http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571568-tutorial-1-6-2-changing-vanilla-without-editing

 

Then I'm stuck on this problem:

How do I get an reobfuscated class file like the "te.class" in that tutorial?

 

I've tried to get a clean(since I can no longer install forge on MCP) MCP workspace, then copy my edited base class into "/bin" and reobfuscate it there, although it did give me a class file, but it didn't work just like how I expected..

Link to comment
Share on other sites

oh btw, it didn't work because as it will give me exceptions like: "index out of bounds" "can't find type" when I run it outside of eclipse work space, I believe my code is working correctly since it works fine in eclipse, All I need is getting a reobfuscated class file that I can get the edited bytes from.

Link to comment
Share on other sites

yes, those plugins are kinda the objective I'm trying to achieve here, having a 2nd pw is helpful to protect a server running with online-mode set to false.

 

and I'm also making lots other stuff that requires events :|

like overriding vanilla command permission, with a fully configurable module, and a anti-grief system that protects things from Mining machines from other mods.

Link to comment
Share on other sites

My question is still not answered yet: How to get a obfuscated class file with forge gradlew?

 

PS: yes class names are deobfuscated in the runtime environment, but ClassTransformer.transform method happens as you trying to load a class file into the environment, and those bytes here is obfuscated.

 

I don't have to patch every mod, just prevent the action of editing blocks from something other than the owner of the block. and my permission system has been working since Minecraft 1.4.7, and people is asking me to update it.

Link to comment
Share on other sites

just checked the link, the FE mod.

 

That mod requires other mod to use it's api, I believe they have got it working pretty well, but what i need is a light weight mod that does some .equals() check on /commands a player sends, and doesn't need to make others apply my API.

Link to comment
Share on other sites

I'm having a hard time to get use to gradlew, it used to be: you just run the reobfuscate.bat file, and it will do all the work for you and give you a obfuscated class file like "aa.class" which you can just drop it into minecraft.jar.

 

if this class file doesn't work when you drop it directly into a jar, then it won't work when you load it into memory with a ClassTransformer either.

 

so a partly obfuscated class won't do.

is there any way I can install forge into MCP like the old times?

Link to comment
Share on other sites

so I have to wait for forge to add new events?

I just don't think there will be a event I can use for my mod in the near future.

 

If you are telling me not to edit base class, you are telling me not to mod.

 

what if someone want to fix a vanilla bug? or make changes to vanilla mob/blocks?

that's just how mod is: modifying the game.

forge alone can never cover all the needs, so editing base class is necessary.

Link to comment
Share on other sites

so I have to wait for forge to add new events?

I just don't think there will be a event I can use for my mod in the near future.

 

If you are telling me not to edit base class, you are telling me not to mod.

 

what if someone want to fix a vanilla bug? or make changes to vanilla mob/blocks?

that's just how mod is: modifying the game.

forge alone can never cover all the needs, so editing base class is necessary.

 

And that's why you can publish a Pull Request to the Forge github repo.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks for the advice, I am also facing this issue, I didn't thought about it before.
    • When I add a search bar to CreativeModeTab, the text box is not rendered even though it's possible to input text. Additionally, the search is performed on all items. This issue has been occurring since 1.21. Is there something missing in my code? https://github.com/mgen256/AdditionalLights/blob/1.21/src/main/java/com/mgen256/al/AdditionalLights.java
    • This question would probably best be asked wherever fabric support is given; these are the Minecraft Forge forums. They aren't the same thing
    • client version: forge-1.7.10-10.13.4.1614-1.7.10 forgegradle version:forge-1.7.10-10.13.4.1614-1.7.10   i can run my mod in forgegradle but i put my mod into a client ,it will crash  cpw.mods.fml.common.LoaderException: java.lang.NoSuchMethodError: com.example.examplemod.items.CommonItem.setUnlocalizedName(Ljava/lang/String;)Lnet/minecraft/item/Item;     at cpw.mods.fml.common.LoadController.transition(LoadController.java:163)     at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:559)     at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)     at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:480)     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:878)     at net.minecraft.client.main.Main.main(SourceFile:148)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)     at net.minecraft.launchwrapper.Launch.main(Launch.java:28)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at oolloo.jlw.Wrapper.invokeMain(Wrapper.java:71)     at oolloo.jlw.Wrapper.main(Wrapper.java:51) Caused by: java.lang.NoSuchMethodError: com.example.examplemod.items.CommonItem.setUnlocalizedName(Ljava/lang/String;)Lnet/minecraft/item/Item;     at com.example.examplemod.items.CommonItem.<init>(CommonItem.java:10)     at com.example.examplemod.proxy.register.ItemRegister.createItem(ItemRegister.java:30)     at com.example.examplemod.proxy.register.ItemRegister.registerItems(ItemRegister.java:18)     at com.example.examplemod.proxy.CommonProxy.preInit(CommonProxy.java:12)     at com.example.examplemod.proxy.ClientProxy.preInit(ClientProxy.java:6)     at com.example.examplemod.ExampleMod.preInit(ExampleMod.java:26)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)     at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)     at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)     at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)     at com.google.common.eventbus.EventBus.post(EventBus.java:275)     at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)     at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)     at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)     at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)     at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)     at com.google.common.eventbus.EventBus.post(EventBus.java:275)     at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)     at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:556)     ... 16 more  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.