MC Modding
Please register and join the community!

How to Generate items in chests

View previous topic View next topic Go down

How to Generate items in chests

Post by TheWerty1124 on Thu Oct 20, 2011 11:58 pm

i would like to know how to get items to generate in a chest if you wouldnt mine makeing a tutorial or some1 explaining to me how this can be done

Admin Edit: Wrong section. Moved to Singleplayer Requests.

TheWerty1124
Member

Posts : 3
Join date : 2011-10-20

View user profile

Back to top Go down

Re: How to Generate items in chests

Post by Static_boy123 on Fri Oct 21, 2011 12:45 am

I could use this tutorial also. It will help me with a banking mod that I am making.
avatar
Static_boy123
Helper

Posts : 32
Join date : 2011-10-19
Age : 17
Location : Eclipse Indigo

View user profile

Back to top Go down

Re: How to Generate items in chests

Post by TheWerty1124 on Sat Oct 22, 2011 4:34 am

yeai need it for a mod im makeing also


TheWerty1124
Member

Posts : 3
Join date : 2011-10-20

View user profile

Back to top Go down

Re: How to Generate items in chests

Post by breakyorself on Sat Oct 22, 2011 6:18 am

This is how notch gets random items into dungeon chests:
Code:
  private ItemStack pickCheckLootItem(Random random)
    {
        int i = random.nextInt(11);
        if(i == 0)
        {
            return new ItemStack(Item.saddle);
        }
        if(i == 1)
        {
            return new ItemStack(Item.ingotIron, random.nextInt(4) + 1);
        }
        if(i == 2)
        {
            return new ItemStack(Item.bread);
        }
        if(i == 3)
        {
            return new ItemStack(Item.wheat, random.nextInt(4) + 1);
        }
        if(i == 4)
        {
            return new ItemStack(Item.gunpowder, random.nextInt(4) + 1);
        }
        if(i == 5)
        {
            return new ItemStack(Item.silk, random.nextInt(4) + 1);
        }
        if(i == 6)
        {
            return new ItemStack(Item.bucketEmpty);
        }
        if(i == 7 && random.nextInt(100) == 0)
        {
            return new ItemStack(Item.appleGold);
        }
        if(i == 8 && random.nextInt(2) == 0)
        {
            return new ItemStack(Item.redstone, random.nextInt(4) + 1);
        }
        if(i == 9 && random.nextInt(10) == 0)
        {
            return new ItemStack(Item.itemsList[Item.record13.shiftedIndex + random.nextInt(2)]);
        }
        if(i == 10)
        {
            return new ItemStack(Item.dyePowder, 1, 3);
        } else
        {
            return null;
        }
    }
Note: You have to generate a chest first.
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: How to Generate items in chests

Post by TheWerty1124 on Sat Oct 22, 2011 5:30 pm

i have that part done its just the items generating in it

TheWerty1124
Member

Posts : 3
Join date : 2011-10-20

View user profile

Back to top Go down

Re: How to Generate items in chests

Post by breakyorself on Sat Oct 22, 2011 5:47 pm

look through the code classes and find the dungeon one that generates the dungeon and look through it.
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: How to Generate items in chests

Post by lcass on Thu Oct 27, 2011 5:43 pm

well breakyourself set it as a void then declare when its being made

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: How to Generate items in chests

Post by breakyorself on Thu Oct 27, 2011 6:12 pm

I`m not trying to make it i`m just giving them a suggestion on how they might find out how to do it.
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: How to Generate items in chests

Post by lcass on Thu Oct 27, 2011 7:10 pm

yer I know its to help them I will try to find the code for them

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: How to Generate items in chests

Post by breakyorself on Thu Oct 27, 2011 7:56 pm

Well you said "Well breakyorself"
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: How to Generate items in chests

Post by lcass on Thu Oct 27, 2011 9:57 pm

Very Happy I know I put it as a suggestion which is just a habbit of mine

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: How to Generate items in chests

Post by maciejkiller on Fri Nov 18, 2011 3:11 am

maybe you should use ShockahAPI

maciejkiller
Member

Posts : 5
Join date : 2011-11-07

View user profile

Back to top Go down

Re: How to Generate items in chests

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum