Jump to content

EverythingGames

Forge Modder
  • Posts

    388
  • Joined

  • Last visited

Everything posted by EverythingGames

  1. Usually the contents of the backpack are stored in the itemstack's NBT data, storing it in the player would mean that every backpack would have the same items, and taking an item from one bag will take it from another - vice versa with putting in items.
  2. Usually, you would fool around in the .JSON file until its correct (the rotation attribute in third person - found in the .JSON). That takes to much time and is nothing but trial and error. Use this tool, provided by TheGreyGhost, to actively transform your items in-game: http://www.planetminecraft.com/mod/item-transform-helper---interactively-rotate-scale-translate/
  3. It is not that simple. If it were, it'd already be solved. I have tried returning a different model based on perspective - that didn't work. I also tried returning the texture model's baked quads when the camera transform = GUI. It looked like it kind of worked, though the transform matrices were messed up due to the huge problem of each model having to use the super model's transform matrices. Also, may I ask what the getTexture() method is for in IBakedModel and it's subclasses? It seems to do nothing when returning different models' textures. Anyway, if you can use IPerspectiveAwareModel to do this, how so? Where would you return this model, it's baked quads, or it's texture? Again, thanks for any help in advance. Here is the current code that returns the super model and the super model's transform matrices: @Override public Pair<IBakedModel, Matrix4f> handlePerspective(TransformType transformType) { this.transformType = transformType; switch(transformType) { case FIRST_PERSON : RenderItem.applyVanillaTransform(super.getItemCameraTransforms().firstPerson); break; case THIRD_PERSON : RenderItem.applyVanillaTransform(super.getItemCameraTransforms().thirdPerson); break; case GUI : RenderItem.applyVanillaTransform(super.getItemCameraTransforms().gui); break; case HEAD : RenderItem.applyVanillaTransform(super.getItemCameraTransforms().head); break; default : break; } return Pair.of(this, null); }
  4. Hi, I am having a problem with being able to have a 3D rendered model when the item is equipped, while also being able to have a default texture for the model in the GUI. I have tried using IPerspectiveAwareModel to do this by checking if the camera transform is equal to the GUI - if that is true I then return the baked quads for the texture (built-in/generated model) in getGeneralQuads(). Isn't there a better way for achieving a 3D model when equipped, and a regular texture for the GUI? Any help is appreciated!
  5. You would use this, I believe: new ResourceLocation(Main.ID + ":" + "textures/gui/texture.png");
  6. To be honest, I would just keep adding spaces to make the individual words move "all in one piece", but that is time consuming and inefficient. You need to get the width of the GUI and the width / length of the string being drawn. Test if the length of the string drawn plus the previous drawn string lengths (the length of the words and spaces before it on the same line) is greater than the GUI width - if not, draw it - else, move it to the next line. That is a basic idea of what you've got to do - hope that helps you out.
  7. Why would you use an API for this simple task? This is why we have Forge Events - I did this in a couple of minutes. As mentioned a numerous amount of times, use GuiScreenEvent, check the GUI being rendered, cancel it, finally render your own. @OP That's all that can be said, any other form of help would be coding it for you. You will need to learn events and how to create a simple GUI.
  8. After a bit more searching, I came across this field, which you can modify using reflection. Field SwingProgressInt - Found in net.minecraft.entity.EntityLivingBase //Change this to your needed speed - be sure to pay attention to the methods regarding this field below public int swingProgressInt;
  9. Use your IDE. In Eclipse, I found a couple pieces of code relating specifically to this. 1.) The Potion Effect Declaration - This is found in net.minecraft.potion.Potion //Potion effect is declared below public static final Potion digSpeed = (new Potion(3, new ResourceLocation("haste"), false, 14270531)).setPotionName("potion.digSpeed").setIconIndex(2, 0).setEffectiveness(1.5D); 2.) The Swing Animation Speed - This is found in net.minecraft.entity.EntityLivingBase //Modify the below method /** * Returns an integer indicating the end point of the swing animation, used by {@link #swingProgress} to provide a * progress indicator. Takes dig speed enchantments into account. */ private int getArmSwingAnimationEnd() { return this.isPotionActive(Potion.digSpeed) ? 6 - (1 + this.getActivePotionEffect(Potion.digSpeed).getAmplifier()) * 1 : (this.isPotionActive(Potion.digSlowdown) ? 6 + (1 + this.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) * 2 : 6); } Looking at the above modified code found in the paths provided, the first example declares the effect. The second example is what you want to look at, as it returns an integer pertaining to the end of the "swing animation".
  10. Do you mean scale them down as in scaling the whole model down smaller? Or are you meaning you want an individual piece of your model to be scaled down? To scale down your entire model just use GL11 - keep in mind that the model scales down towards the middle, meaning your mob will scale away from the ground making your mob to appear like its floating. If you want to scale down a piece of your model, just change the piece's bounding box, reposition it and its rotation point, and finally UV the texture to its correct location. Hope that helps you out a bit.
  11. The potion effect Haste speeds up the animation for hitting, though it also does for block breaking. Try taking a look at it to see how you can achieve the same effect - remember to consider the speeding-up of block breaking.
  12. Hi, AbstractClientPlayer as well as NetworkPlayerInfo contain information regarding the player skin. Forge really has no direct support for this other than creating your own player model via cancelling the old model using the RenderPlayerEvent. Reflection and / or ASM will probably be needed to change only the skin and not the whole model.
  13. Hi, there is a much better way to do this, but this is merely a suggestion - try looking into ISmartBlockModel and return various .JSON models for the block. Hope that gives you an idea. Someone might have a better suggestion, though.
  14. Also, with IItemRenderer before, the models could have independent transforms using a bit of GL11 work. Hope the new interfaces can recreate something like that.
  15. I know what you mean about rendering - not my preferred modding subject! This is a must-have feature for my mod, I've already made a suggestion for an interface doing exactly what I need (it's actually a very useful suggestion, IMO), though I can't depend on it being added. Back when IItemRenderer was implemented, the way it was done was to create Java models (the arm) and then another Java model (gun) - you would then render them together in first person, and the gun by itself in every other perspective including entity item. Even with the benefits of the new model system, implementing many interfaces and modifying the code just reduces readability, especially when RainWarrior marks everything as deprecated (saying to use the new IFlexibleBaledModel to replace deprecated IBakedModel, but IFlexibleBakedModel is a child class of IBakedModel ). Anyway, this is going to be hard, hopefully I can make it happen!
  16. That is correct to a certain extent. IPerspectiveAwareModel only allows you to change the model based on first person, third person, gui, and head. The only way you can modify the entity item model is if you listen for when the player drops and picks up the item via events, where you then set NBT there, and then check the NBT in ISmartItemModel and return a different IBakedModel there based on the NBT. So no, you actually have to use events, ItemStack NBT, and ISmartItemModel. I don't see IPerspectiveAwareModel doing anything there. I actually had to do this because I needed to change the model as soon as I dropped it on the ground and picked it back up. That's the case that you would need this for, it'd make code a lot cleaner and would reintroduce a feature from IItemRenderer. To be honest, I don't see why EntityItem isn't a transform type (that would be better than the new interface, IEntityItemModel) is. That should be added so that you can return a model beforehand just like with first person, third, etc. As for the second interface suggestion, I think that would be a great feature. Again, more features and capabilities to make an easier, more complex model.
  17. Hi, the title describes the basic idea of adding more interfaces to the new rendering system. As of now, we have: 1.) ISmartItemModel - Customizes the model based on the ItemStack's NBT 2.) IPerspectiveAwareModel - Customizes the model based on the camera transform 3.) IFlexibleBakedModel - Customizes the model based on the returned VertexFormat New suggested interfaces would be (Names are somewhat accurate to their description and are made up): 1.) IEntityItemModel - An interface allowing the entityitem's model to be changed 2.) ICombinedItemModel - An interface allowing the flexibility of being able to easily combine two models together, allowing both of them to use their own independent transform values / matricies (translation, rotation, scale). As with suggesting something, there must be a reason for these suggestions: IEntityItemModel 1.) Before IItemRenderer was removed, modders were able to render their items in different perspectives - including the entity item. This isn't possible with the new rendering system as of now. ICombinedItemModel 2.) When trying to render two models together while returning a list of BakedQuads, the models rendered both get the same transform values (transformation, rotation, and scale). Think of the new models that could arise from being able to combine multiple models together into one, while each of them still being able to use their own independent transform values (again, transformation, rotation, and scale) provided by their .JSON's. This would help resourcepack authors, as well as mod developers, tremendously. Additional Benefits From Suggestion: Another thing to consider is that people would be finished with using IItemRenderer in 1.7.10, be more eager to adapt to the new modeling system, and would stop addressing to bring IItemRenderer back - considering these interfaces would allow mod developers to do anything they once did with IItermRenderer with additional, helpful features, while also including the resourcepack authors. Hopefully these new interfaces suggested can be implemented, considering their wide array of possibilities. Thanks for taking the time to read my suggestion!
  18. Those are good suggestions, but I think they won't work. First, RenderPlayerEvent and RenderHandEvent might as well be the same, canceling the RenderHandEvent de-renders the whole player model completely, and the first person arm is still there - same with the RenderPlayerEvent. I have tried this before, and the problems that arose were: 1.) The rendered arm needs to only be rendered in first person. 2.) The rendered arm doesn't rotate along with the player - it stays in the exact same place. 3.) How would the equip animation play when switching items for the arm? I.E. the arm rising up and down while switching items 4.) How to know when to render said arm So as you can see, there would be many, many problems when rendering a "generic model" arm separate from an item. This is why IItemRenderer needs to come back - maybe they could improve it by letting models written in code be combined with .JSON models (yes, this isn't the suggestion board ) Anyway, would you happen to know a way to render a java model (models just like from Techne) with a regular .JSON together? Thanks, and I am happy to hear all comments and suggestions!
  19. Thanks, @coolAlias. The reason for using IPerspectiveAwareModel is because I am rendering / de-rendering models based on first / third person / gui / head and not altering they're transform values. When combining the two models, the new transform is added to the new wrapped model (contains the two IBakedModels). For future reference, the first model is a gun and the second is an arm, the arm only renders in first person. The arm and gun have seperate transforms that need to stay when combined - IPerspectiveAwareModel makes the arm model use the gun model's transforms. Wouldn't it make sense to be able to keep independent transforms when combining general baked quads (combining models)? Anyway, I really need a fix! I am missing IItemrenderer already!
  20. After fixing an issue in my models, another one arose. I have an IPerspectiveAwareModel containing two IBakedModels, and combining them by returning a list of both the models' quads in one. My problem is that I need to combine the two models, with the first model to have its own transform (rotation, translation, scale), as well as the second model to have its own transform (rotation, translation, scale). Basically, I want two models combined in one with both of them using their own independent transform values. I really hope this is possible, otherwise my models are toast and its back to square one! Anyway, I really appreciate any help or responses, thanks! Current Code (Taken from IPerspectiveAwareModel combining two IBakedModels) @Override public ItemCameraTransforms getItemCameraTransforms() { return this.bakedmodelone.getItemCameraTransforms(); //Only uses the first model's transform values (problem) - this method forces you to provide only one transform value for the combined model as a whole. } @Override public Pair<IBakedModel, Matrix4f> handlePerspective(TransformType transformtype) { this.transformtype = transformtype; switch(transformtype) { case FIRST_PERSON : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().firstPerson); break; } case THIRD_PERSON : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().thirdPerson); break; } case GUI : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().gui); break; } case HEAD : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().head); break; } default : break; } return Pair.of(this, null); } As a side note, I realize that the above method "getItemCameraTransforms()" requires you to return transformation values for the model as a whole. Remember, I want the model to be combined as a whole, but still be able to have the two combined models use their own independent transform values. Hope that makes a little sense.
  21. Literally a few minutes after posting that I realized just what to do! I got it working right (your earlier suggestion played a major role) - I appreciate your time @coolAlias! Here's the code for anyone needing it: @Override public Pair<IBakedModel, Matrix4f> handlePerspective(TransformType transformType) { switch(transformType) { case FIRST_PERSON : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().firstPerson); break; } case THIRD_PERSON : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().thirdPerson); break; } case GUI : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().gui); break; } case HEAD : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().head); break; } default : break; } return Pair.of(this, null); } I realized that the matrix can be null and that returning new added matricies for every transform was a really bad idea! Anyway, that a step closer. Again, thanks!
  22. Remember, particle effects are client side, so you should probably spawn them on the client.
  23. Thanks again for the reply, @coolAlias. Here is a run-down of what I need to do and why I need to do it, while also explaining my problem further: Problem: At first, my item has a 3D .JSON model, just like any normal item would - nothing special. This model has various rotations, translations, and scale added to it just like you would do in any .JSON model to get it to look correct in-game - still nothing special. I then want to wrap the model using IPerspectiveAwareModel, using the code provided above - no crashes, everything runs fine. When I look at the item in-game, the model looks nothing like it did before I wrapped it with IPerspectiveAwareModel - it has new, crazy rotations and translations added to it. The problem lies within IPerspectiveAwareModel - somehow it is messing up the item transforms / rotations. What I Need To Possibly Do: Remember, I am not using IPerspectiveAwareModel to add more translations / rotations. I want to be able to use it while still having my model look EXACTLY the same as it was before I used IPerspectiveAwareModel. Have you used this interface for your models (I am basing my question off of earlier topics by you)? If so, how did you work this problem out? I really appreciate your help and anyone's help on this problem!
  24. Thanks so much for the reply, @coolAlias, it makes total sense to me. I don't need to add any transforms, I just wanna use the same transforms provided in the .JSON model itself - I am using IPerspectiveAwareModel to return different collections of BakedQuads(using the transformType parameter). I tried to use the suggestion that you provided along with returning the Pair, but no luck - the model is messed up even more. Here is my code: @Override public Pair<IBakedModel, Matrix4f> handlePerspective(TransformType transformType) { final Matrix4f firstperson = ForgeHooksClient.getMatrix(this.getItemCameraTransforms().firstPerson); final Matrix4f thirdperson = ForgeHooksClient.getMatrix(this.getItemCameraTransforms().thirdPerson); final Matrix4f gui = ForgeHooksClient.getMatrix(this.getItemCameraTransforms().gui); final Matrix4f head = ForgeHooksClient.getMatrix(this.getItemCameraTransforms().head); switch(transformType) { case FIRST_PERSON : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().firstPerson); return Pair.of(this, firstperson); } case THIRD_PERSON : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().thirdPerson); return Pair.of(this, thirdperson); } case GUI : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().gui); return Pair.of(this, gui); } case HEAD : { RenderItem.applyVanillaTransform(this.getItemCameraTransforms().head); return Pair.of(this, head); } default : return null; } } Hopefully, you can point out what I did wrong there. As for using ForgeHooksClient to get the matrix from the transform vector, it seems to be working better than using TRSRTransformation to get the matrix. Anyway, this is a large part of the last part of my mod, I'd really appreciate it if you could help me further to get this thing going!
  25. Hi, I've used this interface in the past - it only destroys my model's appearance (screws up the transforms for first person, third person, gui, etc.). The question is very simple - how do I use this interface properly? The method found in it called "handlePerspective" is what I specifically need help on. I understand that I won't get much support because - it's a question that's been asked for a while by myself and not many people have any experience with these new rendering classes. Anyway, this is really the last part of my mod that's been in development for a very long time. If anyone could help me out, I'd be so very grateful!
×
×
  • Create New...

Important Information

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