Jump to content


  • Posts

  • Joined

  • Last visited

1 Follower


  • Gender

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Elix_x's Achievements

Dragon Slayer

Dragon Slayer (6/8)



  1. But getExtendedState is called on the same thread, and right before getQuads... So, would it not change anything?
  2. I understand that concurrency is an issue that can occur at any time. But what's the other way of passing required information to the model? You could compile everything you need into immutable objects to be passed, and that work on that in tessellation, but that creates compilation (+decompilation) overhead.
  3. Hmmm.... Doesn't look like this thread exists anymore. It seems like it was long ago enough for it to vanish somewhere... And me to forget what exactly was it about.
  4. Yep, you have to declare them in block class to make MC know about them, and actually provide/update them. FYI: This is similar for saved, actual and extended props. The declaration of all 3 is in createBlockState, saved props are handled by meta<->state methods, actuals by getActualState and extended - by getExtendedState. The difference between actual and extended, is that actual is used on server and client, has a limited number of serializeable values it can take and can be used in state mapping (~json model). Extended state is used only on client, can take any values of any type, and cannot be used for state mapping - aka only custom IBaked models. FYI 2: Actually, if you can create a single unlisted property for tile entity and pass it directly, instead of world and position. I'm just using 2 separate props, because i'm using them for other blocks too, which don't always have a tile entity, or i simply don't need it.
  5. If you won't be animating, use custom IBakedModel. If you do want to animate, as Draco said, use Fast TESR. By creating custom implementation of IBakedModel, you can override getQuads. In order to provide tile's data to get quads, pass unlisted properties from your block to model (override unlisted prop methods in your block class). getQuads is called each time model is drawn (item / in-world render update). So, in there, get baked models for all your parts, stream all the quads transforming accordingly, collect into a list and that list (considering your frame is rather a non-full block, you should do it only when side arg is null - side arg is for adjacency culling - ). Example (might be too many files to all link here) : IBaked, Helper, Uses client baked lib and client baked pipeline (and here), Model reg manager for using loaded & mapped json/obj/baked models for custom stuff, and a lot more...
  6. Just as Draco said, you have to translate the lid such that it's origin is world origin, rotate, then translate it back. Notice GlStateManager.translate(x, y, z) in the beginning of the method. This method translates tile entity in the world view space. Now the origin (0,0,0) is "actually" the XYZ of the tile entity, AKA you're working in local coordinates - coordinates relative to the origin of tile/model. So you have to translate the lid by it's local model coordinates to local origin and back. Ex: GL.trans(-lidModelCoords).rot(rot).trans(lidModelCoords).
  7. This is the definition of matrices. Understanding matrices will definitely help you solve this. I recommend watching this: Linear transformations and matrices | Essence of linear algebra, chapter 3* As for how to rotate around an axis, in 3D, you can look at how utility method is implemented in JOML: https://github.com/JOML-CI/JOML/blob/c312304fefbe757e3d37cba866f5742b3448a85c/src/org/joml/Matrix4f.java#L11379 This is generic use case, but now i have to correct you. What you put in the "What is happening" is not correct. Because in both translation, rotation and scaling, coordinates do "the same" what the model does (it is actually the opposite - model does whatever you do to the coordinate system). That said, the transformations you apply further down in the stack, actually apply to the already transformed coordinates as a whole, so
  8. The texture UVs you have are actually the global UV coordinates on the texture atlas. So what you will need is figure out a way to access the texture atlas sprite that was used to bake the quad. In the sprite, you will find min & max global UV coordinates. Now just do some math, and apply the values. Note: if you're trying to reduce the resolution of the texture, you have to do it completely differently. As for manipulating quads data, you can't just do it on that raw data. Because quads for blocks and quads for items are in a different VertexFormat - the index defining each format element is different. You'll have unpack the quad first (into forge's UnpackedBakedQuad), then manipulate the more conveniently, but still not very, stored vertex data. Take a look at the VertexFormat class to see how it is constructed. PS: I have a library i use to unpack models, quads & vertices into Java friendly format (easy get&set operations). If you want, you can check it out here.
  9. Considering above, there is a way to render based on ticks, and it is used by Vanilla entities, chests, etc... Very often in the render/draw method, you get a float parameter partialTick. It is between 0 and 1 and it represents how much in-between 2 ticks the current frame is. Use it to interpolate between previous and next tick and you get smooth transitions / animations.
  10. Registry events work as any other Forge event - you subscribe it to the event bus, and that's it. Forge will call it when stuff will be registered.
  11. When stencils don't work for me right away, i usually enable the color write and draw the stencil'ed region with colors, then i go into debug mode and play with it until i get it to work.
  12. Make sure that you enabled (created) stencil buffer. By default, MC does not create one. Alternatively, because you're in 2D, use scissors.
  13. First, ICustomModelLoader has nothing to do with this. Custom IBakedModels should be replaced in the registry in the ModelBake event. Second, to provide data to custom unbaked you can use IUnlistedProperties. Just like block has properties, it also has unlisted properties. While normal properties are both server and client, can be use for logic and require fixed amount of allowed values, unlisted properties are only used for rendering and can hold absolutely any values (even Worlds!). You have to implement (similarly named methods) getUnlistedState&Container in the block class and cast IBlockState to unlisted state container (don't remember exact class name, sorry) to be able to retrieve unlisted properties.
  • Create New...

Important Information

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