Jump to content

Recommended Posts

Posted

My description for my item keeps updating but i want it to stay static so i can save it in nbt.

 

here's my code:

 

 

package com.azureusnation.mod.cards.common;

 

import java.util.List;

import java.util.Random;

 

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.world.World;

 

import com.azureusnation.mod.lib.Name;

import com.azureusnation.mod.lib.cards.Description;

import com.azureusnation.mod.lib.cards.Duration;

import com.azureusnation.mod.lib.cards.Icon;

import com.azureusnation.mod.lib.cards.Rarity;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class MoreHearts extends Item

{

    Random random = new Random();

 

    public MoreHearts(int id)

    {

        super(id);

        this.setUnlocalizedName(Name.moreHearts_unlocalizedName);

        this.setMaxStackSize(16);

        this.setCreativeTab(CreativeTabs.tabMisc);

    }

 

    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)

    {

        if (!par2World.isRemote)

        {

            if (!par3EntityPlayer.capabilities.isCreativeMode)

            {

                --par1ItemStack.stackSize;

            }

 

            par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76434_w.id, 300, 2));

        }

 

        return par1ItemStack;

    }

 

    @SideOnly(Side.CLIENT)

    public boolean hasEffect(ItemStack par1ItemStack)

    {

        return false;

    }

 

    @SideOnly(Side.CLIENT)

    public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)

    {

        par3List.add(Rarity.Common);

        par3List.add(Duration.Common + "0:15");

        par3List.add(Description.getDescription());

    }

 

    @Override

    @SideOnly(Side.CLIENT)

    public void registerIcons(IconRegister icon)

    {

        itemIcon = icon.registerIcon(Icon.Common);

    }

}

 

 

 

 

 

 

package com.azureusnation.mod.lib.cards;

 

import java.util.Random;

 

public class Description {

 

private static Random random = new Random();

 

public static String getDescription() {

return text[random.nextInt(text.length)];

}

public static String text [] = {

"א ביי געזונט",

"אַלט קאַקער",

"איז-ייי-ייי",

"באַלאַבוסטאַ",

"צו מיר ריא זענען שייַן",

"בערריער",

"ביססעל",

"באָבבעמיסעה",

"בויטשיקק",

"בראָש",

"באַבאַ",

"בובבאַלאַ",

"בופּקעס",

"טשייַאַ",

"טשאַזערעי",

"כוצפּאַ",

"מאַק",

"עס",

"פייַגאַלאַ",

"פערבלונדזשיט",

"פערקאָקקט",

"פערדרייַט",

"פאַרפּיטזס",

"פערמישט",

"פערשלוגינאַ",

"פערשטייַ",

"פערשטינקינער",

"פערטוממעלט",

"עסן",

"גאַוואַלט",

"געי אַוועק",

"זינטאַ האַס געי גאַ",

"געי שלאַפען",

"געלט",

"גאָניף",

"גוי",

"גרעפּסע",

"גאָרנישט",

"הייַמיש",

"א האָק טשאַיניק",

"קיביטז",

"טשיינאַ-אַהאָראַ",

"קישקאַ",

"קלאַץ",

"קאָשער",

"קוועלל",

"קוועטש",

"לאָך אין יינגל",

"לופטמענש",

"לוזזעם",

"מאַטש שנעל",

"מאָווערס",

"מייוואַן",

"מאַזעל טוב",

"מעעסאַ מאַשעענאַ",

"מעעסקאַיט",

"מעגיללאַה",

"מענטשן",

"מעשוגגינאַ",

"מישעגאָסס",

"מישפּאָטשאַ",

"מאָמזער",

"מוילעס",

"נאָך אַ מאָאָל",

"נאַטשעס",

"נאַפקאַ",

"נאַררישקעיט",

"נעבביש",

"נאָאָדגע",

"נאָש",

"נו",

"נודניק",

"אָנגעפּאָטטשקעט",

"וי יוי-יוי",

"וי וויי",

"פּישער",

"פּלאַץ",

"פּאָטטשקאַ",

"פּופּíק",

"טינק",

"ראַטשמאָנעס",

"סייַכעל",

"שלאַק",

"שמאַלץ",

"צירונג",

"שאַדכען",

"שאַנדאַ",

"שייַגעץ",

"שייַנער",

"שיקסאַ",

"שלעמיעל",

"שלעפּ",

"שלימאַזל",

"שמענדריקק",

"שמעגעגגע",

"שמאַטטאַ",

"שמעער",

"שמאָאָז",

"שמוטזיק",

"שנאָררער",

"שנאָז",

"שטעטל",

"שטיק",

"שטונק",

"שטופּ",

"שוויטז",

"שוואַנטז",

"שפּיל",

"טטשאָטטשקאַ",

"צעטוממעלט",

"ציממעס",

"צאָריסס",

"צוטטשעפּפּעניש",

"שטאָף",

"טוממעל",

"ונגאַבלוזום",

"ווער קלעמפּט",

"וווס מאַטש דאַ",

"יענטאַ",

"יענטז",

"זאַפטיג",

"קדי גאַ צינק",

"זעטז",

"זיידע",

"זשלוב"

};

 

}

 

 

 

Posted

I'd ask you to go look into basic java because you have coded it to vary, if you want it differently then make the code not vary the description and just set it during construction...

 

If that did make sense to you, gogo fix, else then go look into programming basics :)

If you guys dont get it.. then well ya.. try harder...

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.

Announcements



×
×
  • Create New...

Important Information

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