Jump to content

Toma™

Members
  • Posts

    80
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Toma™

  1. So in the end I went with the TEISR. However I have some problems now. The item is rendering properly, but I sometimes move the model and it moves it in the GUI and that is another problem because I would like to keep the json item model for the gui. How would I do that? I am not sure, if I should post some code, since it won't propably help. But anyway, there are some bits of the code: My baked model: The teisr class: and the bake method:
  2. Okay so based on my quick look into the intro for animations you sent here it looks like I will have to go with the JSON models since they're getting the biggest support by most forge features. I'll propably start making some test models and see how it all goes.
  3. Well I would like to possibly add more parts like magazines and use them for animation for reloading. I have 3 different magazine atachments so I would need to create the animation for every single of them. I don't need dynamic textures, I just need dynamic model rendering based on NBT as explained above. I wasn't really thinking about shaders and I think I'll leave that alone. Well if it would be possible (and I know it is) I would like to implement some sort of rendering the arm based on the weapons current state (like reloading to move the hand with the clip etc). Also possibly render the hand holding weapons grip when atached. I know this is not easy, but as soon as I start understanding it atleast a bit I should be able to do more stuff. I would like to have few animations like reloading and most importantly ADS mode so the shooting can feel more "realistic" rather than just holding your weapon on right side of the screen. And yes, I have magazines which as explained above should move when reloading. I don't there's need to not render them at all, even when the weapon is empty it should be rendered. I haven't started models yet, since I'm trying to get the best way to do it.
  4. I know about that, but I think I didn't provide enough information on misunderstood you somewhere. So I will repeat everything here: 1) Using the JSON system will allow me to change the model dynamically based on it's NBT (I have made inventory for ataching atachments to weapons so I would like to render the atachment based on the NBT - so will the JSON model allow me to do that?) 2) I would like to implement something like ADS mode for aiming. With some scope atachments I simply render overlay over player screen, but when weapon doesn't have scope I would like to be able to move the model in front of player view to simulate the ADS (possibly in render tick event using some GL methods, I'm not sure if that is the correct way) 3) Would it be possible to scale the model in something like render tick event (since I will propably have to do model of some size and then scale it up - I know JSON has function for scaling but if I would need to scale it even more would it allow me to use the GL scale method)? I'm confused with this rendering so thanks everybody for helping me
  5. Well I'm bit confused with the JSON system, specially with rendering another models into it. For the model base renderer it looks a little easier (i was looking into some of the flans mod model code). I know there is system similar to blockstate system which is used for the bow, but I'm bit confused with it's usage. Because bow has like 3 states and every state has it's texture. So if I have 5 atachment types + some variants for each of them would I have to write every single combination for the item state or is there easier way? I still have feeling modelbase would be easier, but I'm not really experienced.
  6. I have been thinking about few things recently and I would like to know something before I start working. Using IBakedModel for rendering will still allow me to do dynamic rendering (like rendering additional models on my base model based on NBT) and other stuff like animations? Also is using ModelBase bad idea, since I don't really like just scaling the .json model because I think I will want more details and it might be a lot of work to make it properly in smaller scale. So I'm just making sure I don't need the TEISR.
  7. I want to create weapon with better details so default scale function is not enough for me. Also I was looking when vanilla uses the TEISR and that's for the shield based on it's NBT. I want to do something like that (render atachments on the weapon based on NBT). I have the NBT working, I'm just looking for the rendering. From what I have found the .json is limited to 3x3 block size and becausd of that I think I'll need to use ModelBase
  8. I have few questions about ModelBase rendering (I'm looking for few hints to point me to right direction): 1. How to tell the game to register the model (from my research there was method in ForgeClient class to register item renderer, but now I can't find it) 2. Based on Forge docs there is TEISR which I have atached to the items I want to on client side. Now I need baked model to use the isBuiltInRenderer method. So from my understanding I would need 3 classes for each item (base class, renderer and model), I guess. I would like to use the ModelBase models since the .json is limited in the size so then I think I can't use the item blockstates.
  9. So now, if I understand it correctly, I need to move everything into the scheduled task.
  10. Okay I have reworked it a bit (based on the forge example). Is it good now? The code: It seems to be working, but I'm not sure, but thank you both for your help
  11. The packet for shooting: https://github.com/Toma1O6/PUBGMC-2.0/blob/master/java/com/toma/pubgmc/common/network/server/PacketShoot.java
  12. My minecraft does "randomly" crash when I start shooting with one weapon with small firerate, however this happens quite randomly and sometimes it's working fine for a long time and then suddenly crash. So there's some of the code: BulletEntity GunCode Shooting code for Single firemode Shooting code for Automatic firemode Entity is registered in my main class under FMLInit event using the registerModEntityMethod (I also tried to play a bit with the tracking range and update frequency since the crash was saying something about it) Crash report: I hope I didn't mess some basic stuff again somewhere
  13. Okay, since I haven't seen anywhere exact solution for this I will write my solution I have found here just in case someone has the same problem. OnUsingTick as it has been explained above and in the other threads is quite bad for doing this NBT related stuff, but you can subscribe to the ClientTickEvent and detect from here using the Minecraft GameSettings if your key (keyBindingAttack/UseItem - for different mouse buttons) is being held and run the code from here. But keep in mind you will have to sync some stuff with server in order to work properly. I'm not saying that this is how it should be done, this is just how it works fine for me.
  14. Ok, I have been thinking about this and I think the easiest way to render my overlay as close as possible to the default HUD would be to calculate the position based on MC pos. I would need to find the class where minecraft does that. Tbh I didn't do much research about it, but I think the rendering code will be maybe hardcoded in some class with a lot of code so my question is: Do you know where minecraft does the HUD rendering code? If so, what's the class name?
  15. Hello I have created some overlays which I would like to have fixed in some x and y coords. I tried it with ScaledResolution but since your minecraft window resolution may change when you switch to fullscreen etc, the overlay is offset a bit. I think there's something simple I have missed, so I am asking for help. Is there some way to lock my overlay to hotbar for example? There is what I have tried so far: Rendering Method which is doing all the position stuff Only problem I have with this is the offset in fullscreen
  16. Oh well, I didn't know that. For some reason I thought that the ctx.side.isClient will prevent that But this still has to be used to copy the data when player switches dimensions, am I right?
  17. Okay I changed it as you suggested. However now I have to worry about the issue I described above.
  18. Okay, it's me again with another problem. I implemented my custom capability and attached it to player, but every time the player respawns, it should write some data into capability, however it doesn't work. I made custom overlay rendering which should display the data, but on respawn I see the data set to the value I want and next tick the data is gone. I managed to make the data persist after player disconnects so my syncing packet should be okay. The only problem I have is the respawn event. I subscribed to PlayerEvent.Clone (on server, since I think it is supposed to be handled from server, but I'm not sure about that) and registered it in server proxy. There's the related code: and the packet just in case: (it is registered for client side) What am I doing wrong here?
  19. Okay, thanks for your time, I see I have lot of pretty stupid code here. One last question regarding setting the teisr. When or where am I supposed to set it?
  20. Okay so I have reworked it a bit the teisr is now at the item, however nothing is rendering except my normal item model. I'm pretty sure that is because the ItemOverrideList is empty. I created my own model class which extends the Shield model and implements the baked model. I'm new to all this stuff so I might be making some terrible mistake somewhere... So there's the updated code: The item class: The model class: And also you wanted the registry code (I don't know if I need to rewrite it, but most likely I will have to since a lot of the code is old and I was following some registry tutorials for this)
  21. I want to use the TileEntityItemStackRenderer for my weapons to use java models etc so I decided to go through the Forge docs. I'm confused a bit by it because I tried to follow it but I can't understand few things: 1) Is my implementation correct? (Atleast a bit?) 2) Do I need to implement the baked model on the item as I do or different way? 3) From my understanding I don't need anything else than setTileEntityItemStackRenderer, isBuiltinRenderer and getOverrides methods? There is what I have tried for now: Also I decided to use the vanilla shield model for it now since I don't have the model yet. The TEISR class is copied from vanilla. The code doesn't crash or anything like that, it doesn't do anything at all. Maybe that's because the ItemOverrideList is null.
  22. Hello, I have tried creating guns with different firemodes, but I have noticed some problems: 1) For Single firemode I have to right click the weapon twice for it to shoot (So far it looks like problem with maxItemUseDuration + onUsingTick methods) 2) For Auto firemode as soon as I start shooting I can't stop it until I switch the items in hands The code for the methods is here: (Also it might be a bit messy since I was trying to quickly fix it) The rest of the class is here just in case: I have also noticed that the onUsingTick method is sometimes called more than once on each side, so that might be a problem too I've tried looking into ItemBow class, but that didn't tell me much since it's using only onStoppedUsing method
  23. Alright, I'll try to change some stuff you suggested me above and build the mod and try it. Thanks for your time and help
×
×
  • Create New...

Important Information

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