Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Proper way to render multiblock. 1.15.2
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
AntonBespoiasov

Proper way to render multiblock. 1.15.2

By AntonBespoiasov, May 12, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

AntonBespoiasov    0

AntonBespoiasov

AntonBespoiasov    0

  • Tree Puncher
  • AntonBespoiasov
  • Members
  • 0
  • 40 posts
Posted May 12, 2020 (edited)

My mod uses master-slave multiblock system. But I still don't know how should the multiblock be rendered. I have some possible solutions for this problem:

  1. Each block of a multiblock stores ID of its model as property of block state. Then using blockstate JSON files I can map corresponding models to corresponding block of multiblock. Here comes another question: should each multiblock have its own implementation of slave and master, just its own instances of an existing implementation of slave and master or one instance of each implementation of slave and master will be used for all multiblocks.
  2. I will create my own implementation of IBakedModel. Where one block will render entire multiblock while all other blocks in the multiblock will have no model and render nothing. But I'm not sure if IBakedModel is allowed to render something outside of its block.
  3. I will use TER to render entire multiblock like in previous solution but using TER instead of implementation of IBakedModel. 
  4. Each block of a multiblock will be separate block instance, have its own registry name and therefore its own blockstate JSON where I will be able to map corresponding model. 

If you have some other ideas share them. If its possible could you attach some example implementations and explain the solution better because I'm not really good at rendering and implementing IBakedModel.

 

Edited May 12, 2020 by AntonBespoiasov
  • Quote

Share this post


Link to post
Share on other sites

TheGreyGhost    819

TheGreyGhost

TheGreyGhost    819

  • Reality Controller
  • TheGreyGhost
  • Members
  • 819
  • 3280 posts
Posted May 12, 2020

Hi

 

There are some example implementations here for IBakedModel and custom IModelData to pass information to a block renderer.

https://github.com/TheGreyGhost/MinecraftByExample

(mbe03, mbe04, mbe05)

 

My first thought: make the master block a tileentity and the slave blocks normal blocks.  If your slaves don't have too many different states, then store them as a blockstate.  Use the master tileentity to coordinate the slaves and keep them up-to-date.   If at all possible, avoid having the slaves try to talk to the master because they may be in different chunks which may be loaded at different times (i.e. the master may not be loaded).

 

If you describe your multiblock structure in more detail (i.e. in gameplay terms - from the point of view of someone playing the game, not from the point of view of what you think the code should look like) then we could make some more concrete suggestions...

 

Cheers

  TGG

 

 

 

  • Quote

Share this post


Link to post
Share on other sites

AntonBespoiasov    0

AntonBespoiasov

AntonBespoiasov    0

  • Tree Puncher
  • AntonBespoiasov
  • Members
  • 0
  • 40 posts
Posted May 12, 2020
1 hour ago, TheGreyGhost said:

If you describe your multiblock structure in more detail (i.e. in gameplay terms - from the point of view of someone playing the game, not from the point of view of what you think the code should look like) then we could make some more concrete suggestions...

The multiblocks are pretty similar to those ones in Immersive Engineering. They can be rotated(but not mirrored yet), they look like solid machine and blocks of resulting multiblock mostly don't look similar to blocks that have stood on their places before the multiblock was formed. Clicking on different blocks of multiblock may trigger different actions. There will also be different additions to multiblock: items input/output block, pattern chest and pattern creator(they allow you to put some recipe in the machine they attached to and then perform this recipe automatically, like that crafting table from BuildCraft) and probably more. Some of them will be dynamic(e.g. altar that may have different amount of pedestals, pillars that may have different length), the look of the dynamic parts will mostly blend with entire multiblock.

 

System that is used to form multiblocks is already done and is based on events that will make some method iterate through multimap of multiblock creators(factories) instances associated with class of the event and call trigger method of the multiblock creators passing the event as a parameter. Things that will happen in the trigger method are all based on utils for scanning possible multiblock structure. Briefly: weird mix of Vanilla recipes system and Forge events system.

 

So when a player builds structure needed to form multiblock he will need to click(or perform some other key action in formation of multiblock) on certain block of the multiblock to trigger its creation.

  • Quote

Share this post


Link to post
Share on other sites

TheGreyGhost    819

TheGreyGhost

TheGreyGhost    819

  • Reality Controller
  • TheGreyGhost
  • Members
  • 819
  • 3280 posts
Posted May 12, 2020

Howdy

Based on your description, I'd recommend using standard Blocks and Blockstates for all the slaves and TileEntities for the masters.

Your Multimap cache idea sounds ok but you will need to pay careful attention to Chunk loading, i.e. you will need to synchronise your multimap to the currently loaded chunks somehow.   That is more difficult than it sounds because they are multithreaded.

 

-TGG

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • pitbox46
      Creating a coremod

      By pitbox46 · Posted just now

      I need to figure out how to make a coremod(as in ASM). My last post explains why I have to do this. I have an understanding about ASM, but what I don't at all understand is the forge implementation of ASM. There don't seem to be any tutorials on creating a coremod for versions past minecraft 1.12 and it seems like the forge api for coremodding has had some changes since then. I looked at https://cadiboo.github.io/tutorials/1.14.4/forge/99.99-coremod/ and the associated code, and I tried implementing a coremods.json to my /META-INT and a redstone_remote_transformer.js to my /resources, but the javascript file isn't loaded at all. My questions are: Why is javascript used for the transformer? How is the javascript transformer called? Thanks!
    • Eksity
      Another freaking "error in currently selected datapacks prevented world from loading"

      By Eksity · Posted 21 minutes ago

      for some reason my forge won't run without optifine... resource packs maybe? anyway, here's the mod list (beware it's pretty long) https://gist.github.com/Eksity/e58ed8c0e2abf028d34780e5938bcea5
    • BeardlessBrady
      [1.16.4] Generating a resource pack on startup

      By BeardlessBrady · Posted 1 hour ago

      Im looking to generate a resource pack on startup if it hasen't been generated before. There must be a way to generate files in the running environment as thats what the config files are. I assume its fileIO stuff but I am not sure if there is anything special to do it through forge and to get the resourcePack folder location.
    • Ricardo Libero
      Missing texturo on placed Block

      By Ricardo Libero · Posted 2 hours ago

      oh thanks i didnt see that, i was paying more attention to the codes hehe 
    • NorthWestWind
      [1.16.5] Make item render like bow in thirdperson

      By NorthWestWind · Posted 2 hours ago

      Yes, I'm looking for such behaviour. However, I want my item to have such behaviour even without right-click.
  • Topics

    • pitbox46
      0
      Creating a coremod

      By pitbox46
      Started Just now

    • Eksity
      2
      Another freaking "error in currently selected datapacks prevented world from loading"

      By Eksity
      Started 5 hours ago

    • BeardlessBrady
      0
      [1.16.4] Generating a resource pack on startup

      By BeardlessBrady
      Started 1 hour ago

    • Ricardo Libero
      2
      Missing texturo on placed Block

      By Ricardo Libero
      Started 4 hours ago

    • NorthWestWind
      2
      [1.16.5] Make item render like bow in thirdperson

      By NorthWestWind
      Started 12 hours ago

  • Who's Online (See full list)

    • pitbox46
    • Eksity
    • sebazthebasss
    • Zeher_Monkey
    • brok4d
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Proper way to render multiblock. 1.15.2
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community