Jump to content

jredfox

Members
  • Posts

    660
  • Joined

  • Last visited

Everything posted by jredfox

  1. no on server side you call mcServer.getPlayerList().getPlayerByUUID() or something like that. I recommend username unless you only have acess to uuid unless your storing something to the disk then I guess use uuid
  2. are you using reflection with the deobfuscated name of "ROCK" if so you doing it wrong you need to change the string based on if it's mdk or not
  3. why not just user username well you get the player list object from a server instance make sure it's done on server side. There is a getter for both username and uuid
  4. SPacketPlayerListItem.AddPlayerData wait I thought it wasn't a thing since it's not static inner class just re-read the post of stackoverflow. Will be trying this out https://stackoverflow.com/questions/70324/java-inner-class-and-static-nested-class public class A{ public class B{ //cannot be constructed except for in class A } }
  5. Expected Result: tabs getURL first Actual Result: tabs "aaa" first @Override public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) { List<String> list = new ArrayList(); list.add("aaa"); list.add(0,"getURL"); System.out.println("list:" + list); return list; } Output of console: [21:27:46] [Server thread/INFO] [STDOUT]: [com.EvilNotch.lanessentials.commands.CommandCape:getTabCompletions:110]: list:[getURL, aaa] Unexpected Result: aaa comes first when tabbing even though I don't say to order my lists like vanilla does.
  6. "add your own instances" so your saying try your own custom packet. I will be trying this out later but, from the code I read sending null for the name resets the clients names for the players or at least the comments said it was suppose to do that. Maybe it only does it once or something stupid like that "You already knew it would not work" no I tested on both sides from login not on command didn't know what would happen
  7. also just had my friend relog and did a hard coded test(client and server from player login) the new name doesn't show up in tab only above the player head weird @SubscribeEvent public void skinCap(PlayerEvent.NameFormat e) { e.setDisplayname("notch"); }
  8. there are three constructors for SPacketPlayerListItem none of them allow for custom text. It just gives a tabname from the player which always returns null.
  9. nothing just tried this: SPacketPlayerListItem item = new SPacketPlayerListItem(SPacketPlayerListItem.Action.UPDATE_DISPLAY_NAME,player.mcServer.getPlayerList().getPlayers()); for(EntityPlayerMP p : player.mcServer.getPlayerList().getPlayers()) { p.connection.sendPacket(item); }
  10. @Override public void setPlayerListName(String name) { if (name == null) { name = getName(); } getHandle().listName = name.equals(getName()) ? null : CraftChatMessage.fromString(name)[0]; for (EntityPlayer player : (List<EntityPlayer>)server.getHandle().players) { if (player.getBukkitEntity().canSee(this)) { player.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_DISPLAY_NAME, getHandle())); } } }
  11. the capabilities fires on client's thanks I might move it to the capability event to register my system then. Doesn't solve my issue for older issues sadley. Forge's is very confusing nearly impossible to manipulate other mods and scan for what mod does what so I made my own for players at least now I am sure there is a way bukkit does it and doesn't have any client code instant name changes. look for CraftPlayer.setDisplayName() https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java I will keep looking for a solution on what they use but, it appears it's possible without any new client code. Just don't know where and what vanilla packets they are using to use a work around for this.
  12. I do player logout and server stop and tested player logout fires for disconnecting the player. How??? The capability system is server only for now I haven't figured out how to (fast enough) sync data from load file event(before login occurs during serialization). If I did a weak reference that means people could only view the capability once before it disposes sounds awful I want to use it all during the game until logout. The player save event occurs way too often so I decided logout and server stop would be more optimized? Again the PlayerEvent.NameFormat is fired on client side to? Well I want to keep it server side utility now since everything else is so far for the mod I am working on. What packet do I send to all players telling them of the name change????
  13. I can change my code to public static string nick to transfer to the forge event doesn't do anything. public static String nick = args[0]; during event > set name to nick if not null same result Here is my capability system isn't broken: https://github.com/jredfox/evilnotchlib/tree/master/src/main/java/com/EvilNotch/lib/minecraft/content/pcapabilites and here: https://github.com/jredfox/evilnotchlib/blob/931c6eab0f5a3ba733f3515cd395764b745d4798/src/main/java/com/EvilNotch/lib/main/MainJava.java#L270 How to use it: Create a capability provider > basically to register your caps when the time occurs Create capabilities to use for the container. Make sure you have readFromNBT/writeToNBT fullly working then your done "The event is fired on both server and client and both need to set the player name properly." why bukkit doesn't need that code running on client side and my command is server only. I want to keep this like bukkit what packet do I send to the clients to update the names?
  14. external capability system not directly attached to the object of the player similar to bukkit and bukkit plugins. All you need to know is I attach a string the if statement does execute and the only thing that changes is the chat name what else do I need to do. during command refreshes player name > String nick = args[0] during event > event.setName(nick); Bukkit can change player name without having custom packets to send to the client so what else needs to happen????
  15. need help on this still. Also player.dismountRidingEntity(); doesn't always do it's job
  16. So I made a command for nickname but, it only works for chat nothing else here is my code the capability stores a string and then during the forge event it uses said string: According to bukkit's command this is all they practically do is change a display name and is only server side so I don't think packets are required so tell me what else I need to do CMD: @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { EntityPlayer player = (EntityPlayer) sender; CapNick name = (CapNick) CapabilityReg.getCapabilityConatainer(player).getCapability(new ResourceLocation(Reference.MODID + ":" + "nick")); name.nick = args.length == 1 ? args[0] : player.getName(); player.refreshDisplayName(); } Event: @SubscribeEvent public void skinCap(PlayerEvent.NameFormat e) { EntityPlayer player = e.getEntityPlayer(); CapNick name = (CapNick) CapabilityReg.getCapabilityConatainer(player).getCapability(new ResourceLocation(Reference.MODID + ":" + "nick")); if(!Strings.isNullOrEmpty(name.nick)) e.setDisplayname(name.nick); }
  17. so you don't have to write it constantly it autofills and you can change it via code rather then constantly going through files feeling like code is in vein and really your a resource pack maker rather then actual coding.
  18. exactly automation is key and they want static references to make you do the amount of lines you write * 5 when it should be one line
  19. I made a config library anyways might as well put it to use
  20. I recommend only generating lang files during dev unoptimized to do so otherwise I do the same thing. If your mod doesn't contian pack.mcmeta then you need en_US.lang instead of en_us.lang
  21. you need to debug it yourself but, that's what the crash report says. It also says all your resource location domains are minecraft not jorney fix it. Literally print out the name of the item before the last crash it will tell you the one that is causing the null string hopefully. Edit: it's going to crash on the moment of creating your object so print in your main block/item to find the one that's going to cause the crash
  22. your kidding right? your sending in a null string for the registry name. Also use resource location with the base being your modid because if you don't it becomes minecraft:yourblock or make sure you auto fill in the base with joreney: + string sent in. Another thing is caps are no longer supported the string you send in gets turned into resource location later even if you use the string param
  23. Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class); e.dismountRidingEntity(); e.setLocationAndAngles(x, y, z, yaw, pitch); ((EntityPlayerMP)e).connection.setPlayerLocation(x, y, z, yaw, pitch, set); I sent in the args of 0 4 0 0.0f, 0.0f where the last two args are yaw and pitch. The print line I tried printed 0.0f on both yaw and pitch but, the render of the shoulders was wrong compared to that of the player respawning and the shoulders being straight. in the render it looks like the shoulder is diagonal compared to straight?????? I also tried this both before and after the method above no luck: e.setRotationYawHead(0.0f); e.rotationYawHead = 0; e.prevRotationYaw = 0; e.prevRotationPitch = 0; e.renderOffsetX = 0; e.renderOffsetY = 0; e.renderOffsetZ = 0; e.renderYawOffset = 0;
×
×
  • Create New...

Important Information

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