Jump to content

Sync Views

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by Sync Views

  1. You can already do it somewhat with others mods. Most mods will let you disable there ore generation If having disabled all but one version of the ore, the distribution is not right, if you can use stuff like TerrainControl and then just configure the generation of that ore entirely yourself In the event your world still manages to have different items of the same type, there are some mods already I believe that will convert them on pickup
  2. What exactly is this distributable for, and what is its use case? I can't find any documentation anywhere, while as a mod developer I have always used the source releases, and for users directed people with the Vanillia Minecraft launcher to the installer jar, and put the universal jar in modpack installers (to be merged into the client minecraft jar once the installer fetched it).
  3. Yes that causes the packet to be resent. Putting it in onInventoryUpdate seems to cover all the cases I can think of just now (not tested with buildcraft or other mods, but worked with a hopper so hopefully that means everything else will work, since the hopper will try and cast the tile entity to IInventory or ISidedInventory and work with that directly). Only concern is the frequency and size of the packet especially when automation gets involved since that can practically add/remove an item every tick. But think I can reduce that a little with some effort. I did take a peek at the Buildcraft code, but that has a massive amount of its own infrastructure and so would take me some time to figure out what its doing conceptually. But I think the stirling and combustion engines are pretty near to the same problem as my TileEntity (in that they respond visually to the state of their inventories and so need to keep some form of state synced all the time, not just on player GUI/Container interaction).
  4. Well I just did a multiplayer LAN test and it still not quite working. [*]Player 1 creates the world [*]Player 1 places my entity, and interacts with it to turn it on (provides fuel). The client and server state is synced at this point [*]Player 2 joins the world, gets the description packet, with the entity being properly synced between server & 2 clients [*]Player 2 interacts with the entity to disable it (removes all the fuel items) [*]Player 2 and server state is synced, but the change is not sent to player 1 who still sees the enabled state (at least until the initial fuel would have run out, they interact with it and the Container instance syncs it since that covers the entire state at this time, or the entire chunk gets reloaded from scratch)
  5. So if I understand correctly from looking through that code, once the chunk should be loaded for a client, it gets put into the EntityPlayerMP.loadedChunks list, and the description packet will get sent sometime soon after then, removing the chunk from that list. So if a different player modifies the tileentity, or something else on the server but not the client (buildcraft pipes etc come to mind, but not got round to looking into that at all yet), I need to manually trigger the packet. I assume calling PlayerInstance.sendTileToAllPlayersWatchingChunk(myentity) using the instance from PlayerManager.getOrCreateChunkWatcher(chunkX,chunkZ,false) is the way to go?
  6. I have been working on a custom tile entity, and implemented some custom effects using a custom tile entity renderer. However now I have realised that minecraft is only synchronising the tile entities when the player opens the container gui, with Container syncing an IInventory automatically, and things like the furnace container using ICrading.sendProgressBarUpdate and Container.updateProgressBar. However this breaks my TileEntity on the client side until the client first opens it. I had initially thought the writeToNBT/readFromNBT would be used, but it seems even when the chunk is first loaded by the client this is not used. So for tile entities that have visual effects beyond what a block id & meta value can convey (which appears to be how the furnace works visually), what exactly is the standard practice to send the data from the server to the client?
  7. Usually it means eclipse knows where the java files are, so it can show you the source (not sure what happens if the java and class file dont exactly match though). In project properties -> Java build path -> Libraries, if you expand a library one of the listed items is "Source attachment". You can also see this in the properties window for the jar file in "Referenced libraries" in the package explorer. Jar files can also contain the source themselves, which eclipse picks up automatically.
  8. protected ModelPhoenixBlastereModel phoenix = new ModelPhoenixBlastereModel(); Possibly? Although I have no idea exactly what ModelPhoenixBlastereModel is other than badly named...
  9. How you even make a 2D grid of squares represent a sphere? Pretty much all the code that cares about the sun, moon and light assumes a flat world, with the values being the same at a given point in time for the entire world. So there really is no hooks to cover everything that is needed, and you will have to modify lots of core classes (not sure what best practice is there in terms of Forge. Ideally I guess you would want to override/replace specific functions, not entire class files to replace the normal minecraft/forge ones, either way you have to be very careful to support multiple Forge versions, and things like MCPC+ which are also changing these files). So I suggest you look at every place that cares, and see what you can do to make it different. You can likely implement other improvements to Minecraft that would be nice as a seperate permissive mod, e.g. the ability to have the moon and sun follow different orbits, to have seasons (variable daylength), and for localised weather (storms only need to reduce light within a certain area, not globally). Some of the code that cares uses stuff like "World.getBlockLightValue(x,y,z)" so if you modify the relevant functions in World that should be enough. However there is also various bits of code, including some logic stuff as well as rendering that deal with the angle directly, which obviously means those bits need changing as well to take account of their location (or the players camera location in the case of rendering) in the world.
  10. What event exactly are you thinking of? I searched through all the sources/api's I have and only came across org.bukkit.event.world.ChunkUnloadEvent, which obviously isn't useable for a forge mod. Forge has a net.minecraftforge.event.world.ChunkEvent.Unload but this is only sent if the chunk is really being unloaded (from ChunkProviderServer in the loop after the force load check loop), it also doesn't say what other chunks are being unloaded, and has no way to cancel the unload (I guess to prevent mods from working around the ticket/limit system since seems forge has gone with not trusting mods in that regard?).
  11. So one of the big justifications I get given for chunk loaders on servers (and also iirc the reason things like the buildcraft quarry chunk load) is that a lot of the automation stuff can break in horrible ways if the server has some of the chunks loaded, but not others (e.g. loads a chunk containing buildcraft combustion engines, but not the chunks containing the buildcraft water pumps that stop them exploding). So my idea is basically to merge a bunch of adjacent chunks into some kind of dependency group, and make forge load and unload them all at the same time (at least on the server, don't think it matters for the client too much?). Using the chunk loaded event I can check my dependency data, and with ForgeChunkManager can force any chunks I want to also load. However my issue is how to know when my force load "ticket" is the only thing keeping all the chunks in question loaded (the players have moved away). Like a "Ticket.isActivelyForcingChunkLoad(x,z)" method? I looked through the code, and couldn't really see anyway to determine that. The only thing I did find was in ChunkProviderServer.unloadQueuedChunks which I guess if chunksToUnload contains all the chunks that would normally be unloaded (not entirely certain, can't see how it is populated apart from the no players unloadAll case) I could in theory check to see if all my chunks are in that set, and then delete my ticket if they are. But there does not seem to any forge hook at that location for me to do so... So any other ways to check the chunk unload conditions / states?
  12. I have been working on a rewrite of the minecart systems to remove some things I didn't like, and a whole bunch of new features, namely a train implementation and complete prevention of minecarts (on rails at least) ever being allowed to clip into each other, and certainly not right through the minecart in front. However I have run into an issue when the player is interacting with powered rails (e.g. via a lever). If the player changes the power state which part of a train is on the piece of track, it seems the client and server are getting this change on different ticks in the train simulation, which seems to create the possiblity for the client train to make it past the now deactivated powered rail block, which the server train gets stopped entirely (at least until the next server->client train sync packet which moves the client train back to where the server one stopped). I am not sure if this is an issue with the onNeighborBlockChange occurring at different times for the client or server, or because of some delay in sending my custom server->client packets leaving the client-side train always behind (although if the client train was notably behind the server, I would expect to see the client train getting stopped while the server train makes it past a newly deactivated powered rail, not the opposite?). Either way what can be done about it to keep the client/server simulation in sync? The rail block updates its power bit in response to a onNeighborBlockChange call (as in the original rail code, using world.isBlockIndirectlyGettingPowered for upto 8 rail blocks) http://paste.minecraftforge.net/view/f5325d73 (Small fragment from rail where the powered rail effect is queried) The Train entity (representing one or more vehicles forming a train on the track) is then responsible for the entire on-track simulation, with the server and client running the same code, but the server is authoritative sending the data required to rebuild a trains state every 2.5 seconds. http://paste.minecraftforge.net/view/99d3fbf2 (Small fragment from the Train entity where motion is updated and data sent to client)
×
×
  • Create New...

Important Information

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