Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I need way to get username in server

(same ModLoader.getMinecraftInstance().thePlayer.username; but this sideclient only)

 

  • Author

I need way to get username in server

(same ModLoader.getMinecraftInstance().thePlayer.username; but this sideclient only)

 

i am also wondering this as i have

 

@ForgeSubscribe
	public void onDeath(LivingDeathEvent e){
	if(e.entity instanceof EntityPlayer && !e.entity.worldObj.isRemote){
	Entity killed = e.entity;
	Entity killer = e.source.getEntity();
		Random randomGenerator = new Random();
		int ran = randomGenerator.nextInt(25);
				if (ran == 1 ||ran == 2 ||ran == 3 ||ran == 4 ||ran == 5 ||ran == 6 ||ran == 7){
	killed.dropItem(ashtonsmod.Manure.itemID, 1);}
				if (ran == 8 ||ran == 9 ||ran == 10 ||ran == 11 ||ran == 12 ||ran == 13 ||ran == 14){
	killed.dropItem(Item.bone.itemID, 1);}
				if (ran == 20 ||ran == 21 ||ran == 22 ||ran == 23 ||ran == 24){
	killed.dropItem(ashtonsmod.Flesh.itemID, 1);}
				if (ran == 25){
	ItemStack charskull = new ItemStack(Item.skull, 1, 3);
	killed.entityDropItem(charskull, 1);}
		if (ran < 26){
			if (USERNAME == "ashtonr12"){
			killed.dropItem(Item.diamond.itemID, 1)
		}}
	}}

 

where do i get the username of the player entity that died from?

 

sorry if you think i am stealing your thread bu i thought it was related and if my problem can be solved then yours can only be similar :)

Use examples, i have aspergers.

Examples make sense to me.

i am also wondering this as i have

 

@ForgeSubscribe
	public void onDeath(LivingDeathEvent e){
	if(e.entity instanceof EntityPlayer && !e.entity.worldObj.isRemote){
	Entity killed = e.entity;
	Entity killer = e.source.getEntity();
		Random randomGenerator = new Random();
		int ran = randomGenerator.nextInt(25);
				if (ran == 1 ||ran == 2 ||ran == 3 ||ran == 4 ||ran == 5 ||ran == 6 ||ran == 7){
	killed.dropItem(ashtonsmod.Manure.itemID, 1);}
				if (ran == 8 ||ran == 9 ||ran == 10 ||ran == 11 ||ran == 12 ||ran == 13 ||ran == 14){
	killed.dropItem(Item.bone.itemID, 1);}
				if (ran == 20 ||ran == 21 ||ran == 22 ||ran == 23 ||ran == 24){
	killed.dropItem(ashtonsmod.Flesh.itemID, 1);}
				if (ran == 25){
	ItemStack charskull = new ItemStack(Item.skull, 1, 3);
	killed.entityDropItem(charskull, 1);}
		if (ran < 26){
			if (USERNAME == "ashtonr12"){
			killed.dropItem(Item.diamond.itemID, 1)
		}}
	}}

 

where do i get the username of the player entity that died from?

 

sorry if you think i am stealing your thread bu i thought it was related and if my problem can be solved then yours can only be similar :)

Use examples, i have aspergers.

Examples make sense to me.

getEntityName?

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

getEntityName?

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

example?

i tried this and this now work;

public String EName;
public String getEntityName() {
	return EName;
}


@PreInit
	@ForgeSubscribe
	public void onDeath(LivingDeathEvent e){
	if(e.entity instanceof EntityPlayer && !e.entity.worldObj.isRemote){
	Entity killed = e.entity;
	Entity killer = e.source.getEntity();
		Random randomGenerator = new Random();
		int ran = randomGenerator.nextInt(25);
		if (EName == "ashtonr12"){
			ItemStack GA = new ItemStack(Item.appleGold, 1, 1);
			killed.entityDropItem(GA, 1);}
		else{
				if (ran == 1 ||ran == 2 ||ran == 3 ||ran == 4 ||ran == 5 ||ran == 6 ||ran == 7){
	killed.dropItem(ashtonsmod.Manure.itemID, 1);}
				if (ran == 8 ||ran == 9 ||ran == 10 ||ran == 11 ||ran == 12 ||ran == 13 ||ran == 14){
	killed.dropItem(Item.bone.itemID, 1);}
				if (ran == 20 ||ran == 21 ||ran == 22 ||ran == 23 ||ran == 24){
	killed.dropItem(ashtonsmod.Flesh.itemID, 1);}
				if (ran == 25){
	ItemStack charskull = new ItemStack(Item.skull, 1, 3);
	killed.entityDropItem(charskull, 1);}
		}}
	}

Use examples, i have aspergers.

Examples make sense to me.

example?

i tried this and this now work;

public String EName;
public String getEntityName() {
	return EName;
}


@PreInit
	@ForgeSubscribe
	public void onDeath(LivingDeathEvent e){
	if(e.entity instanceof EntityPlayer && !e.entity.worldObj.isRemote){
	Entity killed = e.entity;
	Entity killer = e.source.getEntity();
		Random randomGenerator = new Random();
		int ran = randomGenerator.nextInt(25);
		if (EName == "ashtonr12"){
			ItemStack GA = new ItemStack(Item.appleGold, 1, 1);
			killed.entityDropItem(GA, 1);}
		else{
				if (ran == 1 ||ran == 2 ||ran == 3 ||ran == 4 ||ran == 5 ||ran == 6 ||ran == 7){
	killed.dropItem(ashtonsmod.Manure.itemID, 1);}
				if (ran == 8 ||ran == 9 ||ran == 10 ||ran == 11 ||ran == 12 ||ran == 13 ||ran == 14){
	killed.dropItem(Item.bone.itemID, 1);}
				if (ran == 20 ||ran == 21 ||ran == 22 ||ran == 23 ||ran == 24){
	killed.dropItem(ashtonsmod.Flesh.itemID, 1);}
				if (ran == 25){
	ItemStack charskull = new ItemStack(Item.skull, 1, 3);
	killed.entityDropItem(charskull, 1);}
		}}
	}

Use examples, i have aspergers.

Examples make sense to me.

  • Author

thx all reply. now i can get username in server

How to : i use modloader.getinstance.thePlayer.username(); in client and send packet to server :)

  • Author

thx all reply. now i can get username in server

How to : i use modloader.getinstance.thePlayer.username(); in client and send packet to server :)

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.