Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

YoWazzup

Forge Modder
  • Posts

    66
  • Joined

  • Last visited

Posts posted by YoWazzup

  1. I'll just send my whole Gui class then, since I have no idea where the error is then.

     

     

    public class GuiSkill extends GuiScreen {
    
    private final int imageHeight = 129;
    private final int imageWidth = 176;
    
    private static final int SKILL_WIDTH = 64;
    private static final int SKILL_HEIGHT = 32;
    
    private static final int MINING_X = 4;
    private static final int MINING_Y = 4;
    
    private static final int WOOD_X = 4;
    private static final int WOOD_Y = 37;
    
    
    
    private static ResourceLocation guiTexture = new ResourceLocation(Reference.MODID + ":textures/gui/gui.png");
    
    private GuiButton buttonDone;
    
    private SkillMining mining;
    private SkillWoodcutting woodcutting;
    
    public GuiSkill() {
    
    	mining = new SkillMining("mining");
    	woodcutting = new SkillWoodcutting();
    }
    
    @Override
    public void initGui() {
    	buttonList.clear();
    	Keyboard.enableRepeatEvents(true);
    
    	buttonDone = new GuiButton(0, width / 2 - (98 / 2), 25 + imageHeight, 98, 20, I18n.format("gui.done", new Object[0]));
    	buttonList.add(buttonDone);
    
    }
    
    int levelMining;
    int currentExp;
    
    @Override
    public void updateScreen() {
    	levelMining = mining.getCurrentLevel();
    	currentExp = mining.getCurrentXp();
    	buttonDone.visible = true;
    }
    
    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    	super.drawScreen(mouseX, mouseY, partialTicks);
    	GL11.glColor4f(1, 1, 1, 1);
    
    	mc.getTextureManager().bindTexture(guiTexture);
    
    	int offsetFromScreenLeft = (width - imageWidth) / 2;
    	int offsetTopScreen = 20;
    	drawTexturedModalRect(offsetFromScreenLeft, 20, 0, 0, imageWidth, imageHeight);
    
    	//DRAWS STRINGS FOR MINING
    	this.fontRendererObj.drawString("" + mining.getCurrentLevel(), offsetFromScreenLeft + 40, offsetTopScreen + 10, 0xFEFE00);
    	this.fontRendererObj.drawString("" + mining.getCurrentLevel(), offsetFromScreenLeft + 51, offsetTopScreen + 24, 0xFEFE00);
    
    	//DRWAS STRINGS FOR WOODCUTTING
    	this.fontRendererObj.drawString("" + woodcutting.getCurrentLevel(), offsetFromScreenLeft + 40, offsetTopScreen + 40, 0xFEFE00);
    	this.fontRendererObj.drawString("" + woodcutting.getCurrentLevel(), offsetFromScreenLeft + 51, offsetTopScreen + 54, 0xFEFE00);
    
    	List<String> hoverText = new ArrayList<String>();
    
    	if(isInRect(offsetFromScreenLeft + MINING_X, offsetTopScreen + MINING_Y, SKILL_WIDTH, SKILL_HEIGHT, mouseX, mouseY)) {
    		hoverText.add("Mining: " + mining.levelToString());
    		hoverText.add("Exp: " + mining.expToString());
    		hoverText.add("Left: " + mining.neededToString());
    
    
    	}
    	if(isInRect(offsetFromScreenLeft + WOOD_X, offsetTopScreen + WOOD_Y, SKILL_WIDTH, SKILL_HEIGHT, mouseX, mouseY)) {
    		hoverText.add("Woodcutting: " + mining.levelToString());
    		hoverText.add("Exp: " + mining.expToString());
    		hoverText.add("Left: " + mining.neededToString());
    
    
    	}
    
    	if(!hoverText.isEmpty()) {
    		drawHoveringText(hoverText, mouseX , mouseY , fontRendererObj);
    	}
    
    }
    
    public static boolean isInRect(int x, int y, int xSize, int ySize, int mouseX, int mouseY) {
    	return ((mouseX >= x && mouseX <= x + xSize) && (mouseY >= y && mouseY <= y + ySize));
    }
    
    @Override
    protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
    }
    
    @Override
    protected void actionPerformed(GuiButton button) throws IOException {
    	if (button == buttonDone) {
    		mc.displayGuiScreen((GuiScreen) null);
    	}
    }
    
    @Override
    public void onGuiClosed() {
    }
    
    @Override
    public boolean doesGuiPauseGame() {
    	return true;
    }
    
    }

     

  2. Hello,

     

    I have a gui in my mod that shows me my current skill levels.

    There is one problem however. when I open the gui i have no rendered cursor, it only shows up when i move my mouse outside of the minecraft window and move it back in. Is this a known bug? is there a solution?

     

    thanks.

  3. You are creating blocks before IDs are generated.

     

    You have to do any block = new BlockYours(id) after the id was correctly assigned.

    sorry i dont understand what you mean?

    Basically what he's saying is that you set the ID variables after registring the blocks, meaning that you are "creating" the blocks before setting the IDs, thus resulting in their IDs being 0. The fix is kind of complicated, but I will try to explain it.

     

    Basically, remove the "public final static Block" before the variables and do "public static Block compactdirt;" before all the methods, but still in the "public class compactblocks". After that, move the setting of the variables (compactdirt = new compactdirt...) in the method marked with @Init. If you don't understand, write.

     

    Get this error too, can you please create a dummy mod or something? So I can understand? Thanks!

  4. Hello, I don't know what I've done wrong but suddenly I can't run my mod anymore because of this error:

     

    
    2012-10-04 15:45:37 [sEVERE] [ForgeModLoader] Attempted to load a proxy type cococraft2.client.ClientProxy into cococraft2.common.CocoCraft2.proxy, but the types don't match
    2012-10-04 15:45:37 [sEVERE] [ForgeModLoader] An error occured trying to load a proxy into {clientSide=cococraft2.client.ClientProxy, serverSide=cococraft2.common.CommonProxy}.cococraft2.common.CocoCraft2
    cpw.mods.fml.common.LoaderException
    at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:61)
    at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:348)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
    at com.google.common.eventbus.EventBus.post(EventBus.java:268)
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:124)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
    at com.google.common.eventbus.EventBus.post(EventBus.java:268)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:81)
    at cpw.mods.fml.common.Loader.loadMods(Loader.java:458)
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:144)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:405)
    at net.minecraft.client.Minecraft.run(Minecraft.java:737)
    at java.lang.Thread.run(Unknown Source)
    2012-10-04 15:45:37 [sEVERE] [ForgeModLoader] Fatal errors were detected during the transition from CONSTRUCTING to PREINITIALIZATION. Loading cannot continue
    2012-10-04 15:45:37 [sEVERE] [ForgeModLoader] 
    FML [Forge Mod Loader] (coremods) Unloaded->Constructed
    Forge [Minecraft Forge] (coremods) Unloaded->Constructed
    CocoCraft2 [CocoCraft2] (bin) Unloaded->Errored
    2012-10-04 15:45:37 [sEVERE] [ForgeModLoader] The following problems were captured during this phase
    2012-10-04 15:45:37 [sEVERE] [ForgeModLoader] Caught exception from CocoCraft2
    cpw.mods.fml.common.LoaderException: cpw.mods.fml.common.LoaderException
    at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:68)
    at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:348)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
    at com.google.common.eventbus.EventBus.post(EventBus.java:268)
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:124)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
    at com.google.common.eventbus.EventBus.post(EventBus.java:268)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:81)
    at cpw.mods.fml.common.Loader.loadMods(Loader.java:458)
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:144)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:405)
    at net.minecraft.client.Minecraft.run(Minecraft.java:737)
    at java.lang.Thread.run(Unknown Source)
    Caused by: cpw.mods.fml.common.LoaderException
    at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:61)
    

     

    Does anybody know how to fix this?

  5. did you remember to register the GUI handler in you MainMod class, Other than that we need the error or issue you are having to help you more.

     

    Yes, I have it registered inmy Main class. There are no errors, but the gui just doesn't open. *sadface*

  6. Hello!

     

    I'm having some issues using the GuiHandler forge adds. I, sort of, copied all the code, changed names around and changed the onBlockActivated to this:

    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player)
    {
    
    	if (!world.isRemote)
            {
                player.openGui(CocoCraft2.instance, 5, world, x, y, z);
                return true;
            }
    
            return true;
    }
    

     

    And my GuiHandler code looks like this:

     

    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) 
    {
    
    	TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
    
    	if (tileEntity != null)
    	{
    		switch(ID)
    		{
    		case 5: return new ContainerCrusher(player.inventory, ((TileEntityCrusher)tileEntity));
    
    		}
    
    	}
    	return null;
    }
    @Override
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
    {
    	TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
    
    	if (tileEntity != null)
    	{
    		switch(ID)
    		{
    		case 5: return new GuiCrusher(player.inventory, ((TileEntityCrusher)tileEntity));
    
    		}
    
    	}
    	return null;
    }
    

     

    Is there something wrong with this code, or is the problem somewhere else?

  7. Hey, I've read the tutorial on the wiki about Achievements, and I added one, but how can I use it with Metadata Items? This is the onSmelting method:

     

     

    @Override

            public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix)

            {

    if (item.itemID == Ingot.shiftedIndex)

                    {

                            player.addStat(SmeltedCoco, 1);

                    }

    }

    but that is not Metadata sensitive, so is there a way to get the Ingot.shiftedIndex metadata sensitive?

  8. I thinks that's because it doesn't understand the common folder thing yet. I'm currently working on someones jenkins, when I'm don't (and it works) I'll post the file here.

     

    Are you almost done? I really want that code :)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.