Jump to content

Recommended Posts

Posted

I'm trying to figure out how to set up gui containers so that the client side has a reference to the TE in question so that it can get things like the current cook time.

 

Due to all the obfuscation behind factories and container types, I can't figure out how on earth the Furnace (and like classes) actually get injected into the Container used on the client side.

 

For example, the Furnace gets its GuiContainer constructed using a Container that calls a constructor that does this:

 

this(containerTypeIn, recipeTypeIn, id, playerInventoryIn, new Inventory(3), new IntArray(4));

 

That new Inventory(3) is what gets referenced on the client side later on as the Furnace inventory and the new IntArray(4) is used as field_217064_e, referenced in getCookProgressionScaled(). But it's a blank array! It never gets filled with any values as far as I can find.

 

Going a step further it appears that furnaces are just plain broken (they don't smelt, at all) in the dev environment. Can anyone confirm this?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
10 minutes ago, Draco18s said:

Going a step further it appears that furnaces are just plain broken (they don't smelt, at all) in the dev environment. Can anyone confirm this?

Gonna check this now.

 

10 minutes ago, Draco18s said:

I'm trying to figure out how to set up gui containers so that the client side has a reference to the TE in question so that it can get things like the current cook time.

Yeah the way it is kinda seems weird to me, but I figured it out. So you need an INamedContainerProvider which can have a constructor. To open a gui you use one of the NetworkHooks.openGui which has three options all of which take in a ServerPlayer and a INamedContainerProvider. One takes in a BlockPos and another takes in a Consumer<PacketBuffer>.

 

And there is this example on the github.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
7 minutes ago, Animefan8888 said:

Yeah the way it is kinda seems weird to me, but I figured it out. So you need an INamedContainerProvider which can have a constructor. To open a gui you use one of the NetworkHooks.openGui which has three options all of which take in a ServerPlayer and a INamedContainerProvider. One takes in a BlockPos and another takes in a Consumer<PacketBuffer>.

I have that. I extended the interface, actually, but my TE still implements it. createMenu, getDisplayName, and openGUI. All the vanilla TEs implement the interface directly.

 

I'm already using the NetworkHooks.openGui that takes in the player, container, and blockpos.

 

But I don't see where I get that blockpos back on the client end of things.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
28 minutes ago, Draco18s said:

Going a step further it appears that furnaces are just plain broken (they don't smelt, at all) in the dev environment. Can anyone confirm this?

I can confirm that they work in the latest version of forge  1.14. So you may want to update.

3 minutes ago, Draco18s said:

But I don't see where I get that blockpos back on the client end of things.

There might be some behind the scenes magic with registering the ContainerType you should use IForgeContainerType.create

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
20 minutes ago, Animefan8888 said:

I can confirm that they work in the latest version of forge  1.14. So you may want to update.

1.14.3 or 1.14.4?

20 minutes ago, Animefan8888 said:

There might be some behind the scenes magic with registering the ContainerType you should use IForgeContainerType.create

And how do you register the class as an IForgeContainerType?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
7 minutes ago, Draco18s said:

1.14.3 or 1.14.4?

1.14.4 I updated when it first came out.

 

7 minutes ago, Draco18s said:

And how do you register the class as an IForgeContainerType?

ContainerTypes are a registry.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
3 minutes ago, Animefan8888 said:

1.14.4 I updated when it first came out.

Noted. I'll give that a try.

Quote

ContainerTypes are a registry.

Yes. I know. That's not what I am having a problem with.

ContainerType's constructor requires an IFactory parameter (which defines a create method), not an IForgeContainerType (which defines a different create method).

ContainerType is already an IForgeContainerType, so either:

a) I'm already doing it right and something else is wrong

b) I'm doing it wrong

What do I need to do to get the IForgeContainerType result?

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
6 minutes ago, Draco18s said:

a) I'm already doing it right and something else is wrong

b) I'm doing it wrong

I'm not sure do you have your code on your github so I can look.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
5 minutes ago, Animefan8888 said:

I'm not sure do you have your code on your github so I can look.

Will be here momentarily (need to push changes, will take a few minutes)

https://github.com/Draco18s/ReasonableRealism/blob/1.14.3/src/main/java/com/draco18s/harderores/HarderOres.java#L102

Done

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
16 minutes ago, Draco18s said:

b) I'm doing it wrong

EasyRegistry.registerOther(new ContainerType<>(SifterContainer::new), new ResourceLocation(HarderOres.MODID,"sifter"));

Instead of new ContainerType<?> do IForgeContainerType.create(SifterContainer::new)

 

And then in your SifterContainer have a constructor with a PacketBuffer parameter. I think it gets passed in there. And then you can send whatever info you want to the container.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

I swear I tried doing that and Eclipse wouldn't let me. I probably inferred something wrong and the autocompletion was (correctly, but unhelpfully) not suggesting things or otherwise complaining.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.