Jump to content

Bedrock_Miner

Forge Modder
  • Posts

    613
  • Joined

  • Last visited

Everything posted by Bedrock_Miner

  1. Heyho Guys! I need a few tips on rendering. I have several things I want to do and I want to know whether there is an easy solution to them, possibly a single method that I can call. Optionally also a self written method... [*]Rendering a texture in a solidified way (like an Item) [*]Rendering an IBakedModel [*]Like 1, but with the enchantment effect on the texture. Also: overlaying a drawn face with the enchantment glint [*]Rendering an .obj file [*]Rendering an Item or Block like they are shown in a GUI (2D) but solidified (like 1). Not sure if this is even possible I hope, some of you have got an idea how to do some of the things above! -BM
  2. Ok, so the ICustomModelLoader looks pretty nice. I see what I can do with it. My problem is not the changing texture, I have done this already. My problem is that the normal bow rendering behaviour includes a movement backwards and a scaling effect. But these are optimated for a draw duration of 20 ticks. However, my bow should have 10 ticks, so I need to change the behaviour somehow.
  3. Thanks a lot! This would indeed make things a lot easier
  4. Well, with this method I can get the image's position on the icon map, but I wanted to get the image's position based on the model file. Or, an even better method would be a method to just render the model with texture and everything... I discovered, that there is the interface ICustomModelLoader which could be a good thing, because it obviously can replace the default model object with a custom one, but I cannot get it to work... Does anyone here know how I can bring this to work? Maybe I should tell you what I actually want to do: I want to create a custom bow (already done). This bow should be pulled in 0.5 seconds instead of 1 (done as well). The problem: The vanilla bow behaviour is copied for my bow: If the bow is fully drawn, it still moves back until a vanilla bow would be drawn as well... I had this problem back in 1.7.10 already, but there I was able to use the IItemRenderer to apply some reverse transformations. This lead to a giant amount of cryptical code (see below ) but it worked... Now, I don't have the IItemRenderer anymore, so I need to find another way of doing this. I was pretty glad when I found the method with the builtin/entity renderer for Items and I think that's the only way to add actually real code into the rendering procedure. What I want to do now is to use the Item model to render the bow item with the transformation needed, but therefore I need to get the texture (or a method to directly render the model). It was much easier with the IItemRenderer.... Especially because IItemRenderer already had the correct transformations for an item, not for a block. Maybe, however, Forge could add some events to intercept the rendering execution at some point. It would be so great if you could simply start rendering without caring for any transformations first, like for the TileEntities in Item state. EDIT: And even more problems: I just discovered that the block rendered with my TileEntity thingy does not have the correct destruction particles. Instead the missingtexture particles are used.. I have NO idea how to fix this, as I have no model file for the block.. (special renderer, you remember )
  5. Heyho, it's me again! I have a new small problem: I tried to make my Item-TileEntity renderer accept the texture given in the model file. The file should look like this: { "parent":"builtin/entity", "textures": { "layer0":"modid:anytexture" //Or any other texture name (for instance "all") } } The next thing I want is retrieving the texture in my rendering code. I can get the model using IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(stack); But I don't know how to get the textures by name. The normal method getTexture() (which returns only one texture for some reason) doesn't work anyway, because the model is an instance of BuiltInModel, which overrides most of the methods to return null. Does anyone have any idea how I can use the textures I defined in the file in my rendering code? ...I just need to get the resource location of the images by their names
  6. I worked a bit on the problem with the rendering state and I found a solution: I created a class which analyzes the current StackTrace and returns the render type based on this information. It basically works quite well, so I thought I'll share it with you: The only disadvantage is that I cannot find out which Entity is currently rendered, so I cannot differentiate between rendering for a Skeleton and rendering for a Zombie. It would be possible however if anyone knows a method how to get the values of local variables in the execution stack at runtime, because the Entity is passed as an argument to the caller methods that I check for. But as far as I know, it's not possible to get local variables, so I think I can forget this idea (unless I make a coremod and play with ASM).
  7. No, I did not change the texture with NBT (although that would be possible with getModel()), but I was able to register a rendering handler for items using the method tgg mentioned. I'm still trying to figure out how to get the current rendering mode from the getModel() method, but I discovered already that this method is only called when the Item is rendered in 1st or 3rd person, not in Item state or in the Inventory and also not when a Mob carries the Item. Thus, a method to get the current rendering state would be very useful, especially when using custom ItemMeshDefinition s or ISmartItemModel s. Probably the getModel method isn't that useful at all, because it's only called in very special circumstances. It's better to work with ISmartItemModels here (although this is quite complicated), because this is called everytime. But also here I need this method so much!
  8. Ok, so the technique for the TileEntity Rendering looks pretty awesome, although I'm going to change it a bit so that I have a "registry" where I can add the renderers with the associated Item or Block (or with a Predicate<ItemStack>). I'm still thinking if there's any way of eliminating the changes made by some modders who don't chain the classes like you did in your post. I'll take a look at the getModel method and try to find out something useful. Is there any chance that the IItemRenderer gets revived? Because for some Items which show a complicated model it isn't even possible to use the Minecraft model files. However, the only workaround I can imagine so far is to use the hijacked TileEntity renderer here again. I need to work a bit with this method, then I can see whether I still need the IItemRenderer. -BM EDIT: OK, My Registry thingy is working just perfect! It even works for Items, you just need to skip the registration in the builtin-block list. The best thing is that I don't even need to apply any transformations in the Item render file, without them it's perfect anyway. The Item.getModel() method looks quite nice as well (NOW I finally know how to make custom bows with changing texture!), but I don't know how to get the render type of the Item from inside this method. Any Ideas here? -BM
  9. Heyho Guys! I want to know whether it's possible to render an Item as it's corresponding TileEntity using the builtin/entity tag in the item's model file. Can I do this? And if so: how? Also, I'm wondering whether it's possible to register different Item models depending on the rendering type (So, one model for the Item in 3rd Person, one for 1st Person, one for Inventory etc.). If any of those is not possible, do you think I should request this as a new Forge feature? Or should I just say nothing and use the (deprecated ) IItemRenderer Interface? Any Ideas are very much appreciated! -BM
  10. Thanks for the answer, I made it work now! I did a bit of search and read in the minecraft code and figured out the following: The excluding magic in Vanilla happens in the method BlockModelShapes.registerAllBlocks() . There, the blocks are registered with the corresponding blockstate names and a StateMap. The exclusion happens in the StateMap. The properties to exclude are saved in the field listProperties . The StateMap can also map different blockstates to different files. The property which controls the mapping is saved in the property field. The value of this property (if existent) is used as the name for the blockstates file, if property is null, the block name is used. The value of the field suffix is then appended to the name. The property of the mapping is also excluded from the final property map. FINALLY: Doing the exclusion for modded Blocks: It's relatively easy as well... During the preInit phase (maybe before the addVariantName method call) you need to execute this method: ModelLoader.setCustomStateMapper(block, new StateMap.Builder().doWhateverYouWantToDoHere().build()); The builder class provides the necessary methods to create a StateMap which can exclude properties or name the blockstate files after one property. Well, I think that's it for now! Thanks for your answers and have fun playing around with exclusion of properties ~BM
  11. Ok, so I'll just sum up what I understood and you can tell me if I'm wrong. The registrations in the ItemModelMesher are only used for the Items and should add a mapping for model files based on all available Item Metadata. The blockstates files dont need registrations and only control the rendering of blocks in the world. In the blockstates file you need to write down the properties (alphabetic order, I guess) and assign corresponding models. I still have two questions left: Is the call of ModelBakery.addVariantName necessary and what does it do? Is it possible to exclude states from being used in the blockstates file?
  12. Well, I did this, but I don't understand what the single methods there do and why they are needed. I took this as my initial resource of information, but the comments did not explain everything clearly enough. Also, I really want to know how to exclude certain properties and that's not shown there either.
  13. Heyho Guys! I recently started with 1.8 and came across some issues with the block rendering for blocks with variants. So, I want to ask a few questions to clarify the things I'm unsure about. First question: Which registration method is used for a block with subtypes/variants? I saw both methods here: Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), meta, new ModelResourceLocation(modid + ":" + filename, "inventory")); ModelBakery.addVariantName(Item.getItemFromBlock(block), "first_file", "second_file", "third_file", "fourth_file"); where all the files define a blockstates file that was created. Which one of those is necessary? What exactly do they do? And where is the file finally searched? And is it possible to use one file for every metadata and differentiate the rendering inside this file with the variants tag? Second question: how is it possible to exclude some properties from the list that is searched for in the blockstates file? I saw that the stained glass pane for instance has the property "color", but this is not used in the blockstates file. There only the north/east/south/west property is checked. Third question: can I register a blockstate file for every possible metadata? I hope, someone can get an answer to one of these questions.. Please write if I need to be more precise on something because I think it might be a bit confusing. Thanks for every answer! ~_Bedrock_Miner_
  14. I know how I could solve the problem with the non-unique names. On the other hand the copyright is a heavy argument. Didnt know that the data is protected. I think I can forget this idea now if no one has another idea. How unfortunate.
  15. Why do you think this is a bad idea? And what are the reasons therefore?
  16. I know that there is the possibility to modify a field when providing two possible names, but I want to get the Srg name from the Mcp one.. I think I'll include the mapping files in my library mod and create a class which loads them and acts like a dictionary.
  17. Basically it would be possible to do the same with a mapping from MCP->SRG. The only problem would be that for some special variables more than one name would be returned. For these variables a special test would be needed which of the names exist in the given class. If you do it right, this method would be as fast as direct reflection. But anyway, I think this is possible, or do I miss something? EDIT: Btw, is there a way to get the csv files for the mapping at runtime in eclipse as well as in the compiled mod somehow without copying them manually? Or do I need to copy them for every minecraft version that has a new mapping?
  18. Apparently I didnt say clearly what I meant. I wanted to know whether there is a method to find out which obfuscated name belongs to a non-obfuscated name in a special class. For instance, I have a method for this, I insert the class and the unobfuscated name and it returns the obfuscated one. getObfuscatedName(Minecraft.class, "timer") returns: "field_71428_T"
  19. Hello everyone! Its me again.. I recently thought about whether its possible to get the obfuscated name for a method or a field at runtime. This would mean you wouldn't have to write two statements to get the fields "field_71428_T" and "timer" from the class Minecraft.class, but you can just write getFieldName("timer", Minecraft.class) and you would automatically have the right field name. Would this be possible?
  20. Well, I meant any Tick. Didn't know that there were different ones, but that what you mentioned sounds good. Thank you!
  21. Heyho Guys! Just a small question: How can I get the current World tick count and the partial tick value on client side? It should be a simple thing that I can put in a method like: getCurrentTick(); getCurrentPartialTick();
  22. Oh, I have a better Idea: I do the rendering stuff myself. But I need to know, how can I get the size of a texture provided as a ResourceLocation in pixels? Any ideas?
  23. OK, I now used the makeItemModel method directly to get a model from a resource location. One problem: This method returns a BlockModel. How can I render this model?
×
×
  • Create New...

Important Information

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