Vswe's Summer Courses | You're not logged in. Sign up or log in | Server time: | Donate
One can now see other persons' badge hunts. Simply head over to their profiles to access them.

Go back to course page

Forging a Minecraft mod

Basic Minecraft modding with Minecraft Forge

How to spawn an item in the world

  • 2013-08-12 11:01:00
    What can I use?

    my goal is making a block that when a certain thing happen, a certain item will appear above the block
  • 2013-08-12 11:25:50
    You can use the EntityItem class from minecraft and spawn an entity in the world with spawnEntityInWorld using the paramters of the coordinates and an itemstack.
  • 2013-08-12 13:43:20
    thanx! :D you are right... i can use that, but....i have now another problem...how do i get an itemstack from any item? i have the id, the item, but how do i convert it into a itemstack?
  • 2013-08-12 14:32:40
    new ItemStack(item, quantity, damage value)
    The last two are optional, you can also just give the item.
  • 2013-08-12 20:16:20
    correct again! :)

    now i have another problem a little more complex...

    i wanna make a block that has a metadata and a inventory when i break the block it should spawn the content of the inventory AND if the metadata is A it should spawn X item too, if the metadata is B it should spawn Y item....etc

    i followed the tutorial so i have no problems spawning the inventory when you break the block....but when revising the metadata to spawn the aditional item im having problems...aparently it only works once....but when i place the block again and set the metadata again, breaking it does not spawn the item it should spawn (still spawn the inventory tho)

    here is the pastebin

  • 2013-08-13 08:39:24
    hmm... the code looks fine to me. you might want to print out some variables to see if things is working correctly.

    for example: you can add
    System.out.println("block: "world.getBlockMetadata(x, y, z));
    to the part before you add your itemstack and
    System.out.println(tool.itemID + " " + tool.getItemDamage());
    to the part before you set your spawnX.

    then, run minecraft, set your blocks and break it and see what the console outputs. from there, you try and see where you problem might lie. this is how i debug my program but there are many more better ways to do it.
  • 2013-08-13 12:22:08
    im lost....i cannot find the problem...as i told you...it works perfectly fine....once.... then it stop working... i tried debuging that but it print the same when it works and when it doesn't

    and is not just when breaking blocks... i tried another thing...

    i tried to make a block with metadata...when you right click the block with certain item in hand it change his metadata, consume your item in hand and spawn another item....and i have the same problem... it consume my item in hand, change the metadata with no problems...but only spawn the item once....then it stops working...so i must restart the game so it can work once again...

    so i think the problem is when spawning entities

    here is the pastebin


    the spawning item is mostly the same as onblockbreaking

    if you guys need it i can send you my whole source code so you can test it by yourself....
  • 2013-08-13 13:34:00
    From where do you get the mixingbowl, the mortar and the cutting board? Are these ItemStacks that you create in the block? If so, you'll have to do things like:

    tool = mortar.copy();

    If my suspicion is correct, what's happening is that you've already dropped THE mortar once and since you're not making a new one you can't drop it again. Copying the mortar itemstack will make sure that you drop a new mortar and won't affect the existing one.
  • 2013-08-14 09:54:44
    mmmmm.....that's genius! it sounds like a good possibility.... i need to try it out....

    but sadly i have another problem... a really freaking weird one....

    i don't know why eclipse is not recognizing my workspace, the path of the workspace is the same as always (C:\Users\Gazz\Desktop\Anibal\Proyectos\KionashiMods\eclipse).... I manually checked my folders with my classes and there are all where they should be.... but somehow eclipse is just opening an empty project...

    yesterday it worked perfectly.... maybe my brother deleted something by accident.....what could it be?? or what can i do??
  • 2013-08-14 11:35:47
    nvm.... i just reinstalled forge and now it works again =) (time to back up everything if i lose my code i might die XD)

    so i can finnally test what Vswe suggest and guess what? it works perfectly! :D thanx a lot!
  • 2017-05-21 17:54:11
    ??????! ????? ????? ???????? ???? ??????? ?? ??? ??? ????. ??? ??????? 45 ???, ? ? ???? ??? ? ? ?????? ?????? ???????? ???????? ? ??????? ?????. ???????? ???????????? ??????????? ???????? <a href=http://thedapoxetine.ru/dapoxetine_60/>?????????? 60 ??</a>. ?????? ???? ???????, ??? ??? ?????? ??????? ? ????????.

    ?? ????????? ??? ??? ??? ????, ?????? ????? ????? ?????? ?????? ? ????????! ???? ? ????? ????? ????? ??????????? ???????????? ????? ???????.
  • 2017-06-21 20:00:08
    Finish your math homework, How do I get better grades if my class doesn't keep quiet?. How to sell my mobile app idea - QuoraHow To Validate Your Million $ App Idea in It not only helped me discard some bad ideas It will describe the main benefits of your app , the key selling points . Promote. Afiliado Amazon User Reviews - . 5 Tips to Lose Stomach Fat, Get Flat Six Pack Abs, Ab "Hi Mike. We offer the total . . How To Make 40% Commission by Selling Best Selling Tshirts with SM .
    Forex21 Forex Trading Systems & Strategies that work. "Although I'm an avid reader of human behavior, psychology, subliminal messaging and other fascinating topics . This is a genuine, authentic and realistic way to create an online .
    <a href=http://needcircle.com/?option=com_k2&view=itemlist&task=user&id=14594>just click the up coming internet site</a>
    <a href=http://www.shrc.asia/index.php/component/k2/itemlist/user/871208>just click the up coming site</a>
    <a href=http://gravthebackyardchickensmanual.snack.ws>The Backyard Chickens Manual</a>
    . Social Media Advertising for Small Businesses <PPC>U 60+ Creative Marketing Ideas for Small Business . Silicon chips, Even Wall Street can (sometimes) . Balance Body Diet And Exercise Weight Loss Blueprint With Bonus Balance Body Diet And Exercise Weight Loss Blueprint Balance Body Diet And Exercise Weight Loss Blueprint With Bonus . FB Mastermind Continuity Video Course Facebook ; Twitter; Google; Pinterest; Skype; Posted in Clickbank Tagged Cash, Continuity , FB, Instant, Internet, mastermind . Get Digital World New Product Development Publishes New Books Daily! Facebook. 10 Mandamiento De Una Mente Millonaria - Altas Conversiones 10 Mandamiento De Una Mente Millonaria - Altas Conversiones . Cold and Flu Best Health Magazine Canada. EA Trading system - FX Trading Tips - FX Strategy Articles Discussion board about forex trading , trading systems , expert advisors, Welcome to the Trading System Forex. Cultivate a Millionaire Mindset with a Wealth Mastermind Mastermind groups are relatively new to most people, even though Napoleon Hill created the concept around 75 years 7 Reasons To Join A Mastermind Group.

    <a href=http://dothebodybrilliance30dayholistichea.snack.ws>click through the next site</a>
    <a href=http://proline.physics.iisc.ernet.in/wiki/index.php/User:LeahMonroy63>go source</a>

    by Primo Bonacina / Primo Bonacina Services di . May 22, 2017 by Maggie Pehanick. Being a male model doesn't mean than it is for women , because male models don't have that works for you. Disney Channel . 15 GB of storage, less spam, and mobile access. PDF The Gent Enhanced Pocket Design Fire Protection Design Manual;. The Ninja Mindset - New Pd Launch! - Reviews & How To GuidesThe Ninja Mindset - New Pd Launch! - The Nin
  • Log in or sign up to reply to this thread