Jump to content

czaarek99

Members
  • Posts

    33
  • Joined

  • Last visited

Everything posted by czaarek99

  1. I know a coremod would probably make sense 99% of the time. But I can't use that this time. I looked through the github repo and couldn't figure out how they were modifying the code. EDIT: Yeah I must have been blind when I looked at the github repo last time: https://github.com/MinecraftForge/MinecraftForge/tree/master/patches/minecraft/net/minecraft And yes, im polish
  2. I have kind of an unusual question. I am creating something that is very out of the ordinary where I have to inject the code into minecraft. Anyway, I was wondering if forge directly modifies base classes? And if so which ones, is there a list?
  3. The mod is huge, he said I should look into the mod. Its like telling me to use java? I don't even know what item I should be looking into. Conisdering he said that the mod contain a solution i assume he knows what class/item it is at least.
  4. That does not help a lot, what even is enderIO? Does it have an item that does something similiar? If so what item and what class.
  5. I don't know if it matters? But I am trying to make a freecam mod, this mod allows you to move without sending the packets to the server so you move locally. Why I can't just do this manually in the minecraft classes and have to use forge is because I have a bunch of other mods that I want my players to use along with forge + my custom coded ones.
  6. I read this tutoria: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html I think I understand how to create a new packet and then send it. But how can I cancel already existing packets? Like stop the client from sending the animation packet?
  7. There is something that I'd like to do but there are no forge hooks for. Is it possible to tell forge to replace something in vanilla class to my own liking? Or maybe replace the whole class? I'd still like to get the functionality of forge but still be able to perform what isn't possible in forge.
  8. I'll have a look into intercepting every GUI call... But those are many places. Anyway, I doubt I'll even be done with it today since I don't have much time left. Friends coming over and stuff. And having someone else look at it is probably a good idea too.
  9. Thank you! If you figure it out it would be nice if you also include the code as that makes it much easier for me to understand. Having some code to reference when reading how someone did it is always helpful.
  10. I'd love to use nameformat, but it only fires on the server? If you read the thread my code works properly, but if I try it out on a multiplayer server my events just refuse to fire.
  11. Basically I started this thread over here: http://www.minecraftforge.net/forum/index.php/topic,22260.0.html Basically what I'd like to do is intercept usernames and change them. Clientsided ONLY. The mod is not going to be installed on the server. If you read towards the few replies in the end of the thread you'll understand what problems this causes. I'd like an explanation of how this can be solved as I really have no idea. Using reflection on entityplayer didn't work. Maybe there is another event than NameEvent that you can tie into to change the display names? I have no idea.
  12. So I adventured down through the minecraft code all the way down. I eventually ended up in minecrafts EntityPlayer class. Anyway, how can I know which field is which? Since minecraft even decompiled has fields like this "field_151432_d". I can't access a field if I don't know which one to access. This is my code for modifying it for now, obviously won't work for above reason. @Subscribe public void everyTick(TickEvent everyTick){ EntityPlayer privateObject = new EntityPlayer("The Private Value") { }; Field displayNameField = EntityPlayer.class. getDeclaredField(displayName); displayNameField.setAccessible(true); String fieldValue = (String) privateStringField.get(privateObject); } EDIT: I had BedrockMiner try to accomplish this, but unfortunately it is impossible to modify for some reason. I am going to start a new thread concering this issue in specific, anyway thanks for all the help I got with proxies. Now I understand a proxy is pretty much useless for me since the mod will only be installed on one side. Link to new thread: http://www.minecraftforge.net/forum/index.php/topic,22449.0.html
  13. If you follow the call hierarchy, all of this just updates a field in EntityPlayer called displayName. It is private, but you can change it with Java reflection I think. So what if you did a ClientTickHandler and used Java reflection to inspect and modify (if necessary) the displayName field? I think this would still be limited to Client, so if you want other users to see the effect they'd have to use the mod too probably. If that doesn't work, I think you'd have to try to intercept the chat and the player rendering where they display names. Just intercepting it in chat would be a last rescue thing. Since I want the displayname to change everywhere, scoreboards, tab, etc etc. Anyway, If there is no other we I guess I'll have to modify everything seperately. The thing is, this forge modding is already hard for me and I only have some basic java knowledge. And I really have no idea how to do the reflection part. There are tutorials on the tickhandler but I can't find a suitable one for reflection. I mean, there surely are some but none seem to be giving me this information. Maybe you can link me to a good one?
  14. Yeah, it always prints false... So that means my mod is impossible and the server would need to have it installed? Edit: And yeah, the server won't have the mod installed. Only the client. I have seen hacked clients implementing friends list even without forge. Now, I'd just like to make a fancy friendslist for myself or whatever. I mean... It has to be possible. But what other event or how can I get it to fire?
  15. I read your tutorial, it showed pretty much the same thing as every other tutorial that I have read so far in 1. I have basically already seen all that. I did what you recommended but my events still refuse to fire in multiplayer. Is there a special way to register events in Multiplayer? Since that is what I am starting to think. And no ones tutorial really shows how to use the events in multiplayer. I tried making a few other events. None fire in multiplayer, never? Here are my classes once again: package com.czaarek99.FrameMod; /** * Created by Czarek on 2014-08-09. */ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerEvent; @Mod(modid = FrameMod.modid, version = FrameMod.version) public class FrameMod { public static final String modid = "FrameMod"; public static final String version = "1.0 ALPHA"; @SidedProxy(clientSide = "com.czaarek99.FrameMod.ClientProxy", serverSide = "com.czaarek99.FrameMod.CommonProxy") public static CommonProxy proxy; @Mod.EventHandler public void init(FMLInitializationEvent event) { proxy.init(event); System.out.print("init fired!"); } } package com.czaarek99.FrameMod; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerEvent; /** * Created by Czarek on 2014-08-12. */ public class CommonProxy{ public void init(FMLInitializationEvent events){ FMLCommonHandler.instance().bus().register(new MyEventHandler()); MinecraftForge.EVENT_BUS.register(new MyEventHandler()); System.out.print("common init fired!"); } } package com.czaarek99.FrameMod; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.event.entity.player.PlayerEvent; /** * Created by Czarek on 2014-08-12. */ public class ClientProxy extends CommonProxy { @Override public void init(FMLInitializationEvent events){ super.init(events); System.out.print("client init fired!"); } } package com.czaarek99.FrameMod; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.event.entity.player.PlayerEvent; /** * Created by Czarek on 2014-08-14. */ public class MyEventHandler { @SubscribeEvent public void getName(PlayerEvent.NameFormat nameEvent){ if (nameEvent.username.equals("epicjellybean3")) { nameEvent.displayname = "Spy"; System.out.print("getname client fired!"); } } }
  16. Hmmm. There is something strange I realized. I did the changes needed. My new classes: Main: http://pastie.org/private/dyrw1mqfpdckxnegaiwchw ClientProxy: http://pastie.org/private/npsb9ve7dj4ymjxeqcxdja CommonProxy: http://pastie.org/private/w7xlokqibik4jcnu6by7a I added some debug prints in the events... And the subscribe event or for the matter any other event doesn't fire when I join multiplayer? (Obviously the init events do but the others though). When I join singleplayer all the events fire as expected?
  17. That helped fixed the error, thanks. Now it seems like I have followed ALL the guidelines you guys have told me to but it still wont work? Here are my classes again: Main: http://pastebin.com/Jjczu3eZ ClientProxy: http://pastebin.com/ygg8uqyV CommonProxy: http://pastebin.com/ApdpMMse
  18. Thanks... But that isn't breaking my mod. Is it? Edit: I tried renaming it, Intelli did nothing about it. The package still had capital letters. And I'd really like help with the proxies.
  19. Yea, Intelli complains if I put a normal eventhandler. Although you don't have a server-only proxy, you still need to define the serverSide , so you give it the CommonProxy like so: @SidedProxy(clientSide = "com.czaarek99.FrameMod.ClientProxy", serverSide = "com.czaarek99.FrameMod.CommonProxy"); This way, the server runs just the common proxy, and the client can run both (because the clientProxy can both execute some statements of its own and call its parent's methods using "super"). The statements in the common proxy end up running on both the client and the server. That's why it's called a common proxy -- because its actions are common to both client and server. You probably shouldn't put any @EventHandler attributes inside your proxies. Instead, put those on the methods in your main class and have those methods call their proxy counterparts. Finally, your client proxy shouldn't be empty. Wasn't there something you wanted to do that could only run on the client side? Those statements (and the import statements to support them) belong in the client proxy and its methods. I believe I did that, but now forge errors me with this: http://pastebin.com/cyYsGNqh Anyway, here are my classes. I did everything you told me to. Main: I get where the error points, but why?
  20. I kinda shuffled everything around, trying to do what jeffrey told me to. Oh, and there are no errors with this setup, it just doesn't work.
  21. Thanks, hmm. It doesn't seem to be possible to put these guys into the registerRenderThings method though? And if I remove it the proxy.registerRenderThings(); Line in my main class complains? Am I not supposed to have everything in that method? Anyway, is there any way to fix this?
  22. Maybe Im retarded, but could you show me some example code of how you would do what I am trying to do? Since I still can't get it to work Since I only have basic java knowledge I don't really understand all these fancy words, showing me a piece of code would make me it easier for me to understand your point and I'd learn a lot more too
  23. Here is all my code (in the spoiler). (The name of the mod is FrameMod because I was first going to do something with itemframes but I changed my mind and was too lazy to change names and stuff) Anyway, as you can see I am trying to replace someones name with something else. This does work good in singleplayer. But it does not work in Multiplayer. I am nearly certain I have to do something with the proxy to get this to work. Just how? There are tutorials on how to code these classes but not the use. How should I go about doing this?
  24. That works. But how can I make it work in Multiplayer? I guess it has something to do with the proxy?
  25. So basically I'd like to get a players username and change it to something else, basically I'll be making a friendlist or whatever and I'd like the name to change appropriately. I have no idea if I am doing this right as I am very new to forge and there does not seem to be many tutorials for 1.7. I also do have some basic java knowledge but I still haven't been able to figure this out. This is my code so far, (ignore the name, the mod was going to edit item frames first but I was just too lazy to change it, I'll do that later. I also heard I'll need a proxy to do that in Multiplayer but I really don't know how it works, most tutorials just show you how to make one. Now how to use one. The EventHandler class package com.czaarek99.FrameMod; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.NetworkCheckHandler; import net.minecraftforge.event.entity.player.PlayerEvent; /** * Created by Czarek on 2014-08-09. */ public class EventHandler { @SubscribeEvent public String loginEvent(PlayerEvent.NameFormat event){ if(event.username.equals("someone sexy")){ String userName = event.username; return userName; } else{ return null; } } } The main mod class (FrameMod) package com.czaarek99.FrameMod; /** * Created by Czarek on 2014-08-09. */ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; import net.minecraftforge.common.MinecraftForge; import java.lang.String; @Mod(modid = FrameMod.modid, version = FrameMod.version) public class FrameMod { public static final String modid = "FrameMod"; public static final String version = "1.0 ALPHA"; EventHandler events = new EventHandler(); @SidedProxy(clientSide = "com.czaarek99.FrameMod.ClientProxy",serverSide = "com.czaarek99.FrameMod.ServerProxy") public static ServerProxy proxy; @Mod.EventHandler public void PreLoad(FMLPreInitializationEvent event){ proxy.registerRenderThings(); FMLCommonHandler.instance().bus().register(events); MinecraftForge.EVENT_BUS.register(events); } } ClientProxy package com.czaarek99.FrameMod; /** * Created by Czarek on 2014-08-09. */ public class ClientProxy { public void registerRenderThings() { } } ServerProxy package com.czaarek99.FrameMod; /** * Created by Czarek on 2014-08-09. */ public class ServerProxy { public void registerRenderThings() { } }
×
×
  • Create New...

Important Information

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