Jump to content

[1.7.10] How would you give survival mode player an item on Login/Spawn


Recommended Posts

Posted

I want to give the player in survival mode a series of items when the player logs in and when he spawns after death. So far I have tried the following but it doesnt do anything

 

@SubscribeEvent
public void onJoinWorld(EntityJoinWorldEvent event) {
	if (event.entity instanceof EntityPlayer && !event.entity.worldObj.isRemote) {
		PacketOverlord.sendTo(new PacketSyncPlayerStamina((EntityPlayer) event.entity), (EntityPlayerMP) event.entity);
		//System.out.println("This is called # 1");
		if(Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().currentScreen instanceof GuiInventory){
			//System.out.println("This is not called");
	        Minecraft.getMinecraft().thePlayer.inventory.addItemStackToInventory(new ItemStack(CommonProxy.itemCustom1));
				}}
}

 

Not sure what Im doing wrong

Posted

 @SubscribeEvent
public void onPlayerJoin(PlayerLoggedInEvent event)
{
if (!event.player.worldObj.isRemote)
{
	event.player.inventory.addItemStackToInventory(new ItemStack(Items.stick));
}
}

 

Ur welcome

  • 2 years later...
Posted

This post is over 2 years old, and 1.7.10 is no longer supported. You should make sure you are using a recent version, and start a new thread with your issue including code and the fml client latest log

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.