Jump to content

EverythingGames

Forge Modder
  • Posts

    388
  • Joined

  • Last visited

Everything posted by EverythingGames

  1. Thanks for the reply, haven't had much support for rendering. It's not that simple - I used to do I that way but I am using complex (multi-part) .JSON models and baking a smart / perspective model during the ModelBakeEvent. I don't need to switch between models using the getModel() method, I need to modify its texture specifically at runtime. What I am trying to do is UV the model texture to the player skin correctly and then bind the skin texture to the model (the player object is null when baking the models , so I cannot bind the player skin). An idea would be to set NBT to an existing item an if the nbt boolean is true, create a new model with the texture (done at runtime). Please feel free to give me suggestions - any help is still appreciated!
  2. Hi, I need to be able to grab my model's texture during runtime (specifically after the player object is created in the world) and be able to replace it. Keep in mind I am using ISmartItemModel as well as IPerspectiveAwareModel, if that helps with the effort any. Basically, can you even change a model's texture? If so, is it possible at runtime? Any help is greatly appreciated. Note: I know of this method found in the IBakedModel class as well as its subclasses that might be useful: @Override public TextureAtlasSprite getTexture() { return SOMEMODEL.getTexture(); }
  3. Hi, to create your ISmartItemModel, implement it where it is needed. To add it to the model registry (in ModelBakeEvent), define your modelresourcelocation in a field use it to create an object in your ModelBakeEvent. Check the instance of the object to IBakedModel and create a cast IBakedModel to the object. Create a new YourSmartItemModelClass object (the class created implementing ISmartItemModel) and then use the putObject() method to add the smartitemmodel object you just created. Sorry if my explanation was rubbish, here's a snippet of code that might help you out: ModelBakeClass: public void onEvent(ModelBakeEvent event) { Object object = event.modelRegistry.getObject(YOURMODELRESOURCELOCATION); if(object instanceof IBakedModel) { IBakedModel bakedmodel = (IBakedModel) object; YourSmartItemModelClass smartmodel = new YourSmartItemModelClass(bakedmodel); event.modelRegistry.putObject(YOURMODELRESOURCELOCATION, smartmodel); } }
  4. The forge build 11.14.3.1502 has in the changelog that in an earlier build this issue was fixed. It seems to fix it for the most part, but it still does move my item's .JSON transforms and rotations, just a little less than it used to. Is my code incorrect, meaning is there a way to properly grab these item transforms so that the fix would work? Thanks.
  5. My apologies. Forgot to read the changelog this time, looks like they have a fix, but I'm yet to try it out. Topic locked.
  6. Hi, using ForgeHooksClient to return a Matrix4f, it gives me the wrong matrix (I already checked it beforehand). I'm trying to return a Matrix4f for a model's transforms using ForgeHooksClient#getMatrix(). I know that the matrix is incorrect due to the fact that it messes up the model's transformation / rotation completely. Does anyone know why this is? Thanks. Note: In the below code, "modelOne" is the IBakedModel being referenced. Also, the code was taken out of the IPerspectiveAwareModel#handlePerspective method. ForgeHooksClient.getMatrix(this.modelOne.getItemCameraTransforms().firstPerson)
  7. I'm not home right now, when I am I'll try it out, I have a working model wrapper prototype/ test.
  8. Just make your .JSON as normal, you only need one cuboid for an arm. If you can't figure it, use MrCrayfish's .JSON model creator or BDCraftCubik. I recommend MrCrayFish's, really simple and you can make complex stuff. www.mrcrayfish.com
  9. Couldn't you just create a smart block model and draw baked quads on top and bind textures to those?
  10. Hi, the vanilla dimensions for the biped arm are 4x12x4, XYZ. You can do the very same thing in .JSON, same exact dimensions. Even if it is to big in-game, you can always do translations, rotations, and scalings in the .JSON model itself. As for binding the texture, you need to first have a "dummy / test" skin to correctly UV onto the model in the .JSON code - that is really simple. I personally do not know how to bind the texture of the player's skin into a model since the model's texture is defined within itself. Also, another problem would be that the player instance would not be created / would be null during the call to bind te texture. If you could find a way to bind the texture when joining the world by somehow saving it, then applying it, that would fix the problem. Maybe TheGreyGhost could possibly post here with some help.
  11. Hi, I suggest a much more better way, using NBT of course. In the stack's NBT, set a long containing the getTotalWorldTime() and add the time in ticks you want in cooldown. Then, check if the total world time is greater than the long you just saved - If I is, the cooldown has passed. Set the long again whenever you need to - this way, you don't have to use any onUpdate method / ticker. The reason why we use the total world time instead of the current world time is because the current world is dynamic, meanin it can change when setting the time to day / night, ruining / breaking the cooldown completely.
  12. Basically, getGeneralQuads() returns the list of desired model quads - I don't see the need to create them manually unless your doing something tedious. Rather, I would create the two models I want, position the first .JSON model in-game, then the second over top of it in place - should be very easy. For baking your models, don't perform that yourself, subscribe to the ModelBakeEvent and add your IBakedModels to the ModelRegistry and then put the wrapped model object (implementing ISmartIteModel, for ex.) in the registry replacing the old .JSON model. If you setup your wrapper class to hold final instance fields initialized in the construction of the object, you can pass whatever models you like to be combined when instantiating a new wrapper object (if you have the wrapper class setup correctly to do that, of course). Hope that helps a bit!
  13. Hi, you can use the tile entity's NBT to switch different models in ISmartBlockModel. Just register different ModelResourceLocations on the ModelBakeEvent.
  14. How would I make the IPAM class's handlePerspective() call the IBakedModel and retrieve the item transforms from it? Thanks again.
  15. Hi, when rendering blocks, always be sure you have a proper block model (used to render the block on the ground and in hand), item model (used to render in the GUI), and a blockstate file (used to render the block based on different blockstates. Make sure all your .JSON code is correct as @Draco18s was hinting at, as well as all your textures being in the correct spot and correctly reffered to in your .JSON files.
  16. Hi, getting the correct / exact item model to be the same as the block, you may want to implement ISmartItemModel and bake the correct ModelResourceLocation using the #inventory to specify the item. It should be a pretty easy fix, however you choose to accomplish it.
  17. @OP Please learn the proper language. You've already PM'd me for help saying you didn't know the Java language - even if you say you only know the basics, that's only going to allow you to understand basic code - not all of Minecraft / Forge code is basic. When you have a better understanding, we can better help you.
  18. Well, if it were me, I'd render the different models using ISmartItemModel. There is a method that is called when the item is being rendered in the world - handleItemState(ItemStack itemStack) - you can use this to return different models based on itemstack info such as NBT, stack size, etc. Use te ModelBakeEvent to use ISmartItemModel to wrap ModResourceLocations. Take a look at MinecraftByExample by TGG as well as some other posts on the Forge Forum here on ISmartItemModel. I particularly have a post as well as some others.
  19. By default, blocks drop themselves when mined. Hunt around in the Block class and find the method that drops the item when mines - override it and return your item there.
  20. You null check the itemstack not the item.
  21. Hi, maybe you forgot the .JSON for your block model or you forgot your blockstate .JSON.
  22. Hi, look at the BlockSlab class. If you don't want a double slab and just want a smaller block, change the block's bounding box to half its size.
  23. Hi, the matrices (Item rotations / translations) in my IPerspectiveAwareModel are messed up within the method below. ForgeHooksClient is causing the problem. Any help is greatly appreciated, thanks. public Pair<IBakedModel, Matrix4f> handlePerspective(TransformType transform) { switch(transform) { case FIRST_PERSON : return Pair.of(this, ForgeHooksClient.getMatrix(this.model.getItemCameraTransforms().firstPerson)); //Switch other types of transforms; above is the cause and an example of the problem } }
  24. Good job getting it working...as for te quote saying we expect people to know a good amount of Minecraft modding, rather it should say, "we expect you to know a good amount of Java."
  25. Casting the int to the Math surrounded in parenthesis was what I forgot to add in my earlier post. Simple mistake on my part.
×
×
  • Create New...

Important Information

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