Jump to content

[1.16.5]Custom Furnace, missing recipe book


Cratthorax

Recommended Posts

Good Evening,

so I was primarily following GrayGhost's MinecraftByExample on Github, to port my custom furnace's to 1.16.5. The problem now is, using custom ContainerScreen, I figured he never implemented, or showed a way how to bring the recipe book to your custom tile entity/container screen. I spend the better part of today to get things working, but ultimately failed on the underlying difference between a "container" type TE, and an actual "smelting" type of TE's super's. As far as I understand it, he wasn't using any kind of crafting TE as base, but rather worked with a build up tutorial structure, using a chest type of container as base. A chest is not a furnace, or not a crafting station in that regard.

So my question is if it is even possible to reimport the recipe book, or make any kind of replacement, before I even start trying a different approach.

Link to comment
Share on other sites

  • 2 weeks later...

As always I'd return to conclude my inquiries, if successful. To solve my issue, I just had to create a custom screen, extend any "furnace" type screen to access the recipe book functions(AbstractFurnaceScreen actually turned out to be quite a hassle, so I moved on using FurnaceScreen). To implement the recipe book button into my "ContainerScreenCampfire", I just mimicked and adjusted the client code found in AbstractFurnaceScreen, and then I had to do the following code, to close the screen, and press the right mouse button to simulate returning to the original campfire screen, instead of the furnace screen:

 
	public class CustomScreen extends FurnaceScreen {
    
    private final ResourceLocation guiTexture;
	    public CustomScreen(FurnaceContainer container, PlayerInventory playerInventory, ITextComponent title, ResourceLocation guiTextureIn) {
        super(container, playerInventory, title);
        this.guiTexture = guiTextureIn;
    }
    
    @SuppressWarnings("deprecation")
    @Override
    protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) {
        
        RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.minecraft.getTextureManager().bindTexture(this.guiTexture);
	        int i = this.guiLeft;
        int j = this.guiTop;
        this.blit(matrixStack, i, j, 0, 0, this.xSize, this.ySize);
	    }
	    @Override
    public boolean mouseClicked(double mouseX, double mouseY, int button) {
	        
        if (this.recipeGui.mouseClicked(mouseX, mouseY, button)) {
            return true;
        } else {
            this.closeScreen();
            //KeyBinding.setKeyBindState(minecraft.gameSettings.keyBindings[this.keyBindAttack].getKey(), true);
            KeyBinding.onTick(minecraft.gameSettings.keyBindUseItem.getKey());
            return false;
        }
    }
	}

 

What's left to do is importing all the client particle, and server side burn time logic functions etc., from my original campfire. But this should be pretty straight forward.

Edited by Cratthorax
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.