Posted November 25, 201410 yr Hi, I am testing a code that I did based on a sample that seen in a tuttorial, succeeded in part, the only problem I am having is that the image I'm trying to draw on the screen is not being fully drawn, as if the its resolution is changed when it is loaded by minecraft. look the code: testemod (Main class) package teste; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = testemod.MODID, name = testemod.NAME, version = testemod.VERSION) public class testemod { public static final String MODID = "testemod"; public static final String NAME = "Testemod"; public static final String VERSION = "1.0"; public static Block myFirstContainerBlock; @Instance ( "testemod" ) public static testemod instance; @SidedProxy ( clientSide = "teste.ClientProxy", serverSide = "teste.CommonProxy" ) public static CommonProxy proxy; @EventHandler public void preinit(FMLPreInitializationEvent event) { myFirstContainerBlock = new MyFirstContainerBlock(Material.rock) .setHardness(0.5F).setStepSound(Block.soundTypeStone) .setBlockName("myFirstContainerBlock") .setBlockTextureName("testemod:OsmiumOre") .setCreativeTab(CreativeTabs.tabBlock); GameRegistry.registerBlock(myFirstContainerBlock, "myFirstContainerBlock"); NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); } } GuiBasic (GuiScreen class) package teste; import org.lwjgl.opengl.GL11; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.ResourceLocation; public class GuiBasic extends GuiScreen { public static final int GUI_ID = 20; int guiWidth = 140; int guiHeight = 80; @Override public void drawScreen(int x, int y, float ticks) { int guiX = (width - guiWidth) / 2; int guiY = (height - guiHeight) / 2; GL11.glColor4f(1, 1, 1, 1); drawDefaultBackground(); mc.renderEngine.bindTexture(new ResourceLocation(testemod.MODID, "textures/gui/Gui2.png")); drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight); super.drawScreen(x, y, ticks); } } CommonProxy (implements IGuiHandler) package teste; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; public class CommonProxy implements IGuiHandler { //public void registerKeyBindings() { //} @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == GuiBasic.GUI_ID) return new GuiBasic(); return null; } } MyFirstContainerBlock (the block start event) package teste; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; public class MyFirstContainerBlock extends Block { protected MyFirstContainerBlock(Material mat) { super(mat); } @Override public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { Minecraft.getMinecraft().displayGuiScreen(new GuiBasic()); return super.onBlockActivated(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, p_149727_5_, p_149727_6_, p_149727_7_, p_149727_8_, p_149727_9_); } } my custom screen image (this have 140x80 resolution) https://scontent-a-mia.xx.fbcdn.net/hphotos-xap1/v/t1.0-9/10418987_758054787617239_8936067923206037565_n.jpg?oh=833c46c7a3a02b712def870bc859f452&oe=54DB4040[/img] the result screen displayed https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-xpa1/t31.0-8/p526x395/10835024_758054930950558_3083716366299205453_o.jpg[/img] tutorial link (what i'm based) then there are any solution?
November 25, 201410 yr I had this same problem. All you have to do is make your texture file to 256 by 256 pixels. Also you have to delete all the white space around it. I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!
November 25, 201410 yr Author https://scontent-b-mia.xx.fbcdn.net/hphotos-xpf1/t31.0-8/10454347_758074337615284_8019490234765203264_o.jpg[/img] it seems that the minecraft works with a default resolution, before I was using a smaller image and in the end the minecraft stretched to reset the rest Thank you friend for the help = b
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.