Jump to content

MultiMote

Forge Modder
  • Posts

    257
  • Joined

  • Last visited

Posts posted by MultiMote

  1. public class RestrictedSlot extends Slot {
        public RestrictedSlot(IInventory inventory1, int id, int x, int y) {
            super(inventory1, id, x, y);
        }
    
        @Override
        public boolean isItemValid(ItemStack par1ItemStack)
        {
            return false;
        }
    }
    

  2. drawTexturedModalRect ONLY works with 256х256 images. Change canvas size of your image (make transparent space) or use this:

        /**
         * Тот же drawTexturedModalRect, но для картинок с любым разрешением
         */
        public static void drawNonStandartTexturedRect(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight) {
            float f = 1F / (float) textureWidth;
            float f1 = 1F / (float) textureHeight;
            Tessellator tessellator = Tessellator.instance;
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV((double) (x), (double) (y + height), 0, (double) ((float) (u) * f), (double) ((float) (v + height) * f1));
            tessellator.addVertexWithUV((double) (x + width), (double) (y + height), 0, (double) ((float) (u + width) * f), (double) ((float) (v + height) * f1));
            tessellator.addVertexWithUV((double) (x + width), (double) (y), 0, (double) ((float) (u + width) * f), (double) ((float) (v) * f1));
            tessellator.addVertexWithUV((double) (x), (double) (y), 0, (double) ((float) (u) * f), (double) ((float) (v) * f1));
            tessellator.draw();
        }
    

×
×
  • Create New...

Important Information

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