Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. Here we go! Note: If any of you has something that you can honestly recommend on dynamic compilation - feel free to post. Right now I got some googles, slowly molding the idea of my quest here.
  2. isRemote - client logical side !isRemote - server side
  3. Parsing is goddamn slow, I need fast computation from String, like pre-prepared calculator. Draco - this is what I don't really feel like doing Is there some library for such stuff? Must be (looking), maybe someone used such? EDIT And by fast I mean FPS-time (suitable to be ran per-tick or even render loop)
  4. I am looking for either lib or idea how to. I want to have formula for parameters like MaxHealth or other stats like Critical% be saved inside config. I've alredy everything done to manipulate anything I want, now I need formula. Simplified example: Map<String, Integer> attributes; // map holding attributes of entity //let's say there are those keys/values inside that map: S, 100 A, 44 K, 90 public int getValueOf(Key key) { // Here I want to get formula loaded by config that for this "key"will be for example: "(S+A)*K" and I want this method to return right value. } Now - I am not stupid - it's very easy to write something like that using shitload of if-s and whatever else, but that all would operate on Strings and have significantly longer computation time than normal "return (S+A)*K" coded in Java. I guess my question is - does anyone know a tool (if that is even possible) that would allow me to create (on config load) virtual method computing my value and give me near-JVM-standard computing time? I hope it's clear what I am looking for.
  5. Super old tut. SimpleNetworkWrapper is what you are looking for. http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-x-1-8-customizing-packet-handling-with or short: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html
  6. MC version is important here Lots of stuff is documented here: http://greyminecraftcoder.blogspot.co.at/p/list-of-topics.html http://www.minecraftforge.net/forum/index.php/topic,26267.0.html EDIT More direct info here: https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe21_tileentityspecialrenderer TESR is your friend.
  7. http://img-9gag-lol.9cache.com/photo/ae3D71B_460sa_v1.gif[/img] YEAAAAAH. I am so ducking dumb For 2 hours I've been seeking what was the problem, turns out that while I was having fun in Gui class I must have accidentally pasted "GL11.glScissor(0, 0, 1000, 1000);" into my GuiHelper method that handled the rendering used in rendering I was trying to scissor - therefore always setting it to values mentioned. How did this happen .___.
  8. I think I just entered brothel... Nothing works as you would expect it to do. drawScreen() method (somewhere) GL11.glEnable(GL11.GL_SCISSOR_TEST); if (yElementOffset <= this.bottom && yElementOffset + var13 >= this.top) { this.drawSlot(elementIndex, yElementOffset, var13, mouseX, mouseY, tess); } GL11.glDisable(GL11.GL_SCISSOR_TEST); Why the heck when I don't do "GL11.glScissor(x, y, w, h);", but JUST add enable/disable - my gui is cut? When I add "GL11.glScissor(x, y, w, h);" with all possible values - nothing changes (still cut in same fixed place). And why is it even cut? EDIT I am trying everything I can find - this shit won't even move, still this stupid border (picture). EDIT 2 I've done SAME thing in totally different GUI. Without even using glScissor (just enabling/disabling) causes GL to cut whole rendered image in EXACLY same place as on screen (relatively - on both guis, I always end up with this cut-line)
  9. Yes, yes, no (dont request things from client). You might be interested in this thread: http://www.minecraftforge.net/forum/index.php/topic,30025 If you can code, everything is pretty much there, if you have questions - ask. Also - there are other ways like DataWatchers - which I personally never use (I have my own watchers), so it might be possible to add new DW to vanilla entity - that I don't know. And as to versions - in 1.7.x everything is pretty much the same, only difference is netty threads (which were introduced in 1.8 ), other than that - maybe few method namings.
  10. I shall read about it, but may I ask - how painful is it and why? Any bugs may occur? EDIT (I'll report with results) Diesieben - bro, u everywhere: From: http://www.minecraftforge.net/forum/index.php?topic=19948.0 To: https://github.com/diesieben07/SevenCommons/blob/master/src/main/java/de/take_weiland/mods/commons/client/ScrollPane.java#L67
  11. Many of you have probably used ScrollingList or some other Gui list like GuiListExtended. The list is designed to show all visible elements, not show what is outside, and what is partially outside - simply cut (overlap) with border. (This black thing is border, i just made it transparent, normally below that is re-drawn background image that overlaps part of element under) So now - I was like "Why not simply cut that shit out?!" - The design described above cant be used in many cases - e/g - what if I want to put my list onto GUI that is rendered NOT from top to bottom (like a container) and my elements are larger than size of list (height) itself? Not possible using what vanilla/forge gives. Are there tools that would allow to cut out rendered things between some moments in rendering? Basically - to archieve desired effect - would I literally have to go to the very first render and apply border and tell it to not render more than that border - in that case, goodbye FontRenderer and probably everything... Ideas? Other question: Has anyone ever seen (in mod) a scrolling list put in some container (not on whole screen height) that would not have this problem (elements scrolling out)? EDIT Ideally i am look for something that would allow me to cut pixels from current rendering, but leaving ones from previous layer.
  12. Client only has objects of loaded entities. End of story. Only way to achieve this would be to hack EntityTracker (server stuff that handles sending data about entites to given client) to add Entites that should not be loaded by given client. I do not recommend it as when I personally tried to do so - it is breaking almost everything - you have to add, handle and remove manually and make sure vanilla won't suddenly remove it for you. My experience with it says simple "NO". What can be done (a trick) is to create client sided (@SideOnly(Side.CLIENT)) HashMap that would contain custom virtual storage. e.g: "FakePlayerData.class" that would have double x/y/z and any other values. That map you can hold either only for your client (inside client proxy) or inside IExtendedEntityProperties - recommended if you also want to know about paries that you personally don't belong to (so HashMap per-player). Syncing would be totally up to you. Notes about @SideOnly - when using it on fields, the filed CANNOT be initialized in class, it has to be pure: @SideOnly(Side.CLIENT) double lastKnownPosX; And updated only later. Why? JVM will try to init it on server or whatever - you can't do that.
  13. I can't tell if what you are doing is bad or just coding style, but know one thing: When your throwable hits something you still have entity (not yet dead). There is no need to use mop.getBlockPos() to get the x/y/z of hit, you can simply use: this.posX, this.posY, this.posZ That is probably your NPE, blockPos is only when thrown entity hits actual block, for entity it's different. Following code: onImpact() is called on both server and client. if (mop.entityHit != null) { // Do stuff on entity, use its x/y/z or the direct x/y/z of throwable to make "explosions" in place hit, not the center of entity. } else // It's block. EDIT: The point is - you can't have both blockPos and Entity - mop is either one or the other. I am basing this on code: if (entity != null) // Entity is the one found by mop inside onUpdate() { movingobjectposition = new MovingObjectPosition(entity); // the original mop is overriden with one with entity in constructor } This is the mop with entity child-constructor - it has NO BlockPos. public MovingObjectPosition(Entity p_i45482_1_, Vec3 p_i45482_2_) { this.typeOfHit = MovingObjectPosition.MovingObjectType.ENTITY; this.entityHit = p_i45482_1_; this.hitVec = p_i45482_2_; } I don't know for sure, but code suggest that BlockPos is null when you hit entity
  14. Probably client/server synchro/siding. Show superclass.
  15. Might help: http://greyminecraftcoder.blogspot.com.au/2014/12/transparent-blocks-18.html (isOpaqueCube)
  16. In my mind operating on UUIDs was alway near to String stuff, which as you might know are not very efficient to be don in tick-time and per-entity. That is the reason I suggested storing direct link to owner entity. As to better ways: Assuming that your entity is COMMON (somewhere around squids number) you could use PlayerLoggedInEvent to fire update check on all loaded entities that are instance of YourEntity. Just saying - saves a lot of UUID ops. Post what you got (entity).
  17. If you think you read enough, look at this: List<IResourcePack> defaultResourcePacks = ObfuscationReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks", "field_110449_ao"); Example of usage reflection in MC. And yeah - use ObfRefHelper to make it work after compiling, you need to find correct obfuscated field for one you want to access. Next post will probably tell you where to look for them, as I don't remember now.
  18. Uhm guys, you know that UUID works only on server right? Putting UUID into DataWatcher is simply wrong. What is needed to be understood is the fact that both SERVER and CLIENT might NOT have the EntityPlayer owner constructed. That is when you use virtual (fake) links like UUID or even direct names. There are many ways of handling this, depending on what data about owneryou need, how fast and where (client or server), you might even need more than two fields. I will try to describe design: EntityPlayer owner; // Which will be direct reference to owner on both server and client. String ownerUUID; // Which is used when link between owner and tamed entity can't be found - e.g owner is offline (there is no EntityPlayer owner). String ownerName; // This exists for client display purposes. Now what should be saved? NBT is server sided, inside saveNBT you need to save UUID of owner and ownerName field, why you will learn later. There are few scenarios: Both owner and tamed entity can be loaded by world, so ideally in that case you can get UUID directly from owner.getUUID() Say that owner is logged out, but entity was loaded by world - well, then - you have your ownerUUID field, you save that. In any case - you always save this ownerName field. Inside loadNBT, you will be loading ownerName and the UUID. Now what happens, as ststed before - entity might be loaded with owner online or not. When owner is in world: - You load UUID, read world#getPlayerEntityByUUID(uuid) and set EntityPlayer owner field. - You also want to keep UUID loaded - you set ownerUUID field to one loaded. - Now, since you have direct link to player, you can do owner.getDisplayName() and set ownerName field to it. When owner is not in world - you can't load entity that is NOT there: - In that case, you load both UUID and ownerName. - Now, you don't have EntityPlayer, but you still was able to get the name of player (last name that he logged in on server, which might have changed since, that's why I noted that this is for display purposes). What should be shared between client and server? As stated before - UUID are ONLY server side, on client - they won't work. Ideally you need to send owner.getEntityId() and then on client, load that uwing world#getEntityFromId() (might be different name). Those IDs are shared between server and client and are only link between entities that you can make. Now the problem is that, while the SERVER might have owner's entity constructed, CLIENT might not (out of visible range). That is why you also want to be sharing ownerName field. So in the end you will always have owners name on all clients, even if that owner is logged out or out of range. Note that this name is ONLY for DISPLAYING purposes - e.g a TAG above head, or value in GUI. Few last words: This design is somewhat caching technique, whenever you can - you use EntityPlayer, when you can't you use UUID, when there is no Entity with present UUID, you reference the name directly. Obviously, you might not need EntityPlayer owner, you can always get him directly (on server) from UUID, but I am optimalization-hype guy, why would you want to search by UUID if you can do that much faster (in my case I am using owner per-tick, so that was understandable). Ideally - this system does not use DataWatchers, but direct dynamic packet-updates based on EntityTracker and StartTrackingEvent, if you would use DataWatchers then you totally don't need EntityPlayer field as it is stored as entityId inside watcher (but, is slower). This is not by any means "you have to do it" but rather different angle at coding styles, understand the system and you will be able to code anything. EDIT And yeah - go read Tameable code, you might be also interested in EntityThrowable which uses direct naming (like in design above).
  19. Hey m8, I have totally random question for you. You cound say I am kinda over-observant, but noticed that everytime you do "thank you" (on post), there are "2 members gave you thank you!" One is you, second is " ". Do you have 2 accs, someone else is thanking (strange), or there is a bug, or whetever else? Just, weird I need to know! (dammit my brainz)
  20. From my utils: public static File getMcDir() { if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDedicatedServer()) { return new File("."); } return Minecraft.getMinecraft().mcDataDir; } For client it will give you the .minecraft directory (the main folder), for server it will return location in which you ran your server.jar
  21. Sbeagin - you might know Java, but in this case you wrote something that is not even remotely correct for Minecraft/Forge coding. Never, ever, forever you should declare ANY fields inside Item that are not shared between all Items. Item is merely an instance of something that represents item, ItemStack is the actual "thing" that you hold, and only ItemStack can hold data (NBT).
  22. Yes, you would. In every onUpdate() you will first get NBT integer, if found you increment it and save back to NBT, if not found, you make new one, increment and save it back. That's it. You get -> increment -> save. NBT is nothing but just a big-ass map. Note that even if that is not very bad design, there are still better ones (more efficient), but require a lot more coding.
  23. Umm, post code please? You make KeyBinding, you use InputEvent.KeyInputEvent and check if keyBinding.isPressed(), then you make if statement in which you check if player is riding (you can do this client-side). Depending on what you need you might have to use packets.
  24. Names of files are important too. Name of block points at EXACLY same name in blockstates folder. Blockstate has variants that points out to model/s which then use textures. MODID has to be LOWERCASE, "ancients".
  25. Wait what? Either i didnt understand what you ment or you just did something entirely not good. You do realize there is ONE Renderer for ALL Entities, don't you? Changing one field will cause all entities to change their renderings (especially when it's static). It was alredy noted out that you should save variable inside ENTITY and load other model using that variable, not anything inside renderer itself. Disclaimer - unless I didn't understand Then you are cool. Edit Also, unless you change the model field with every start of render method, that is cool too, I guess.
×
×
  • Create New...

Important Information

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