Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by Vitridax

  1. I managed to solve my problems by myself. It took a week of many tests and crashes, but at least it was very informative. For the first question, my NetHandler wasn't being updated because it's manager was a client side manager. The server side manager it was connected to was stored in a private list in the NetworkSystem, so I got it using reflection, and used it for my NetHandler instead. For the second question, right now I'm just creating packets in NetHandlerPMPlayServer.update() and calling the correct method to handle the packet. I'm not sure if this will cause problems later, but for now it works.
  2. For what Entity? I can't change any vanilla classes and I'm trying not to use my old entity (EntityPMPlayerServer) because of all the problems it causes. Instead I'm just using the NetHandlerPMPlayServer. Or are you talking about the very first question I asked on March 2nd? That's resolved because I'm not using EntityPMPlayerServer anymore.
  3. Ok, so I've found a few problems that I can't seem to handle in the past few days. At first I kept trying to use the entity that extended from EntityPlayerMP, but there were so many things to override that I decided to just have a custom net handler only (extends from NetHandlerPlayServer, I called it NetHandlerPMPlayServer). I can link it with a player just fine, but for some reason EntityPlayerMP only updates(super.onUpdate()) when its net handler recieves a packet from the client (C03PacketPlayer), which is sent every tick in EntityPlayerSP's onUpdate(). Of course, my players don't have a client (except for the EntityOtherPlayerMP, which doesn't really count), so they aren't being updated. I tried to make my net handler "send itself" the packet in it's update() method, but that wasn't being called either. Instead I tried using the event PlayerTickEvent to call NetHandlerPMPlayer.update() whenever the EntityOtherPlayerMP version of my player ticked. This worked fine, but when I created an sent the packet in NetHandlerPMPlayer.update() MC crashes with a net.minecraft.network.ThreadQuickExitException. If you don't read ALL the above you might get confused, so just read it. In the end I have two questions: -Why isn't NetHandlerPMPlayServer.update() being called in vanilla code somewhere? -How can I make my net handler "send" itself packets? GitHub Source: https://github.com/Vitridax/PlayerMod.git Sorry if the files are a bit messy with all the comments everywhere. If you can't find something just ask. Edit: Crash. Sorry I forgot about it earlier.
  4. I know. The only problem is that I can't do a constructor with super(world) because EntityPlayerMP doesn't have that constructor either, but for some reason it works. I don't know how to do a constructor that just has one parameter (World world) while still referring to the EntityPlayerMP constructor (super(server, world, profile, interactionManager)) without making up lots of hard coded things to fill in the blanks.
  5. Here is the code I use to spawn the player.
  6. Edit: This first question is resolved. Scroll down to see my later questions. I created an entity (EntityPMPlayer) that extends EntityPlayerMP. When I tried spawning it in the exact same way I spawned an EntityPlayerMP the console spat out an error that it was missing the method <init>(net.minecraft.world.World). Why does it do this with my entity but not with EntityPlayerMP, and how can I fix it? EntityPMPlayer: Error:
  7. I already knew about them, but thanks for trying . It seems like people don't have much suggestions so I'll wait another day and then I'll just assume my method is fine and that there are no tutorials on NetworkManager.
  8. I'm trying to make a mod that adds computer controlled players into the game. I want to make them as close to players as possible (at least in their abilities, the AI probably will be a bit harder). This means that spawners will activate with them nearby, players can't sleep unless my computer ones are in their beds too, death messages etc. I think the easiest way to do this is to make them extend from EntityPlayerMP and be treated as clients. I managed to make several fake clients with the following code: // construct profile ServerConfigurationManager scm = MinecraftServer.getServer().getConfigurationManager(); String username = "Player_" + (scm.playerEntityList.size() + 1); UUID uuid = UUID.nameUUIDFromBytes(username.getBytes(Charsets.UTF_); GameProfile profile = new GameProfile(uuid, username); // login EntityPlayerMP fakePlayer = scm.createPlayerForUser(profile); SocketAddress address = Minecraft.getMinecraft().getIntegratedServer().getNetworkSystem().addLocalEndpoint(); NetworkManager netManager = NetworkManager.provideLocalClient(address); NetHandlerPlayServer nhps = new NetHandlerPlayServer(scm.getServerInstance(), netManager, fakePlayer); scm.initializeConnectionToPlayer(netManager, fakePlayer, nhps); I don't know much about NetworkManager or NetHandlerPlayServer, but I made this code by looking into what happens when someone logs in and just went from there. Is this a good method for making fake clients, or is there an alternate one that is better? I looked around for tutorials and couldn't find any so if there is one please tell me. Also, I'm not looking for FakePlayers (the thing in forge util).
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.