Jump to content

CodificatorGM

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by CodificatorGM

  1. Hello everyone I have a custom block entity and im having trouble with the Screen class, right now im able to right click the block but no GUI appears on the screen; here is my screen class code package net.codificatorgm.testmod.screen; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import net.codificatorgm.testmod.TestMod; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.InventoryScreen; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; public class WeedMaticScreen extends AbstractContainerScreen<WeedMaticMenu> { private static final ResourceLocation TEXTURE = new ResourceLocation(TestMod.MOD_ID,"textures/gui/weedmatic_gui.png"); Component component; private float xMouse; private float yMouse; public WeedMaticScreen(WeedMaticMenu menu, Inventory inventory, Component pComponent) { super(menu, inventory, pComponent); this.component = pComponent; } @Override protected void renderBg(GuiGraphics pGuiGraphics, float pPartialTick, int pMouseX, int pMouseY) { RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderTexture(0, TEXTURE); int i = (width - imageWidth) / 2; int j = (height - imageHeight) / 2; pGuiGraphics.blit(TEXTURE, i, j, 0, 0, this.imageWidth, this.imageHeight); renderProgressArrow(pGuiGraphics, j, j); } private void renderProgressArrow(GuiGraphics pGuiGraphics, int x, int y) { if(menu.isCrafting()) { pGuiGraphics.blit(TEXTURE, x + 105, y + 33, 176, 0, 8, menu.getScaledProgress()); } } @Override public void render(GuiGraphics pGuiGraphics, int mouseX, int mouseY, float delta) { renderBackground(pGuiGraphics); super.render(pGuiGraphics, mouseX, mouseY, delta); renderTooltip(pGuiGraphics, mouseX, mouseY); } @Override protected void init() { super.init(); } } I saw that for 1.20 they changed some methods in order to get a working GUI but that was just the PoseStack methods and now uses GuiGraphics, any help with be much appreciated.
  2. Hello, I'm adding a new item "grapefruit_soda" that requires a water potion and other items for it to be crafted, however im having trouble when adding the water potion since it is not directly an "Item", when I go into the game and look for the recipe I just get a Uncraftable Potion, I tried creating a customized shapelessRecipeBuilder Class and directly get the water potion in the ModRecipeProvider class but i've unsuccessfull; My code for the ModRecipeBuilder classs and grapefruit_soda item. How can I go about this, thanks in advance.
×
×
  • Create New...

Important Information

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