Jump to content

Recommended Posts

Posted

Hey !

 

I need to generate items in chests, but it's not working. Here is what I've done:

 

 public void chestLoots()
    {
    	ChestGenHooks mineshaft = ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR);
	ChestGenHooks nether = ChestGenHooks.getInfo(ChestGenHooks.NETHER_FORTRESS);
	ChestGenHooks sh_couloir = ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR);
	ItemStack ame_loot = new ItemStack(ame);

	//	addItem(Item, min, max, chances)
	//	NB:Les chances de spawn du pain sont de 100

	mineshaft.addItem(new WeightedRandomChestContent(ame_loot, 1, 1, 1));
	nether.addItem(new WeightedRandomChestContent(ame_loot , 1, 10, 9001));
	sh_couloir.addItem(new WeightedRandomChestContent(ame_loot, 1, 1, 20));
    }

 

and :

 

@EventHandler
    public void init(FMLInitializationEvent event)
    {
	chestLoots();
    }

 

But it's not generating. You can see the chances are over 9000 in the nether, so this is not the problem.

 

Thank you for your help !

 

Posted

Simply

ChestGenHooks.getInfo(ChestGenHooks.BONUS_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ItemsHandler.InfiniteFruit), 1,1,20));

 

Works for me.

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

Posted

What version of forge are you running? I'm in 1.7.10 and there is no ChestGenHooks.NETHER_FORTRESS for me.

Posted

Ho, yeah, should have precised. I'm using forge 1.8.

 

I'm using the version 1.8-11.14.1.1402, but I just saw the version Build 1.8-11.14.1.1404 added

 

Initialized the Nether Fortress chest loot

 

Forced the nether fortress chest loot to initialize in ChestGenHooks

like the other types.

 

Changed tabs to spaces. Silly Eclipse.

 

Maybe I should use the latest version. Is there any way to do it easily ?

Posted

download it, extract it, gradle it and throw your old code inside the src

Don't do it that way! It is much easier! Open your
build.gradle

file and change the version number. Then rerun

gradlew setupDecompWorkspace eclipse

. This is the intended way to update Forge.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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