-
Posts
2638 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Ernio
-
You should provide full code. As to problem - you need to make sure client and server movement are equal. Most likely they are not, thus lagging. Can't really say more without code. EDIT Btw. why not look at vanilla's rideable?
-
Buttons (Gui) are client-side only. Aside from that fact - you shouldn't give players ability to change stuff on client. Aside from that, if feature is for creative mode only - you don't need to worry about anything since creative player is allowed (by vanilla itself) to change ItemStacks (updates don't go server->client, but are bipolar). So after thinking about the design, now how to actually code gui: Consider updating to at least 1.7.10 as I don't know if 1.7.2 has methods/classes I'm gonna mention. First of all, look into vanilla or forge's option menu - talking about controls. If you wan't to know how stuff works or code more flexible stuff - look into GuiScrollingList or GuiListExtended. All that should be put into GuiScreen. And as I always tell - Gui is something that can't have tutorial for all cases. Vanillas code and time are your allies. Why not update?
-
Note that movements for player are different than other entities - while entites are moved by server, the player is moved on client, the server only checks if the movement made by given client is acceptable (not too fast, not through wall like ghose blocks, etc.). You will have to operate mostly on client here.
-
Are you considering using speedPotion effect? That would be like really easy: player.addPotionEffect(potion effect). If you are looking for hardcoding way, you will need packets.
-
Hmm, thread might have been prematurely created. Anyway, for those interested: .json allows your item to have maximum 5 layers, from 0 to 4. Layer 'n' can't exist without layer 'n-1' - so you cant have layer1 without 0. Doing so will break all layers. (no texture). TintIndex in BakedQuad is the renderPass corresponding to layerX used in .json to generate quad of model. There is no easy way of altering colorizing process aside from coloring quads on your own in ISmartModel. As to overkill ways - I extended BakedQuad with LayerBakedQuad and added setTintIndex() to set renderPass to whatever I want, without having the layer in .json. The LayerBakedQuad are being created the moment of model creation and replaces all normal BakedQuads, tintIndexes are now not from 0-4 but in 0, 100, 200, 300, 400, which allows me to put any other values between them to add special coloring phase in final model put together from those parts. Total overkill but works and is "smart". Oh, and results:
-
There are cases: - You launch game, client loads block's properties from client's config. - You login on server (doesn't matter if SP/MP) - Server send you new properties. - You log out of server and login on other server: 1. Next server is Vanilla: - You need to bring back vanilla client configuration (or any other setup you wish to have), in order to do that I told you to use ClientConnectedToServerEvent since server won't call LoggedIn (It's vanilla after all). - The values must be stored somewhere, that's why you need to cache them. When loading client's config whenever you do setBlockHardness (for example) you will also have to put vanilla hardness to some map. - Then when connecting, you will restore that map with ClientConnectedToServerEvent. 2. Next server is Forge: - You don't need to restore anything since server will send you values after all. Now where problem might appear is when your client has hanged more values than server will send new ones (so some of old values will not be changed). - Again - you need to restore defaults (vanilla or whatever, like in 1. above). Notice that client's ClientConnectedToServerEvent is fired BEFORE server's logged in, so actually both 1 and 2 will come together to one solution: You will be always setting defaults 1st, and then if the server would be forge - you will get new ones. EDIT Sry, I didn't answered last question, but only way i know works for server only.
-
What? You setup your own .bats? http://www.minecraftforge.net/forum/index.php/topic,14048.0.html# Should help.
-
Okay, some know that I am putting together model-to-render from few other models. 1. You craft 4 items which hold color in their NBT. 2. You use those 4 items to craft whole "thing". 3. The whole "thing" holds NBT of what from it was put together (obviously), so it also has colors. 4. The colorizing happens after returning model - so after my ISmartModel returns proper quads of those 4 parts. That left me with 2 options: colorize inside ISmartModel - which would be dumb, too much to cache and too big headache. So then I noticed that getColorFromItemStack has int renderPass. Investigating lead me to belive that the "tintIndex" inside BakedQuad is the integer corresponding to renderPass. Basically - would be my desing be "smart": I assume that "layerX" (X = number) is the tintIndex of texture in item.json - is this true? I would make each part have some tintIndex (part 1 has layer1, part 2 - layer2, etc). And then apply colorizing on proper BakedQuads returned from part's model. Is item allowed to have e.g layer55 but not have any layer before (0-54 in this case)? Will those indexes be used somewhere in future?
-
Logged in and out are called only on server, the client won't get any packet after logging out. You shouldn't have problems here tho. No matter if you join SP or MP, the server will still send you new values and update values from previous setting. Problem might only occur if you'd try to login on server that doesn't have mod you have on your client. The workaround is like you told yourself - before setting new values, save old ones somewhere and restore them after. EDIT Problem actually is the fact that - I could swear there was event like that - I can't find client's event ClientConnectedToServer - or something like that. You need to restore defaults (previous values) before receiving new ones from forge server, or not recieving any from vanilla server (because forge can connect to vanilla). EDIT 2 There it is! ClientConnectedToServerEvent In net.minecraftforge.fml.common.network.FMLNetworkEvent Hidden as fk.
-
@coolAlias Are you sure you know about IPerspectiveAwareModel? I mean, I did most of rotations there, so just saying it might be useful. Btw. you sure getGeneralQuads() isn't mutable? (Totally wild guess, I know that if you manipulate BakedQuads they will change forevah for given model).
-
You do realize that WholeTreeAxe is for both 1.7.10 and 1.8? Just download it, decompile and look at code.
-
[SOLVED][1.8] Syncing config files across server and client?
Ernio replied to Apace's topic in Modder Support
Short: There is no workaround, your thinking is good. http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-x-1-8-customizing-packet-handling-with Nice and tidy: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html Important info: http://greyminecraftcoder.blogspot.com.au/2015/01/thread-safety-with-network-messages.html Longer: You will need to set client's hardness from packet after logging on (PlayerLoggedInEvent). After sending that info you can cache it in client's config. -
Well, vanilla doesn't allow you to have left hand - never. So I am getting conflicted ideas from you. Do you want to have sword in right and shield in left hand when blocking, or do you want to render shield instead of sword when blocking with sword? That wa my question previously. What I described earlier was a very sophisticated way of making what you wanna have. But I guess that could be too hard
-
There is a reason why there are no tutorials for advanced stuff. To code something like that you would need extensive knowledge about Forge and many parts of the Minecraft itself. Goal: make player have equippable shield that will appear when "blocking" with sword. 1. IExtendedEntityProperties (IEEP) to save data. 2. IInventory implementation to save inventory. 3. Container/Gui/GuiHandler to display shield slot. 4. SimpleNetworkWrapper and packeting to synchronize clients. 5. RenderPlayerEvent to render shield. 6. ItemRendering and Models (strong dependence to MC version) - loading models and rendering them. 7. Extensive knowledge about making Items and using their methods. Basically what you are after: Make IInventory which will be saved in IEEP. In that IInventory you will be able to place shield. Use Container to open inv on server, Gui on client, GuiHandler as "bridge". Use RenderPlayerEvent - you will need to load shield model and render it. In order to move/rotate player's left arm you will ned to cancel rendering of player and render it on your own from begining, changing arms in process. To do that - in RenderPlayerEvent you could check if player is blocking - i BELIVE there is method/boolean for that in 1.7.10, if not: use PlayerUseItemEvent and save boolean in IEEP that will tell you if player is currently "shielding". In the second case (there is no boolean in vanilla side) - you will need to synchronize everything on your own - you can utilize PlayerEvent.StartTracking and EntityTracker to do that, or simply apply dataWatcher to player with boolean. If the player is blocking, you can check wether he has shield equipped (in your inventory) - if so you can get it's model and render it. I will say it again - this is not basic, not simple, not even intermidiate modding. This shit is advanced - if you want to code it well (because nothing is advanced if you don't code it well). Your are better off with experimenting with those 7 things I wrote - know how they work and when/how to use them. It takes time to start using different tools to create one thing. EDIT There is no player.isBlocking (note that names are examples), BUT there is 'private ItemStack itemInUse;' (at least on 1.. You can use that. if (player.itemInUse.getItem() instanceof ItemSword) -> that means that you must be blocking (I mean, i think - blocking = using sword, so basically this should work). Vanilla would handle shynchronization for you (because that's vanilla's field).
-
Depending what is your goal - do you want to make that instead of sword, there will be shield - bacause that is relatively easy. Other option would be to make shield render in left hand when clicking with sword. That is like whole different level of coding. WHOLE. DIFFERENT. LEVEL. (Packets, ExtendedProperties, PlayerRenderer, a lot of data exchange and tracking).
-
1.7.10 How would I save an arraylist of tile entities to NBT?
Ernio replied to TheRealMcrafter's topic in Modder Support
Yes and No, you redesigned wheel. Example: NBTTagCompound mainNBT = new NBTTagCompound(); //pareent nbt NBTTagList history = new NBTTagList(); // the list NBTTagCompound level; //tag in list on "i" index for (int lvl = 0; lvl <= this.getLevel(); ++lvl) { level = new NBTTagCompound(); // each "i" index has one NBT level.setString("A", a); // write whatever you want in given NBT index history.appendTag(level); // apend index to list } mainNBT.setTag("History", history); // write list to main NBT The NBTTagList ships its size. Reading: NBTTagList history = stats.getTagList("History", 10); NBTTagCompound level; for (int lvl = 0; lvl < history.tagCount(); ++lvl) { level = (NBTTagCompound) history.getCompoundTagAt(lvl); ... EDIT Personal note: If your whole array will look like this: x1, y1, z1, x2, y2, z2, x3, y3, z3, .... then you know that i*1 is x, i*2 is y, i*3 is z (for i >= 1). You can use "NBTTagIntArray" - will be a bit smaller and faster, but whatever, reading/writing is done once in a while so you might aswell not bother. -
Access another mods api from a CustomForgeMod
Ernio replied to longlostbro's topic in Modder Support
I've never used WE for forge, but if there is an API - it should be compiled for developers. In your eclipse - simply go to project props and link new library - your API. Launching game will also launch this API (since it's dependency lib) - so no, don't place it in /mods/. Compiled API are just .classes - you will also need API source to be linked to API's library - go to libsa and attach source (.zip file), source for API should be shipped with API. Idk, each author has own ways. -
[1.7.10] When running on dedicated server I get no such method error
Ernio replied to Thornack's topic in Modder Support
Thorny - I alredy told you, comparing even 10000 UUIDs is NOTHING if done per-call. Computers are capable of computing shitload of data, don't worry about something like this. As to better solutions - I've also alredy told you - only way to do it faster is to make smart caching of direct entity references. Again there is no point. Best thing to do is simpl cut down everything irrelevant. Pseudo: optional: check smart cache - one I mentioned, first see if you can grab entity on instant, if not, go further. for loop on world.entities if (entity instanceof YourEntity) // checking instanceof is like x+y, cmon man! now you compare UUIDs -
Both LivingHurtEvent adn LivingAttackEvent ship DamageSource with them. You can check if source is related to entity and then e.g know that Zombie hit you. Difference between events: One is called after applying attack (hurt). Second fires the moment entity "hits" target, so before everything (knockback, potion checks, everything).
-
EDIT I realized that having textures won't really help, what I really need is to simulate .json file to generate a model for some texture. E.g: Instead of having 1.json, 2.json, 3.json and 1.png, 2.png, 3.png, I just want to have those 3 .pngs and then in code load them, and bake model for them (like normal .json would do). Then I want to use those models in my SmartModel.
-
[1.7.10] [Solved] Get where the player is looking as a ForgeDirection?
Ernio replied to a topic in Modder Support
In 1.8 it is in GuiOverlayDebug. In 1.7.10 I think it was inside GuiIngame. Somewhere in middle of class there is method to draw debug. Use eclipse search tools bruh -
I just realized that those formats are converted floats. Damn, that method (yours TGG) was useful, I actually shifted quads, now it's a matter of time till I write nice utility which will do that for me. Thanks, hopefully it will be just matter of time EDIT Jesus christ, I thought (past) that every "pixel" (the minecraft square) was a quad... no wonder nothing worked. This format is actually pretty neat RESULTS Yes, guard and pommel are thicker.
-
[1.7.10] [Solved] Get where the player is looking as a ForgeDirection?
Ernio replied to a topic in Modder Support
Well, if need a simple "compass" direction, then look at Debug screen. There is not much to say here, debug does literally same thing to check direction you are looking at (F3). Note that in 1.8, ForgeDirection is replaced (build 1296 I think) by EnumFacing (same shit, different name). EDIT Since idk how it looks in 1.7.10, here is 1.8 code: public EnumFacing getHorizontalFacing() { return EnumFacing.getHorizontal(MathHelper.floor_double((double)(this.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3); } "this" is the EntityPlayer, if you don't have method like that in 1.7.10, then use something like above (or find it elsewhere). -
Might be/not right place, but I am coding similar thing right now, so some questions might overlap. My Item's SmartModel is putting together new model from other SmartModels which get their model from NBT. Like a structure building up from parts. Now the problem is that the transformation, doesn't matter if vanilla json's or forge's hook ForgeHooksClient#handleCameraTransforms happens only AFTER you are done creating model and start rendering it. Basically - no matter what I do the partial models will be always the same and only the final model (the one which is created by putting together quads) will call for transformations, which will accordingly happen on all sub-parts (models). Is there a way of performing transformations directly on model parts' BakedQuads - the moment when the model is being constructed? If there is no util/hook for that - I would have to directly manipulate BakedQuads - how do I do that? BakedQuad vertex format is like magic to me (some int[28] from what I've seen) how to read it?