Guiの進捗状況の描画について。

Modやプラグインの制作/開発に関する質問はこちらへどうぞ。
アバター
Lychee
ID: 2K921CZLUD
記事: 7
登録日時: 2020年4月23日(木) 22:53
Minecraft ID: Owl_Eye

Guiの進捗状況の描画について。

投稿記事 by Lychee » 2020年5月05日(火) 07:32

今現在かまどのような機能持ちブロックを制作しているのですが、かまどでいう燃焼時間の炎の描画や調理時間の矢印の描画ができません。バックにはかまどのGuiのテクスチャをそのまま用いているので、Guiクラスのコードは文字の描画以外そのままかまどの文をコピーした形になっているのですが、描画されませんでした。自分なりにdrawTexturedModalRectメソッドの処理も覗いてみたのですが、位置や幅、高さなどが引数として渡されていることしか把握できず、いまいち処理の内容を詳しくつかめませんでした。問題点の指摘、よろしくお願いいたします。

↓Guiクラスの全文です。

コード: 全て選択

package cattleya.log.GUIs;

import org.lwjgl.opengl.GL11;

import cattleya.log.containers.ContainerTyingMachine;
import cattleya.log.tileentities.TileEntityTyingMachine;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;

public class GUITyingMachine extends GuiContainer{

	private TileEntityTyingMachine tileentity;
	private static final ResourceLocation GUITEXTURE = new ResourceLocation("textures/gui/container/furnace.png");

	public GUITyingMachine(InventoryPlayer invPlayer, TileEntityTyingMachine par2TileEntity) {
		super(new ContainerTyingMachine(invPlayer, par2TileEntity));
		this.tileentity = par2TileEntity;
	}

	@Override
	protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.mc.getTextureManager().bindTexture(GUITEXTURE);
        int k = (this.width - this.xSize) / 2;
        int l = (this.height - this.ySize) / 2;
        this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);

        if (this.tileentity.isBurning())
        {
            int i1 = this.tileentity.getBurnTimeRemainingScaled(13);
            this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
            i1 = this.tileentity.getCookProgressScaled(24);
            this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
        }
	}
}
↓一応、drawTexturedModalRectメソッドのコードも貼っておきます。

コード: 全て選択

 /**
     * Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height
     */
    public void drawTexturedModalRect(int p_73729_1_, int p_73729_2_, int p_73729_3_, int p_73729_4_, int p_73729_5_, int p_73729_6_)
    {
        float f = 0.00390625F;
        float f1 = 0.00390625F;
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1));
        tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1));
        tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + 0) * f1));
        tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + 0) * f1));
        tessellator.draw();
    }
0