Posted April 8, 20196 yr I am trying to access my TileEntity from another place (I know the coordinates of the TileEntity which I want to access). When I call World.getTileEntity, it returns null. I know that the TileEntity is loaded because I'm printing it's coordinates in the update function. I'm getting the TileEntity on client side using World.getTileEntity but the update function is printing in the server thread only. I suspect that the TileEntity is loaded server-side only, and not on client side. I am using ForgeChunkManager to keep the chunk loaded. How can I keep the chunk loaded on client-side aswell?
April 8, 20196 yr 4 minutes ago, deerangle said: How can I keep the chunk loaded on client-side aswell? Don't in short. If you need that for logic on the client, you should probably be doing that logic on the server and sending the result to the client. About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
April 8, 20196 yr Author I am rendering the minecraft scene though a "camera" onto an FBO. The Camera stores the FBO index which needs to be retrieved and is responsible for rendering . This is impossible to do on the server.
April 8, 20196 yr Author So I came up with following Idea: WorldServer world = (WorldServer) event.getWorld(); Field pcm = WorldServer.class.getDeclaredField("playerChunkMap"); pcm.setAccessible(true); PlayerChunkMap map = (PlayerChunkMap) pcm.get(world); List<EntityPlayerMP> players = world.getPlayers(EntityPlayerMP.class, (p) -> true); ImmutableSetMultimap<ChunkPos, ForgeChunkManager.Ticket> chunks = ForgeChunkManager.getPersistentChunksFor(world); for(ChunkPos pos : chunks.keySet()) { for(EntityPlayerMP player : players) { map.getEntry(pos.x, pos.z).addPlayer(player); } } Basically I would add the player to every entry corresponding to the persistent chunks in the ForgeChunkManager. I'm not quite sure about where exactly it would make most sense to put this code.
April 8, 20196 yr Just now, deerangle said: Field pcm = WorldServer.class.getDeclaredField("playerChunkMap"); pcm.setAccessible(true); Those are expensive operations, cache the result of them. About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
April 8, 20196 yr Author Just now, Cadiboo said: Those are expensive operations, cache the result of them. I am very well aware of that. This code is just temporary. Once I get the concept to work, I'm going to optimize my code and cache that.
April 8, 20196 yr You might also want to look into the Looking Glass mod. I don't know if it has been updated recently (XCompWiz has been pretty busy), but you might be able to examine it to see how it works. The whole point of Looking Glass was to provide a mod-friendly way of being able to render views of any location in Minecraft, including other dimensions. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.