Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. Bro, do you even Bauble? In about 30sec i found this API and interface to do that. public interface IBauble { ... /** * This method is called when the bauble is unequipped by a player */ public void onUnequipped(ItemStack itemstack, EntityLivingBase player); ... } If this documentation/API is working then this should do the trick (implement this interface in your Item.class). If not, then you would have to track it yourself. Question is - Are you using your own inventory or vanilla one? (Because there are few ways of handling those.)
  2. There are few sub-questions for your "performance" question. HDD Memory: I wouldn't even care about it. ;p Even if you would have server running for years on which there would be even 100000 of those ItemStacks, each even with 10 Tags, it's all compressed to byte sizes. Tops few MB for very big variety of NBTs in a lot of ItemStacks. RAM Memory: Any ItemStack loaded by MC is held in RAM. Yet - it's still few MB tops. I wouldn't really care about it. Bandwidth: Only thing that could be annoying. UNTIL you are only saving ints, doubles, booleans and floats it's again - safe. Having 100 players that would simultaneously request form server a chest full of custom ItemStacks with NBTs would get you 2700 ItemStacks? That's nothing if they are holding only Tags listed above. This is a quite extreme situation ofc. Problem appears when you would store Strings in NBT. Lately I tried to store textures inside NBT using String. It was working for 16x16, quite well for 32x32, anything above would generate lags. But you know - those are HUGE values compared to simple generic type Tags. Finally: 1. You couldn't care less about saving NBT in this case (I mean, how many of those items will there be...) 2. You could say nope to most of those, why would you save pitch or yaw? Most important is x,y,z and worldUUID/name/id (UUID is safest BUT takes some space).
  3. From wiki: "As of June 25, 2014, (...) over 15 million copies on PC have been sold." You do realise that EVEN if that would be possible (it ain't) the total weight of all nicks would be easily more than 0.5GB. What you can is to generate array of Strings corresponding to all users that ever logged on particular (your) server. Last option would be writing totally new program and send about 977 septilion (977 480 813 971 145 474 830 595 007) http-requests to mojang servers that would confirm if given user name exists. And that is considering small/big letters and numbers in nick with max 15 chars. <joke alert> http://d3dsacqprgcsqh.cloudfront.net/photo/aOqggDN_460sa_v1.gif[/img] And finally - maybe I don't understand what you wanna do, because your english is not yet mastered - please correct me and your post if I am wrong.
  4. Hello, I've been working on my API for quite some time and I thought - why not make forge events for more user-friendly environment (till now I've been using abstract base class in which you can override and add your stuff). I tried to follow event (EntitLivingBase - which later I want to extend with e.g EventSkillCast, etc.) system by call hierarchy but that didn't end well. It's all mixup of compiled and decopiled classes stitched together by EventBus, ForgeHooks and other weird stuff. Question is - is making new event as easy as registering it via EventBus, making its call-code in right place and then just adding @SubscribeEvent? Or maybe are those coded deeply inside forge code that can't be accesed from outside? Just to be on safe side - we are talking about totally new events created by forge mod. Quick edit: From what I'm seeing now is that @SubscribeEvent is being searched for on mod registration, so I guess registering new event would not be possible by mod itself, but still - maybe somehow? for (Method method : target.getClass().getMethods()) { for (Class<?> cls : supers) { try { Method real = cls.getDeclaredMethod(method.getName(), method.getParameterTypes()); if (real.isAnnotationPresent(SubscribeEvent.class)) ...
  5. I'll just start from what I learned over years with MC code: Minecraft is not designed to work smoothly. It has no easing functions, no movement predictions, really nothing to fix visual bugs. This means that anything that could be lagging between server and client will be visible (quite well). Where can we spot those? Press 'B' + 'F3' to see all Entities bounding box (ingame). Any bounding box that is in touch with ground might be glitching (just a little). Now back to your vehicle - I don't really see anything wrong inside this code. Yet again - normal boat can glitch like that too, so this might be: http://www.forbbodiesonly.com/moparforum/attachment.php?attachmentid=111454&d=1365473434 <clap if you get the reference> Anyway - making your entity a LivingEntityBase (which would also make it a living thing with health etc.) might just fix your problems. I rly don't know why but never seen mobs lagging like rest of "dead" entities, despite fact they are both extending Entity.class Last thing - bigger model, more you see. (I bet that until seeing it on B+F3, you didn't see EntityItem glitching - just throw it on the ground). EDIT: Question - how big is this glitch compared to e.g EntityItem?
  6. Two-step collision process and 6 entityies connected to EntityPlayer seemed to be good idea until I logged in with 2 players on dev. server. Done this: Making entity act exacly as other entity (e.g EntityPlayerHand follow hand rotation of EntityPlayer) not only looks bad, but is totally buggy. So this "idea" is closed until MC devs. rewrite most of game engine. P.S.: I was trying use easing functions that would move all 6 body parts. MC is just not designed for this.
  7. Scaling, coloring, rotation - it's all OpenGL. Here you go example code: GL11.glPushMatrix(); //Start new matrix GL11.glScalef(0.5F, 0.5F, 0.5F); //scale it to 0.5 size on each side. Must be float e.g.: 2.0F fr.drawStringWithShadow("SOME STRING", width, height, 0xFFFFFF); //fr - fontRenderer GL11.glPopMatrix(); //End this matrix
  8. The most disturbing thing in this thread is: "after I finally found a forge source version which hasn't run into any error messages right from the start" I really hope, that by this you mean you found this link www.minecraftforge.net/forum/index.php?action=files and downloaded source. Follow this tutorial (if you haven't found it yet) http://www.minecraftforge.net/forum/index.php?topic=14048.0 If you setup your workspace properly then: "even the simplest bits of code seem to change in every tiny minor release" Sadly yes. I've been with MC since alpha, modding from Beta 1.6+ and it's kinda pain in the ass. When created, Minecraft had not just few, but a lot of badly written classes and it's being replaced by better ones since (mostly), well, the "big update" (1.7). After 1.7 most of updating to new version isn't really that hard. Sometimes there might be some bigger changes (like now with 1.8 ) but from my exp i know that rewriting/fixing what's alredy done can't take more than 5% of your total work over mod (well, this depends). "referenced Minecraft code is all obfuscated" Again - if you setup your workspace properly there should be file in Referenced Libraries (eclipse): forgeSrc-version.jar Most of important (usable) code IS deobf, and what is not is probably stuff that is just not used in modding (internal methods and game engines). "If you look for something on google you have to hope that your problem is adressed in the right version on any forums" Forge Forums (here) is probably your best shot Always up to date with very nice ppl. "How do you manage... (...)" Now I really think you set your workspace not quite well. If not, then I really can't refere to your situation, everything is clear and easy for me. MC/Forge updates don't change THAT much. Hope it helped. If you have any questions (best tutorials, etc.) please ask.
  9. This is more of a debate. Considering that EntityPlayer is probably everywhere in code, how hard would it be to convert it to MutiPart object (you know - like dragon)? And by that I mean - player's body has 2 legs, 2 arms, torso and head. Obviously new renderer would be needed, but how about implementing whole part-build. Reason: http://d24w6bsrhbeh9d.cloudfront.net/photo/adNbrdZ_460sa.gif But seriously, thats would be awesome to have critical hits formed not by random but by players accuracy. Next step is ofc converting armour system, but that is quite easy if you ask me. Anyone would like to work on this maybe? As some separate mod-API. Idea I: If editing EntityPlayer itself is ridiculus (which it is) I was thinking - maybe to leave it be, cancel players renderer, set collision box to -> 0 and then using events spawn 6 body parts around this EntityPlayer "dot" in world that would move and act based on what this EntityPlayer does (we have motion, rotation, literally everything). Applying damage would be quite like normal Entity (body parts are EntityLivingBase) that would transfer damage to EntityPlayer they belong to with some changes (like head = x2 dmg). The question is - can something go wrong here? I have bad experience when it comes to coordinate glitching (like jumping/lagged entities) and i am worried that this might cause my MultiPart to fall apart
  10. [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.net.ConnectException: Connection timed out: connect [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.net.AbstractPlainSocketImpl.connect(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.net.PlainSocketImpl.connect(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.net.SocksSocketImpl.connect(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.net.Socket.connect(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.net.Socket.connect(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.NetworkClient.doConnect(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.http.HttpClient.openServer(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.http.HttpClient.openServer(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.http.HttpClient.<init>(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.http.HttpClient.New(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.http.HttpClient.New(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.security.AccessController.doPrivileged(Native Method) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.security.AccessController.doPrivileged(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.protocol.http.HttpURLConnection.access$200(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.security.AccessController.doPrivileged(Native Method) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.security.AccessController.doPrivileged(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.net.URL.openStream(Unknown Source) [18:13:42] [Forge Version Check/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraftforge.common.ForgeVersion$1.run(ForgeVersion.java:90) When launching Server in Eclipse, this pops after: [18:13:24] [server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Done (0,935s)! For help, type "help" or "?" It appeared just today in my dev env., now - I know what that is, but I have no idea why it exist. I am not having ANY problems with connections (but this ofc.) I literally did nothing, it just appeared (same code, same everything). My guess would be some VersionCheck in forge, but I just can't get over it without knowing why ;p So annoying
  11. Yup, got few method calls back and got this: net.minecraft.server.management.ServerConfigurationManager.initializeConnectionToPlayer Final Edit: [sOLVED] From 1st post (edited): //EDIT - LoggedIn is really called before Update BUT, if you place something too heavy there (like I did - reading json, it will have race condition with UpdateEvent, and therefore UpdateEvent might crash if it's using data that should be loaded with LoggedIn and there are no null checks and stuff.
  12. It would be shame to rewrite everything when it's alredy there, so I'll just leave link - probably one of best tuts on this. http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-1-7-2-1-6-4-eventhandler-and
  13. 1. How many dimensions can one add to minecraft? From: package net.minecraftforge.common.DimensionManager private static Hashtable<Integer, Integer> dimensions = new Hashtable<Integer, Integer>(); So the answer is - a reasonable amount of dimensions. 2. Is there a limit? http://d3dsacqprgcsqh.cloudfront.net/photo/a8WR5MY_460sa_v1.gif 3. Is there a point where too many can become an issue? Read 1 - "reasonable amount". So probably 100 won't be a problem. 4. Is it possible to make a world cap in your dimensions? If you mean trimming - then yes. BUT I would rather go with events on that - consider using PlayerEvent to keep player inside given boundaries. And if you are asking about making an "edge of the world" where if player comes he will just fall to void - then You will have to use some Chunk event (there is one in which you could set world beyond some x/y to always be 0 (air). There might be better one, but ths would work too @SubscribeEvent public void populateChunk(PopulateChunkEvent.Pre event) 5. I need to create 100 different and separate world types. http://img-9gag-lol.9cache.com/photo/aPy7mwn_460sa_v1.gif
  14. Lately I've been having fun in this field and after debugging for some time it occured to me that those 2 events have race conditions are missleading. net.minecraftforge.event.entity.player.PlayerEvent.LivingUpdateEvent is being registered by MinecraftForge.EVENT_BUS.register(); package cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent is being registered by FMLCommonHandler.instance().bus().register(); I know those 2 BUSes (FML and Forge) are totally different, but it just doesn't seem right that EntityUpdateEvent occurs before Entity has even appeared in the world been confirmed logged in. Even more weird is the fact that those both SEEM to be SERVER side, so its not like Client is doing something here. //EDIT - LoggedIn is really called before Update BUT, if you place something too heavy there (like I did - reading json, it will have race condition with UpdateEvent, and therefore UpdateEvent might crash if it's using data that should be loaded with LoggedIn and there are no null checks and stuff. Last but not least - the fact that this is totally random (one time the first will go off 1st, other the 2nd) makes this a race condition (or something near it, whatever). Question: Is it possible that someone missed this fact and it's a bug? Could not be a bug. Whats the point of PlayerLoggedInEvent if it might pawn whole loading method when used alongside UpdateEvents? (I mean there is a point, but it can cause crashes) Is there maybe some sub-event that will work like I want (LoggedIn -> Update)? (If not, I'll have to add bool mappings for players and check if they are after "LoggedIn" event)
  15. Why do you have your own "PlayerMap"? private static Map<UUID, ExtendedPlayer> playerMap = new WeakHashMap<UUID, ExtendedPlayer>(); EP object holds mod's virtually loaded data. The data itself has a very nice manager that only loads necessary parts (e.g player LevelHistory would be loaded only if you would like to reconstruct player, and would presist just for time to: Convert history to actual final product (adding-up all level changes into one final PlayerStats object), call SyncManager that will sent new PlayerStats to everyPlayer that needs them to be updated). Anyway - it's all fancy stuff from my API. Why do you have your own files that you save to? I am using .json and in future will be using json -> mySQL converting (which will not be in minecarft, but as a other program running on dedic server that will translate changes in .json and put them in SQL. So again - When you logout from dedicated server, it's all being nicely disposed from both Client and Server, but when on SP, I guess I'll have to do it with World unload event (thanks shieldbug1) + if(client). Was Trying FML event that occurs when virtual server is shut down but game crashes with preinit (something with registration). And last but not least - I don't like IEEP and my own handling took me few hours to write and has much better memory/data handling (for this particular API). Oh and ofc. solution:
  16. Spawned block should be a TileEntity with tick iterator in update method. 20 tick = sec. You should also save previous block (before became TileEntity) and after reaching some tick value it would call method that would set block to old (saved) one. There are a lot of good examples for TE (google), but if you really want to learn it's full potential I'd go through code (e.g Furnace). Also - don't forget to save data in NBT, so after unloading world progress is saved.
  17. Anyone? If something is not clear please ask. To reassure - PlayerLoggedOutEvent is NOT launched when you quit Singleplayer world, but ONLY by dedicated server (server.jar). I need similar event that will launch on SP.
  18. While PlayerEvent.PlayerLoggedInEvent registered with: FMLCommonHandler.instance().bus().register(new EventPlayerLoad()); works just fine on both SP and MP when you/someone logs in, the PlayerEvent.PlayerLoggedOutEvent is never launched when on SP. It is only called on dedicated server when someone logs out. My mod needs to make a setNull to few layers in my own playerMap for GC to collect them, if I won't do it, the data for player with given UUID will still exist even if I create a totally new SP world, and will likely copy from my world1/playerdata/player.mod to world2/playerdata/player.mod after first autoSave. If PlayerLoggedOutEvent works only for MP servers, that will give me at least half of results, now - how do I make that happen on SP?
  19. Hey, How would I go with installation of Forge without Forge Installer? In past you would get "-universal" and unzip it into minecraft.jar Library handling and launching will be handled by my code, I just want to know how can I make working minecarft-forge.jar Thanks.
  20. You guys are the best Thanks for pointing out existance of Pre and Post events in decoration - wasn't aware of them, and those (diesieben07's) I'll use. Will have to make some tests with Cauldron and how well that works with other mods, but It should be cool.
  21. public IIcon getIcon(ItemStack itemstack, int pass) Is a method called by renderers that update equipped items. You have to use this: public IIcon getIconIndex(ItemStack itemstack)
  22. Hello, What I want is quite simple - tell world generator to replace every stone with something else in all biomes. Result should look like this: all stone generated by world is mystone and when you craft stone in furnace it will be vanillastone. Is there any global field with ID of "basic-block" which I can override (with reflection or whatever)? And note for "other ways": No, I can't use events to do what I want (unless there is some world-gen even that would allow me to replace all stone during generaton - please say which) and no I don't want to replace stone with myblock inside registry array.
  23. To complete previous (coolAlias) post: You will have to register A LOT of events regarding damaging player by any kind of damage types. Since vanilla health is a public float - why would you totally remove it? If you want player to have more HP you can easily do that (in current Minecraft it's even possible without mod - I mean in Bukkit). Your whole regeneration system could be implemented by events too. If you want to override for e.g Golden Apple buff, you can do that too, same goes for potions. Edit: Fixed my mistake with int/float. (misspelling)
  24. What about the second part: "Someone told me that ItemStack NBT is sent to player once per his session, and ONLY updated when the server will detect any change it it's NBT - is this true? (because I really hope so)." Everytime I make request for some NBT data I call something from data I've alredy got on my client's "virtuall" data or I redownload it from multiplayer server? And ofc. thanks for response Oh and why is this so important: Let's say I have 100 players that stand in one place in which there are 1000 items (MyItem.class) on floor/in their hands. Since every itemstack's renderer calls for 3x NBT String fields ("hand_txt", "body_txt" and "blade_txt") on every tick that makes: 20(tick)*100*1000*StringSize (wchich is around 10-20bytes), and that can be equal up to dozens of MB. If that kind of data would be sent from server in one second it would cause total connection crash. And yes - I am reading source myself (right now), just thought you might know some of this stuff alredy.
  25. If that's any help - I just remembered that Balkon's Weapon Mod has weapon with extended reach. Author doesn't provide source but you can always use jd-gui. I read some of his obfuscated source and he's somehow using events to extend reach for items that use Interface of ExtendedWeapon. It's a bad habit to look into code of someone who doesn't make it opensource but you can always use some of it to learn. Just saying
×
×
  • Create New...

Important Information

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