[EPIC] Runtime Texture Pack Change

Discussion in 'Plugin Development' started by Icyene, Aug 22, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    SirTyler

    That is what PluginChannels are for, they are to support a link between a client mod and a server plugin. But the Texture Pack changing that Icyene was doing is done without client mod.
     
  2. Offline

    Supertt007

    Actually you can change player's nametags without affecting their skins now:
    http://dev.bukkit.org/server-mods/tag/
     
  3. Offline

    whitehooder

    Read the post:
     
  4. whitehooder Since v1.3 the skin doesn't get changed if you just change the color.
     
  5. Offline

    whitehooder

    Doesn't? Thats some real good news you've got there :D
     
  6. Offline

    creepycrafter4

    how exact does this work? can you also force a texture pack without mods installed?

    if yes, could someone give me the steps how to do it?

    p.s. if you have no client mod, will your client crash?
     
  7. Offline

    Icyene

    This. Entire. Post. Is. About. That. YES, YOU CAN.

    MC 1.3.x can make servers impose texture packs. There are 3 ways of doing this. The easiest:

    Code:
     public void setTexture(Player toSetOn, String pathToTexture) {
        ((CraftPlayer) toSetOn).getHandle().netServerHandler
            .sendPacket(new Packet250CustomPayload("MC|TPack",
                (pathToTexture + "\0" + 16).getBytes()));
        }
    
    AND:

    Code:
    public void setTexture(Player toSetOn, String pathToTexture) {
        ((CraftPlayer) toSetOn).getHandle().a(pathToTexture, 16);
        }
    
    I think they are pretty obvious as to what they do. Have fun.
     
  8. Offline

    Postkutsche

    No, it's just possible to suggest the user to use a specific texture pack, he may deny the request and he'll never see it again.
     
  9. Offline

    SirTyler

    Or he can accept it and he will never see it again.
     
    Icyene likes this.
  10. Offline

    Postkutsche

    But you can't force a texture pack to a player, like Icyene said.
     
  11. Offline

    Icyene

    But its still pretty darn close...
     
  12. Offline

    gamerzap

    This is SO awesome!
     
  13. Offline

    SmokyMiner

    eclipse gives a red line under: ((CraftPlayer) toSetOn) and Packet250CustomPayload
    is this normal?
     
  14. Offline

    CorrieKay

    you need to use the craftbukkit jar i think
     
    Icyene likes this.
  15. Offline

    SmokyMiner

    CorrieKay is the craftbukkit jar the same as the bukkit 1.3.1 jar (The jar needed for coding any plugin)?
     
  16. Offline

    Icyene

    SmokyMiner No. craftbukkit is the jar you use to run a server.
     
  17. Offline

    SmokyMiner

    I just added the craftbukkit.jar but eclipse is still giving me the error.
    same spots, it say "CraftPlayer cannot be resolved to type." and "Packet250CustomPayload cannont be resolved to type."

    Edit: I move the code to the Listener class instead of my main class, it then let me import Packet250CustomPayload, but Im still getting the error for CraftPlayer

    Edit2: I put import org.bukkit.craftbukkit.entity.CraftPlayer; at the top and the error went away. Normally eclipse tells me to import something if necessary so i didn't think that was the problem.

    So I got it working, but when testing with multiple people the yes/no menu only pops up for me

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  18. SmokyMiner The menu pops up for the player you specified. The whole purpose is to set the texture >for one player only<. Also the menu pops up only one time and then never again, no matter how often you use this method to change the texture. Even after a client restart it won't pop up again.
     
  19. Offline

    SmokyMiner

    V10lator

    I set it up for OnPlayerJoin then it gets the player that joined and sends the packet to that player, but itll only send it to me. It wont send it to my friends when they join

    I tried it with a cracked account my reg account and 2 other ppl connected to the server, only the cracked and my account got the message, and there were both connect with localhost, but it doesnt seem to send anything to the
     
  20. SmokyMiner Maybe cause of network lag the packet comes to the client before he's able to handle it. Try to use the scheduler to delay it.
     
  21. Offline

    SmokyMiner

    V10lator
    It waits like 3:00 before sending the packets and it still only works for localhost connected player.
     
  22. Offline

    Cirno

    This is the day in age when plugin developers think outside the bukkit.
     
    iKeirNez, kroltan and blackwolf12333 like this.
  23. Offline

    evilmidget38

    But Bukkit can hold anything....
     
    iKeirNez and kroltan like this.
  24. Offline

    SmokyMiner

    Just out of curiosity, anyone else experiencing the same problem I have?
     
  25. Offline

    chaseoes

    Popping in here since my last post - so it's not possible?
     
  26. Offline

    Icyene

    chaseoes It is possible... See my plugin, Storm. Specifically, this image. Its working perfectly for me, and has been since I wrote this post. No latency issues, either.
     
    hawkfalcon likes this.
  27. Offline

    superpeanut911

    This looks so awesome.
     
  28. Offline

    gomeow

    You should write something about how you did this so other people can use this
    But that just looks awesome!
     
    hawkfalcon and SmokyMiner like this.
  29. Offline

    SmokyMiner

    Just to clarify, did the text on screen work, or do you need a mod for that?
     
  30. Offline

    Icyene

    You need a mod for the screen text. For the TPack change you do not.
     
Thread Status:
Not open for further replies.

Share This Page