Jump to content

SilentThief

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by SilentThief

  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.
  15. @Mecblader Thank you for your suggestion, I will try hash maps if I don't find a better solution to this. @AlexStone There are a few issues with that code. 1. Where are you getting itemList from? 2. Where are you getting r.next from? I'm guessing r.nextInt();
  16. I know basic Java. Just very new to modding, don't know how everything works. And yes, I know itemRand isn't an item. I will take your advice and use the object to grab all of the registered items in Minecraft.
  17. This item is essentially a "reward bag", when you right click the item, it deletes the bag, and gives you a random item. I personally have no idea how to do this, since the itemRand in the Item class cannot be using in the ItemStack method.
  18. So, there's no way to make an ItemStack have a random item set to it, each time it's ran?
  19. Hello, I am having a bit of trouble giving the person right clicking my item, a random item out of the Minecraft Vanilla Items. Here's my code so far: public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) { if (entityPlayer.capabilities.isCreativeMode) { return itemStack; }else { --itemStack.stackSize; entityPlayer.inventory.addItemStackToInventory(new ItemStack(itemRand, 1)); } return itemStack; } } itemRand is a variable inside of the Minecraft Item class.
  20. Is it possible to specify which side of a block does not render in code, without having to make 47 different textures for one blocks?
  21. Hey, I am having a few issues with my mod, can't figure out what to do about blockID and itemID, I have the following code: package apex.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class MagicOre extends Block { public MagicOre(Material material) { super(material); setHardness(3.0F); setStepSound(soundTypeStone); setCreativeTab(CreativeTabs.tabBlock); setBlockTextureName("apex:magic_ore"); setBlockName("magicOre"); } public int idDropped(int par1, Random par2Random, int par3){ int drop = par2Random.nextInt(7); if (drop == 0){ return apex.ApexCore.whiteDust.itemID; }else if (drop == 1){ return apex.ApexCore.blueDust.itemID; }else if (drop == 2){ return apex.ApexCore.purpleDust.itemID; }else if (drop == 3){ return apex.ApexCore.brownDust.itemID; }else if (drop == 4){ return apex.ApexCore.magicDust.itemID; }else if (drop == 5){ return apex.ApexCore.pinkDust.itemID; }else if (drop == 6){ return apex.ApexCore.redDust.itemID; }else{ return apex.ApexCore.yellowDustA.itemID; } } @SideOnly(Side.CLIENT) protected boolean canSilkHarvest(){ return true; } //Drops 3-8 XP Orbs on block break. public void dropBlockAsItemWithChance(World world, int par2, int par3, int par4, int par5, float par6, int par7){ super.dropBlockAsItemWithChance(world, par2, par3, par4, par5, par6, par7); if (this.idDropped(par5, world.rand, par7) != this.blockID){ int j1 = 0; j1 = MathHelper.getRandomIntegerInRange(world.rand, 3, ; this.dropXpOnBlockBreak(world, par2, par3, par4, j1); } } } For my items I have itemID, and blockID, there are no more IDs, so what do I change them to?
  22. Hello everyone, as you all know, a recommended version of Minecraft Forge has came out for Minecraft version 1.7.2! While this is great and all, there is still some people that don't know how to set-up your development environment. The current tutorial that is out is outdated and does not give correct information, a little bit of stuff has changed since that tutorial for Forge Gradle came out. So, let us get started. Requirements: 1. Minecraft Forge for 1.7.2 Find it here: http://www.minecraftforge.net/forum/index.php?action=files You will also need eclipse, which is quite obvious. Installation: Windows Users: 1. Once you have downloaded the zip file, extract it into any folder. This will make a whole bunch of files, don't click gradlew.bat. 2. Press SHIFT and RIGHT-CLICK in the folder where you extracted Forge Gradle. Then click "Open Command Window Here". 3. Once you have your command windows open, type the following (Once at a time!): gradlew.bat setupDecompWorkspace then once that has finished, type: gradlew.bat eclipse That's all you need to do for windows! Mac Users: Run the following in terminal: ./gradlew setupDecompWorkspace then ./gradlew eclipse Setting up your environment: 1. Now, open Eclipse. Point your project directory to the eclipse folder inside of the forge directory. Once you have done that, in your Eclipse IDE editor, go to Help > Eclipse Marketplace and search for Gradle and install the second one on the list! 2. After you have installed the Gradle plug-in, go to File > Import > Existing Projects into Workspace and select your root forge directory. (The folder you extracted Forge Gradle into in the beginning.) 3. Make sure the project is selected and then click FINISH! Making It Run: 1. Go to Run > Run Configurations 2. Right Click "Java Application" and click "New". 3. Once you have done those steps, set the name of the first Configuration to "Run Client". 4. Next, type the following - Main Class: net.minecraft.launchwrapper.Launch 5. Go to the "Arguments" Tab and type the following - Program Arguements: --version 1.7.2 --tweakClass cpw.mods.fml.common.launcher.FMLTweaker --accessToken FML VM Arguments: -Dfml.ignoreInvalidMinecraftCertificates=true 6. Then Click "Apply" and "Run". (This should start Minecraft 1.7.2) 7. Close Minecraft and make another "Java Application", this time call it "Run Server". 8. This time set the Main Class to: cpw.mods.fml.relauncher.ServerLaunchWrapper 9. Click "Apply", there is no need to run this. And there are no Arguments needed either! Well, you're done, everything should work fine now, if you get any errors, don't post them here, this is not a help thread! Thanks to: GrygrFlzr (Creating the initial tutorial thread)
  23. @lexwebb, Sorry wasn't thinking 100% my bad. Still new to modding.
  24. EntityRegistry.registerModEntity(EntityBeam.class, "EntityBeam", 23, this, 128, 1, false); Using "EntityBeam.class" grabs a compiled class file not a java file, I think you need to just use "EntityBeam" (w/o the quotes). or EntityBeam.java (which I don't think is right)
×
×
  • Create New...

Important Information

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