Jump to content

Idk


ejer

Recommended Posts

public class Coins {
    @SubscribeEvent
    public void xd(ClientChatReceivedEvent event) {
        String message = event.message.getUnformattedText();
        //message is the message which the client receives.
        if(message.startsWith("+") && message.contains("coins") && !message.endsWith("for being generous")) {
            //Checks if the coin message you got isn't the tip message   
            String[] splittedMessage = message.split("coins");
            message = splittedMessage[0].replace("+", "");
            message = message.replace(" ", "");
            int coins = Integer.parseInt(message);
            int totalCoins = 0;
            totalCoins = totalCoins + coins;
        }
    }
    @SubscribeEvent
    public void render(RenderGameOverlayEvent event) {
        if (event.isCancelable() || event.type != ElementType.EXPERIENCE) {
            return;
        }
        FontRenderer fRender = Minecraft.getMinecraft().fontRendererObj;
        fRender.drawString(EnumChatFormatting.GREEN + "Coins: " + EnumChatFormatting.WHITE + totalCoins, 5, 5, 0);
    }
}

totalCoins = totalCoins + coins;

totalCoins cannot be resolved to a variable

 

fRender.drawString(EnumChatFormatting.GREEN + "Coins: " + EnumChatFormatting.WHITE + totalCoins, 5, 5, 0);

totalCoins cannot be resolved to a variable

Edited by ejer
Link to comment
Share on other sites

            int totalCoins = 0;
            totalCoins = totalCoins + coins;

Wot

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

On 11.11.2017 at 8:43 PM, Differentiation said:

wtf is this?

Do you even know how to handle variables? Where did you get this code from?

Again, you should learn some basic Java before starting your project.

lol idk its not my project its from a forum post i just wanted to know whats wrong ;p

https://hypixel.net/threads/guide-start-coding-minecraft-forge-mods.551741/

(scroll down to the very bottom of the first post)

Link to comment
Share on other sites

On 11.11.2017 at 0:31 PM, Ugdhar said:

Do a bit of reading on variable scope.

You can't declare a variable in one method, and have it accessible in another method.

yea i thought of that bc the other method doesnt even know what "total coins" is...

Link to comment
Share on other sites

5 hours ago, ejer said:

lol idk its not my project its from a forum post i just wanted to know whats wrong ;p

https://hypixel.net/threads/guide-start-coding-minecraft-forge-mods.551741/

(scroll down to the very bottom of the first post)

Hypixel Moderators aren't better than Forge experts in code :P because "int totalCoins = 0;    totalCoins = totalCoins + coins;" is blatantly wrong.

Edited by Differentiation
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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