Posted April 16, 201312 yr I need way to get username in server (same ModLoader.getMinecraftInstance().thePlayer.username; but this sideclient only)
April 16, 201312 yr Author I need way to get username in server (same ModLoader.getMinecraftInstance().thePlayer.username; but this sideclient only)
April 16, 201312 yr 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.
April 16, 201312 yr 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.
April 16, 201312 yr getEntityName? mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
April 16, 201312 yr getEntityName? mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
April 16, 201312 yr 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.
April 16, 201312 yr 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.
April 17, 201312 yr 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
April 17, 201312 yr 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
April 17, 201312 yr how would this be implimented into my code Use examples, i have aspergers. Examples make sense to me.
April 17, 201312 yr how would this be implimented into my code Use examples, i have aspergers. Examples make sense to me.
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.