Увеличенный по размерам слот

Версия Minecraft
1.8+
Порывшись в самом майнкрафте нашёл drawSlot, но не вижу что отвечает за размер слота и предмета в нём.
Народ, прошу подсказки каким методом и где это хотя бы делается, не могу найти в интернете, ну нигде ничего такого не написано(
 
Решение
GuiContainer#isMouseOverSlot переопределить чтобы изменить физические размеры слота.
GuiContainer#func_146977_a чтобы увеличить визуально размер предмета в слоте.
Переопределяем эти два метода и радуемся жизни. Только перед этим нужно снять private у методов с помощью AT.
3,005
192
592
Java:
@Override
    public void drawSlot(Slot slotIn) {
        int i = slotIn.xDisplayPosition;
        int j = slotIn.yDisplayPosition;
        ItemStack itemstack = slotIn.getStack();
        boolean flag = false;
        boolean flag1 = slotIn == this.clickedSlot && this.draggedStack != null && !this.isRightMouseClick;
        ItemStack itemstack1 = this.mc.thePlayer.inventory.getItemStack();
        String s = null;

        if (slotIn == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null)
        {
            itemstack = itemstack.copy();
            itemstack.stackSize /= 2;
        }
        else if (this.dragSplitting && this.dragSplittingSlots.contains(slotIn) && itemstack1 != null)
        {
            if (this.dragSplittingSlots.size() == 1)
            {
                return;
            }

            if (Container.canAddItemToSlot(slotIn, itemstack1, true) && this.inventorySlots.canDragIntoSlot(slotIn))
            {
                itemstack = itemstack1.copy();
                flag = true;
                Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack, slotIn.getStack() == null ? 0 : slotIn.getStack().stackSize);

                if (itemstack.stackSize > itemstack.getMaxStackSize())
                {
                    s = EnumChatFormatting.YELLOW + "" + itemstack.getMaxStackSize();
                    itemstack.stackSize = itemstack.getMaxStackSize();
                }

                if (itemstack.stackSize > slotIn.getItemStackLimit(itemstack))
                {
                    s = EnumChatFormatting.YELLOW + "" + slotIn.getItemStackLimit(itemstack);
                    itemstack.stackSize = slotIn.getItemStackLimit(itemstack);
                }
            }
            else
            {
                this.dragSplittingSlots.remove(slotIn);
                this.updateDragSplitting();
            }
        }
        this.zLevel = 100.0F;
        this.itemRender.zLevel = 100.0F;

        if (itemstack == null)
        {
            TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite();

            if (textureatlassprite != null)
            {
                GlStateManager.disableLighting();
                this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation());
                this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16);
                GlStateManager.enableLighting();
                flag1 = true;
            }
        }

        if (!flag1)
        {
            if (flag)
            {
                drawRect(i, j, i + 16, j + 16, -2130706433);
            }
            GlStateManager.enableDepth();
            this.itemRender.renderItemAndEffectIntoGUI(itemstack, i, j);
            this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, itemstack, i, j, s);
        }
        this.itemRender.zLevel = 0.0F;
        this.zLevel = 0.0F;
}
Это чистый метод, без glScale всё отрисовывается нормально
 

tox1cozZ

aka Agravaine
8,456
598
2,893
Должно работать, попробуй.
Java:
@Override
    public void drawSlot(Slot slotIn) {
        int slotSize = 32; // default 16
        float glScale = slotSize / 16.0F;
        int i = MathHelper.floor_float(slotIn.xDisplayPosition / glScale);
        int j = MathHelper.floor_float(slotIn.yDisplayPosition / glScale);
        ItemStack itemstack = slotIn.getStack();
        boolean flag = false;
        boolean flag1 = slotIn == this.clickedSlot && this.draggedStack != null && !this.isRightMouseClick;
        ItemStack itemstack1 = this.mc.thePlayer.inventory.getItemStack();
        String s = null;

        if (slotIn == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null)
        {
            itemstack = itemstack.copy();
            itemstack.stackSize /= 2;
        }
        else if (this.dragSplitting && this.dragSplittingSlots.contains(slotIn) && itemstack1 != null)
        {
            if (this.dragSplittingSlots.size() == 1)
            {
                return;
            }

            if (Container.canAddItemToSlot(slotIn, itemstack1, true) && this.inventorySlots.canDragIntoSlot(slotIn))
            {
                itemstack = itemstack1.copy();
                flag = true;
                Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack, slotIn.getStack() == null ? 0 : slotIn.getStack().stackSize);

                if (itemstack.stackSize > itemstack.getMaxStackSize())
                {
                    s = EnumChatFormatting.YELLOW + "" + itemstack.getMaxStackSize();
                    itemstack.stackSize = itemstack.getMaxStackSize();
                }

                if (itemstack.stackSize > slotIn.getItemStackLimit(itemstack))
                {
                    s = EnumChatFormatting.YELLOW + "" + slotIn.getItemStackLimit(itemstack);
                    itemstack.stackSize = slotIn.getItemStackLimit(itemstack);
                }
            }
            else
            {
                this.dragSplittingSlots.remove(slotIn);
                this.updateDragSplitting();
            }
        }
        this.zLevel = 100.0F;
        this.itemRender.zLevel = 100.0F;

        GL11.glPushMatrix();
        GL11.glScalef(glScale, glScale, 1.0F);
        
        if (itemstack == null)
        {
            TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite();

            if (textureatlassprite != null)
            {
                GlStateManager.disableLighting();
                this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation());
                this.drawTexturedModalRect(i, j, textureatlassprite, slotSize, slotSize);
                GlStateManager.enableLighting();
                flag1 = true;
            }
        }

        if (!flag1)
        {
            if (flag)
            {
                drawRect(i, j, i + slotSize, j + slotSize, -2130706433);
            }
            GlStateManager.enableDepth();
            this.itemRender.renderItemAndEffectIntoGUI(itemstack, i, j);
            this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, itemstack, i, j, s);
        }
        
        GL11.glPopMatrix();
        
        this.itemRender.zLevel = 0.0F;
        this.zLevel = 0.0F;
}
 
Должно работать, попробуй.
Спасибо! Последний вопрос, если можно, как сделать проверку на большее количество слотов здесь?
Java:
    @Override
    public boolean isMouseOverSlot(Slot slotIn, int mouseX, int mouseY)
    {
        if(slotIn == this.inventorySlots.inventorySlots.get(1)) {
        return this.isPointInRegion(slotIn.xDisplayPosition, slotIn.yDisplayPosition, 32, 32, mouseX, mouseY);
        } else {
            return this.isPointInRegion(slotIn.xDisplayPosition, slotIn.yDisplayPosition, 16, 16, mouseX, mouseY);
        }
    }
 

tox1cozZ

aka Agravaine
8,456
598
2,893
Ну можно сделать как-то так.
Java:
private int getSlotSize(Slot slot){
    switch(slot.getSlotIndex()){
        case 1:
            return 32;
        case 5:
            return 64;
        default:
            return 16;
    }
}

@Override
    public boolean isMouseOverSlot(Slot slotIn, int mouseX, int mouseY)
    {
        int slotSize = getSlotSize(slotIn);
        return this.isPointInRegion(slotIn.xDisplayPosition, slotIn.yDisplayPosition, slotSize, slotSize, mouseX, mouseY);
    }
 
Сверху