Jump to content

Skerp

Members
  • Posts

    6
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Skerp's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. In your keyhandler class you need to register your keys. Like: private KeyBinding key_openGUI = new KeyBinding("key name", Keyboard.KEY_F, "My_Mod_Category"); public static openGUI; public KeyHandlerClass() { ClientRegistry.registerKeyBinding(key_openGUI); } Then under KeyInputEvent you can check if the key has been pressed. @SubscribeEvent public void tick(KeyInputEvent event) { this.openGUI = false; if(key_openGUI.func_151468_f()) { this.openGUI = true; } } This is just an example so it might not actually work 100%
  2. I've been able to track down the problem. The problem was in the EntityTracker class. if (par2 > this.entityViewDistance) { par2 = this.entityViewDistance; } par2 is the tracking range you register your entity with. If the entityViewDistance is less than you tracking range your actual tracking range will be limited to the view distance. By deleting this or change the entityViewDistance to more than 150, the entity will stay loaded on the client-side up to what ever distance you set it to.
  3. I do the same on the client-side to see if chunks are loader. Under worldObj.isremote. worldObj.getChunkFromChunkCoords(this.chunkCoordX+ x, this.chunkCoordZ+ z).isChunkLoaded If that returns false, the client will then send a custom packet to the server to send it a chunk. Once the server has sent that chunk it becomes visible to the player. This chunk will appear on the client even if its more than 150 blocks away from the player. I use a camera entity that spawns in client-side only that can allow a player to view any other entity away form the actual player. So for instance if I have a plane that needs to fly way from the player, the camera entity will follow that plane. As you fly away chunks will load and appear around the plane. But once I get to ~150 blocks away from the player the plane disappears and stops ticking client-side (worldObj.isremote). It will still keep ticking on the server-side(!worldObj.isremote)
  4. I'm using this to keep chunks loaded server-side. It might not be the best way to do it. if(!worldObj.isRemote) { for(int x = -2; x <= 2; x++) { for(int z = -2; z <= 2; z++) { worldObj.getChunkFromChunkCoords(this.chunkCoordX+ x, this.chunkCoordZ+ z); } } } The onUpdate() will keep ticking server-side (or !worldObj.isremote) regardless of how far it is away from any player.
  5. The first two issues you have mentioned have been solved. I initially thought the problem was caused by chunks not loading on the client-side, but its not the case (Unless I'm doing it wrong). The third is probably causing the problem, but even if I set the update range more than 150 the entity still de-spawns around 150.
  6. I have an entity that must be able to move away from a player without de-spawning (or stop ticking) client-side. Even though chucks are loaded, server-side and client-side, around that entity it still de-spawns around 150-200 block away from the player. It appears that the trackingRange in forge's entity tracker might be doing this. If I reduce it to 10 blocks, the entity will de-spawn 10 blocks away. I can't seem to go beyond 150-200 blocks regardless of what I set the tracking range to. Is there a way to force an entity to stay loaded client-side? Any help will be appreciated. Thanks
×
×
  • Create New...

Important Information

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