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