Jump to content

SilentThief

Members
  • Posts

    31
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

SilentThief's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Look at the furnace class, there are two stages that is renders, idle and cooking, look around at what happens in-between those two rendering stages. I'm sure you'll find your answer, if I'm correct.
  2. Didn't think to do it that way...guess I wasn't thinking you could create an ItemStack variable. It did indeed work, thank you very much.
  3. If I understand correctly - 1. Set Waypoint A (Bed A) 2. Set Waypoint B (Bed B) 3. Sleep in either Bed A or Bed B, and whichever one you sleep in, you get teleported to the other one? Here are a few ideas - 1. Save waypoint a and b in a config file. 2. Teleportation from a or b, or b to a. That's basically what you will want to have. If you want the player to be teleported while sleeping, and when teleported, still sleeping, that will be a bit tricky, or will work the first time.
  4. Recursion is a good idea, I will try and figure out a way to incorporate that without creating a loop that will throw stack traces. But, that's for making the method run once an argument is true or false, or equal to something, I don't know what to do to check if the items I want banned, will be not drawn from the pool of items. Because I can't use - if (getRandomItem == (new ItemStack(Blocks.portal) { getRandomItem(); } or if (ItemStack == (new ItemStack(Blocks.portal) { getRandomItem(); }
  5. No no no, that isn't the code. Those item stacks listed are just the items that are going to be banned. There is no code for the blacklist yet.
  6. Hello MCF community! I have a little issue with 'black-listing items', from appearing when I right click this item. This item gives the player a random item, block, etc, out of the pool of items that minecraft provides. I have tried to make it so certain items don't appear in the pool. I have tried creating array lists of all of the items in Minecraft, also tried simply creating itemstacks and then doing a switch statement saying if they appear, the action will loop, no luck there. So, I'd like a little bit of help if possible. package com.rien.nn.items; import java.util.List; import java.util.Random; import com.rien.nn.Main; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemLootBag extends Item { public ItemLootBag() { this.setUnlocalizedName("itemLootBag"); this.setTextureName("niknaks:itemLootBag"); this.setCreativeTab(Main.NNTab); this.setMaxStackSize(16); } public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { //Banned Items ItemStack netherPortalBlock = new ItemStack(Blocks.portal); ItemStack endPortalBlock = new ItemStack(Blocks.end_portal); ItemStack endPortalFrame = new ItemStack(Blocks.end_portal_frame); ItemStack fireBlock = new ItemStack(Blocks.fire); ItemStack waterBlock = new ItemStack(Blocks.water); int min = 1; int max = 3; Random r = new Random(); int randNum = r.nextInt(max-min) + min; if (player.capabilities.isCreativeMode) { player.dropPlayerItemWithRandomChoice(new ItemStack(getRandomItem(), randNum), false); return item; } else { --item.stackSize; player.dropPlayerItemWithRandomChoice(new ItemStack(getRandomItem(), randNum), false); return item; } } static Random rand = new Random(); public static Item getRandomItem() { Item i = null; int length = Item.itemRegistry.getKeys().toArray().length; Object select = Item.itemRegistry.getObjectById(ItemLootBag.rand.nextInt(length)); if(select != null && select instanceof Item) { i = (Item) select; } else { return getRandomItem(); } return i; } }
  7. @ruabmbua I can perfectly capable of creating the energy system, just needed an explanation of how it'd work. @jabelar Thank you very much for the explanation, it will help me out with this. Question: Is there any references that would help me with this also?
  8. Hello, I would like to know how I'd start creating an energy system like the one Thermal Expansion, AE, Etc. has. Such as: Create Energy > Store Energy > Send Energy > Receive Energy > Store Energy > Do Something With the Energy or Create Data > Store Data > Send Data > Receive Data > Store Data > Do Something with the Data How would I get started with that exactly?
  9. Sorry, was spacing out, was like 2AM when I looked at that code.
  10. I got confused on that UtilRF.RANDOM part, I wasn't thinking...lol Didn't know UtilRF was the class. lol Anyways, testing the code. Doesn't seem as if the code is working, does nothing actually, here is my class: package com.hex.lootbag; import java.util.Random; import com.hex.hexcore.HexCore; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemLootBag extends Item { public ItemLootBag() { setUnlocalizedName("itemLootBag"); setCreativeTab(CreativeTabs.tabAllSearch); setTextureName("lootbag:ItemLootBag"); setMaxStackSize(1); } public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { System.out.println("Working!"); if (player.capabilities.isCreativeMode) { getRandomItem(); return item; }else{ --item.stackSize; getRandomItem(); return item; } } static Random RANDOM = new Random(); public static Item getRandomItem() { Item i = null; int length = Item.itemRegistry.getKeys().toArray().length; Object select = Item.itemRegistry.getObjectById(ItemLootBag.RANDOM.nextInt(length)); if(select != null && select instanceof Item) { i = (Item) select; } else { return getRandomItem(); } return i; } }
  11. When you right click this bag, I want it to give you 1 item. The item is chosen from every single item in the game, it would be much more convenient to not have to make 300+ item stacks.
  12. For some reason it returns it everytime. And, why is there: UtilRF.RANDOM.nextInt()? Instead of UtilRF.nextInt()
  13. If you return getRandomItem(); it ends up creating a loop crashing the game. Removing it causes the whole method to do nothing.
  14. Yea, using a random each time crashes the game. I tried using the code AlexStone provided, with a custom itemList I created. It does crash the game. Even if I were to do: ItemStack stack = new ItemStack(ItemList.itemList[r.nextInt()]; It would still end up crashing the game. I will try a few other things, see if they work.
×
×
  • Create New...

Important Information

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