Jump to content

Learn Modding 1.16


DimKar3000

Recommended Posts

Hello Everyone I've played minecraft for a very long time now and I want to get into making mods. I am already decent with java and I would like to create a proof of concept chest block/tileentity. 

I have read the current documentation and for it lacks noob instructions and example of working with tile entities and GUIs.

 

What I want to do:

  1. Create a TileRender for custom chest opening animation
  2. Create a gui to render its content and implement the User interaction or even hopper/pipe interaction
  3. Avoid deprecated code for style points.

What I need you help with:

  1. Some pointers on how to implement the Renderer(Custom Block Model/Open, Close animation)
  2. I found 0 information on how to implement block interaction with GUI or how to register them properly

What I already know:

  1. Create Blocks and attach TileEntities to them.
  2. I have already read the forge docs.
  3. I Know there are some interfaces like IInventory and ITickable that help but I found almost no documentation for them

 

I personally learn better by example so if someone has a standalone example that is similar in concept I would like to read it. Personally I found the ChestBlock and AbstractChest classes of vanilla unreadable. 

 

Link to comment
Share on other sites

7 hours ago, DimKar3000 said:

Create a TileRender for custom chest opening animation

TERs can be attached via ClientRegistry::bindTileEntityRenderer as long as the TileEntityType has it listed as one of the supported blocks. The rest is just matrix math and three-dimension transformations.

7 hours ago, DimKar3000 said:

Create a gui to render its content and implement the User interaction or even hopper/pipe interaction

ContainerType and ContainerScreen attached via ScreenManager::registerFactory. These can mimic existing containers and screens in the game.

7 hours ago, DimKar3000 said:

Avoid deprecated code for style points

There is nothing within container/screen code that is really deprecated for usage currently due to how the system is set up.

7 hours ago, DimKar3000 said:

Some pointers on how to implement the Renderer(Custom Block Model/Open, Close animation)

The block has a state of some kind which switches the rendering used such that TERs are only drawing when absolutely needed and the rest is handled by baked models.

7 hours ago, DimKar3000 said:

I found 0 information on how to implement block interaction with GUI or how to register them properly

NetworkHooks::openGui on the logical server within Block#onBlockActivated and I already mentioned registering.

7 hours ago, DimKar3000 said:

I Know there are some interfaces like IInventory and ITickable that help but I found almost no documentation for them

Don't use IInventory, the forge system is Capabilities via IItemHandler. ItemStackHandler is your friend for this implementation.

7 hours ago, DimKar3000 said:

I have read the current documentation and for it lacks noob instructions and example of working with tile entities and GUIs.

Documentation is only supposed to explain a certain systems added by the library or hook interface in question. Forge does a decent job in that respect (besides from the outdated information). As such, it should not have any reason to give step-by-step instructions on how to do something, just a general overview. A user's analysis skills and observation through the source code to figure this out. Try attempting to make the current system with your best knowledge then come back with specific questions on what parts you might be stuck on. When you do so, provide a repository to the project being referred to so that anyone who wants to help doesn't need to beat around the bush to figure out the answer. If an error is occurring, a paste containing debug.log should also be attached.

Link to comment
Share on other sites

4 hours ago, ChampionAsh5357 said:

TERs can be attached via ClientRegistry::bindTileEntityRenderer as long as the TileEntityType has it listed as one of the supported blocks. The rest is just matrix math and three-dimension transformations.

ContainerType and ContainerScreen attached via ScreenManager::registerFactory. These can mimic existing containers and screens in the game.

There is nothing within container/screen code that is really deprecated for usage currently due to how the system is set up.

The block has a state of some kind which switches the rendering used such that TERs are only drawing when absolutely needed and the rest is handled by baked models.

NetworkHooks::openGui on the logical server within Block#onBlockActivated and I already mentioned registering.

Don't use IInventory, the forge system is Capabilities via IItemHandler. ItemStackHandler is your friend for this implementation.

Documentation is only supposed to explain a certain systems added by the library or hook interface in question. Forge does a decent job in that respect (besides from the outdated information). As such, it should not have any reason to give step-by-step instructions on how to do something, just a general overview. A user's analysis skills and observation through the source code to figure this out. Try attempting to make the current system with your best knowledge then come back with specific questions on what parts you might be stuck on. When you do so, provide a repository to the project being referred to so that anyone who wants to help doesn't need to beat around the bush to figure out the answer. If an error is occurring, a paste containing debug.log should also be attached.

Thanks for the reply. After some more digging I found how to do some of the above. The Tile Render will probably be the most difficult. I get your point that forge gives users a description of what it provides and we are supposed to find out the rest. I found a lot of stuff from reading source the source code and watching videos. 

 

The main problem that I seem to come across is the fact that you need 4-5 classes registered to forge through different ways with almost no connection from one to another. Unless you already know what is needed to create a GUI and/or a tile entity, it is really hard to reason what is needed and what it is not. Anyway I thing now I will be able to do everything but the Custom Tile Renderer and I will fiddle around with that later. :D

 

 

Link to comment
Share on other sites

3 hours ago, DimKar3000 said:

Unless you already know what is needed to create a GUI and/or a tile entity, it is really hard to reason what is needed and what it is not.

For reference, everything being described is a vanilla system. Forge only has one or two hooks that are relevant and those are clearly documented. Blaming Forge is the same as blaming any mod loader for not knowing how to use the base program. However, that's more or less the issue building off of an obfuscated program. That's what the forums are for: explaining concepts that may not be clear to some programmers compared to others. You're always welcome to post a question about how to navigate through vanilla's system and sure enough if there are people who can comment and help, they will.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

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