Jump to content




[Modding] Get name of who uses the computer.


10 replies to this topic

#1 K-dence

  • Members
  • 8 posts
  • LocationOverworld

Posted 12 March 2013 - 02:50 PM

Hi!
I create a peripheral and i need to get the username of who uses the computer. It's possible? If yes, how?

Sorry for my bad english :P

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 12 March 2013 - 04:27 PM

Split into new topic.

Which user? A computer can be interacted with by multiple people.

Perhaps this topic would be better suited to the peripheral help section. I think I shall move it in a while.

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 12 March 2013 - 04:38 PM

You could poll Minecraft for the players within a 1 block radius of the peripheral block. But I am unaware of a method to find out what they are interacting with, so you wouldn't know if they were using the computer or just standing near it. Also another problem would be if they were interacting with a monitor as that can be done 3 blocks away from it.

#4 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 12 March 2013 - 04:51 PM

I was thinking about this the other day (Someone was screwing with my computer when I was coding), why not make private computers? However, i'm not entirely sure you can do this. What if two users click in at once? What if a user crafts a private computer but another user clicked into it first? Should it detect the owner upon crafting? Can you detect owners upon crafting? Like I said, i'm not even sure if you can detect who is using the computer at the current time. Maybe through a new event? Although that would call for serious background coding.

#5 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 12 March 2013 - 05:13 PM

You cannot get the owner on crafting. It would have to be done on first open like IC2 personal safe.

#6 ChunLing

  • Members
  • 2,027 posts

Posted 12 March 2013 - 06:26 PM

PDA's (whenever they arrive) will probably only be usable by the player holding the item. So that solves that problem. But not the OP's question.

#7 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 12 March 2013 - 06:30 PM

View PostTheOriginalBIT, on 12 March 2013 - 05:13 PM, said:

You cannot get the owner on crafting. It would have to be done on first open like IC2 personal safe.
There lies the problem...

#8 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 12 March 2013 - 06:50 PM

View PostSuicidalSTDz, on 12 March 2013 - 06:30 PM, said:

There lies the problem...
It's minecrafts fault.

the crafting container is what 'crafts' the item, not the player, the player supplies the items, the recipe manager for the crafting container checks the item and puts it in the output. so code base wise the player is never involved in the process. so if you could get the entity that crafted the item it would always be the 'crafting bench' entity.

#9 ScruffyRules

  • Members
  • 98 posts

Posted 12 March 2013 - 09:35 PM

for the block you could ask RichardG how he did his player detector and for the crafting there might be a way because mystcraft uses the coords of the player surely you could get the name aswel.

#10 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 12 March 2013 - 11:15 PM

Mystcraft is different. On crafting it uses the crafting bench coord, or the player coord when using the internal crafting bench, which is different than getting the player name on crafting.

#11 K-dence

  • Members
  • 8 posts
  • LocationOverworld

Posted 12 March 2013 - 11:55 PM

Thanks!
Finally, i save the owner of my peripheral with onBlockPlacedBy()





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users