ratepenade
Members-
Posts
3 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
ratepenade's Achievements
Tree Puncher (2/8)
0
Reputation
-
Random description in addInformation blinking
ratepenade replied to ratepenade's topic in Modder Support
Yes -
Hey, I tried to display a random item description among a pre-defined message list. It doesn't works so much well because instead of displaying one message, the description is blinking, displaying all the predefined messages at each second. Here is my code : @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { String[] randMessages = new String[]{"Alpha", "Bravo", "Charlie"}; String randMessage = randMessages[player.getRNG().nextInt(randMessages.length)]; list.add(EnumChatFormatting.RED + randMessage); } Does anyone know the solution? Thank you so much, Best regards
-
Hey, I would like to display a random item description among a predefined words list. I tried that : import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; public class ItemTest1 extends Item { public ItemTest1() { this.maxStackSize = 1; } public void addInformation(ItemStack stack, World world, EntityPlayer player, List list, boolean par4) { if(!world.isRemote) { String[] randMessages = new String[]{"Alpha", "Bravo", "Charlie"}; String randMessage = randMessages[world.rand.nextInt(randMessages.length)]; list.add(EnumChatFormatting.RED + randMessage); } } } But it doesn't seem to works.. Any idea ? Thank you very much for your help