Jump to content

jabelar

Members
  • Posts

    3266
  • Joined

  • Last visited

  • Days Won

    39

Everything posted by jabelar

  1. Well, it depends on how your mod works. If you store it per-dimension then if you whistle for your dog while in the Nether you will only get dogs saved in the Nether. In any case, the point is that is it very simple to save additional custom data to the world save file. NBT format is quite suitable for that. So then you just need to write the methods to take the data and put it into NBT and read it back. For the most part it should be fairly easy, although sometimes using NBT with lots of compounds and lists can be a bit confusing. So just work through it carefully. The concept is simple, but the details are important when dealing with files.
  2. Well, Minecraft is just Java so all the file I/O libraries are available. So you could just come up with your own file format. But you could also hook into some of the built-in formats to help you. For example, if you have the data in NBT already then there are already methods for writing and reading NBT. But do you really need to store these in a separate file? Because you can also put all this stuff into a world save data instance and have that saved together with the regular game saves. Thanks to diesieben07 for this tip. There is are built in classes for saving data: WorldSavedData. How you do it depends if you want to store it per-dimension (different data for e.g. nether and overworld, these are two World instances in the code) or per save-file (same data for all dimensions). For the former use world.perWorldStorage, otherwise use world.mapStorage.Warning: Be sure to always call markDirty() on your data when you change a value, otherwise Minecraft will not save it. You can see diesieben07's simple example here: WorldSaveData example cod
  3. Unfortunately, we don't support anything older than about 1.10 any more so a moderator will probably lock this thread. But my suggestion is that your problem is probably that your entity movements are not making it to the server so that it will move on the client for a bit until the server sends one of its regular position updates, and since server doesn't think it moved it gets reset.
  4. I have a tutorial for blocks with GUIs here: http://jabelarminecraft.blogspot.com/p/minecraft-modding-blocks-with-guis.html A crafting block has instaneous processing (opposed to something like a furnace that takes time), so you should look specifically at the link to "Block with immediate GUI result" link near the bottom of that page. Note that the tutorial was created for 1.8. I will look at updating it but all the principles should be the same, although there might be some small differences in some method names. I have another similar example with source code for 1.12.2 here: Block class: https://github.com/jabelar/ExampleMod-1.12/blob/master/src/main/java/com/blogspot/jabelarminecraft/examplemod/blocks/BlockCompactor.java Container class: https://github.com/jabelar/ExampleMod-1.12/blob/master/src/main/java/com/blogspot/jabelarminecraft/examplemod/containers/ContainerCompactor.java TileEntity class: https://github.com/jabelar/ExampleMod-1.12/blob/master/src/main/java/com/blogspot/jabelarminecraft/examplemod/tileentities/TileEntityCompactor.java
  5. You need to create the dependency, and make sure Mod A is present (in deobfuscated form) in the dev environment for Mod B as well the eventual run environment (in obfuscated form) for the user. Basically Mod A becomes a library to Mod B. Here's what I think you need to do (others can correct me): You would specify the dependency in Mod B's @Mod annotation. You would specify that Mod A loads before Mod B generally. Fill in the dependencies block in your build.gradle. (I think there are comments in the template that will guide you.) Add the deobfuscated version of Mod A source code jar to your Mod B project class path. I think that when you build your Mod A jar it also creates a deobfuscated version, but maybe you need to run special build option. Recommended to add a dependencies section in mcmod.info. This is informational.
  6. If there isn't a specific even for it, an armor stand is just an entity so you can use the PlayerInteractSpecific event and check for whether the entity is instanceof EntityArmorStand.
  7. I'm not quite sure what your concern is regarding Bukkit versus Forge. Terrain generation is just a matter of placing blocks, and the "noise" is meant to add natural variety in the choice of where to place the blocks. The math behind the noise generation should be the same (or can be made the same easily). The tricky part with noise though is the "tuning". Just a minor difference in a parameter for the noise generator, or just a minor difference in the threshold for deciding whether a block is placed or not, can make a large practical difference to the world that gets generated. You didn't really explain what you're trying to achieve specifically in terms of the resulting terrain. But you can either start with your plugin code and just make sure the math matches up, or you can start with the Minecraft vanilla generators and see if you can tweak them. You could also try using the custom terrain generator and seeing if you can get what you want and then use those values to hard-code a generator specific for your mod.
  8. I think it would be pretty easy. I've done this several times before for testing purposes. I made a tutorial for a single-biome custom dimension here: http://jabelarminecraft.blogspot.com/p/minecraft-modding-custom-dimension.html My tutorial links to full working example of a "cloud world" where all the terrain is built up of "cloud" blocks (on top of a layer of bedrock). I still do some feature, decoration and structure generation but it should be easy for you to figure out where that is happening and simply replace the code. The general idea is that the chunk generator generates the terrain first as bedrock then a "filler block". You just need that to be dirt. Then in all the other "populate", and "decorate" methods you would just do nothing.
  9. Another option is to use an actual Entity instead. You can disable the frustum checking easily for entities. Not sure if that really helps depending on what format your models are in. I'm guessing you have them in JSON which is why you're concerned about moving to OBJ. I think you can render baked models as entities though -- look at how falling blocks are rendered. Choonster explains how to do that here:
  10. Although you can't "replace" another mod's classes, you can usually intercept their behavior using events. For example, you could make your own player capability "flyLikeGalactiCraft" and when that is true you could intercept the movement using events and run code that is similar/copied from GalactiCraft but without putting the player fully into creative mode. Regarding the dependency, you only have to do that if you're interacting with their classes. If you just want to know if their mod is loaded you can check that.
  11. I think it is probably because they based it on the biped (i.e. player) model. If you think about a quadraped, you just take a biped and rotate the body.
  12. Why? are you seeing a performance problem? Almost everything related to handling the blocks in the world is already pretty optimized so not sure how you would optimize it further. What is different about what you're trying to do versus something like a stronghold?
  13. While there is no harm in doing a useless check, it makes no sense really. There are no examples of vanilla or popular mods that do that. And why would a mod return a wrong value for an important interface? And lastly, if any mod did change the whole chunk loading system so much that you can't trust the loading interface then your world check cannot be trusted either! To really make the point: WorldServer class (which no one ever modifies) has method isChunkLoaded() which has the following source: protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) { return this.getChunkProvider().chunkExists(x, z); } This isChunkLoaded() method is the ONLY thing used to check chunk loading in all the following methods (which no one ever change): World#isAreaLoaded() World#isBlockLoaded() World#updateEntities() WorldServer#tickPlayers() World#getEntitiesInAABB() etc. And these methods are relied on by almost everything else. Like World#getBlockState() calls isBlockLoaded() which calls isChunkLoaded(). If all the important functionality in the game relies on the chunk providers chunkExists() method. I really don't get why your mod would require anything else. But no harm if you want to do extra checks I guess.
  14. I don't know off the top of my head, but best thing is to think if there is already a vanilla feature that does something similar. For example, since there is the feature that you can hold down shift and keep you from going over an edge there must be code there that would be useful. Or, conversely you can look at the code that checks to see when the player should fall. That should also give you a clue.
  15. You have to check for every block placement. You can check for == Blocks.AIR (and other blocks you consider replaceable. (Note that in 1.13 upcoming I think they are adding some different types of air like "cave air" to help with generation and spawning.). The alternative is to take over the chunk generator and replace it with one where, if you're going to build the structure, doesn't put anything else in the way in the first place.
  16. Capabilties are not a "mess" at all. They work quite well. They aren't really that complicated either. You just attach the capability to anything which is a capability provider and define the types of field you want it to contain. Regarding any deprecated methods you might encounter. Deprecated methods can firstly usually still be used, they are just not the best way. Secondly they are often commented with a note that tells you what the replacement method is. Lastly, you can use your IDE to look at he type hiearchy (or "structure") of the class to see a list of available methods and it is usually quite obvious what the new one might be -- often they are named the same but just have a different parameter list prototype.
  17. So I looked through the source of a number of mods that create major dimension stuff. Like Twilight Forest, Advanced Rocketry, AbysmalCraft etc. and none of them create any custom chunk providers. Advanced Rocketry looks like it does but they actually misnamed their classes -- the ones they call "ChunkProvider" actually implement IChunkGenerator not IChunkProvider. The main mod I can find quickly that does create custom IChunkProvider implementations is GalactiCraft. They always return true for the chunkExists(). Now, you might think that is a problem but I'm thinking that it might actually be correct -- you'd have to figure out what they're doing but they probably had a good reason for this. Remember that the chunkExists() is checked by things like the World classes when they are doing all sorts of things like looking for entities and such. So if they're reporting true for this then I guess it means that for those specific custom providers that the chunk exists ("loaded") at all times. I don't know much about GalactiCraft's loading but they do explain that there is generally loading and such going on: https://wiki.micdoodle8.com/wiki/Sealed_space#Chunk_loading Any, generally the point of an interface is that it is supposed to be honored. So I doubt if any quality mod would report that chunks are loaded when they are not.
  18. Why? Why would a mod change that part of the ChunkProvider? Most modded dimensions change the ChunkGenerator but don't fool around with ChunkProvider. But if they did the custom ChunkProvider would need to implement the IChunkProvider interface. That interface requires an implementation of the getLoadedChunk() method which only returns loaded chunk (null if not loaded). The getLoadedChunk() for the vanilla ChunkProviderServer accesses the same map I already mentioned, so the chunkExists() is legit at least when ChunkProviderServer is used. In any case, what mods change this functionality? They all need a sense of what is loaded even if they change how things load, and the interface requires an implementation of the getLoadedChunk() method.
  19. Are you sure your register methods are actually getting called?
  20. The first thing to do is confirm that all your code is being executed. Like add console print statements (or use breakpoints and debug mode if you prefer) at each of the methods and key points in the code, and you can also print off key values. For example, you should confirm that the registry event is actually firing. Some things like whether the proxy classes are in the right asset location are hard to tell from a forum posting, but again tracing the code execution might help you identify the problem. I would probably try to put the item on a vanilla tab before trying it on your custom tab, just to make things even simpler. Also, I imagine your console is already spewing some errors related to the missing models, but perhaps there are other relevant errors being printed. You should go through the whole thing carefully.
  21. When you're debugging a problem with your own code, you can learn a lot by adding some console print statements in your code to help you check that the code is actually running and the key values of the code that is running. You don't need to guess. So for example, if you had a few console statements you could confirm that the createParticle method was even being called at all and furthermore you could double-check the position or whatever else might be the problem. One other thing -- with rendering if you screw up the texture coordinates you can end up with something that is "invisible" because you don't actually have enough of the actual texture. Like if the u, v coordinates defined a really small area. Or if you texture atlas has places where there is just transparent part of the image. Anyway, you don't need to guess or ask people here to guess what is wrong. Just print out what is happening and it should be obvious.
  22. I'm still really confused why you're using the reflection and stuff. Are you sure that the chunk provider chunkExists() doesn't work? That is public method and is exactly what the protected method WorldServer.isChunkLoaded() calls. That method is used by all the vanilla code such as isAreaLoaded(), isBlockLoaded() and so forth. You should only need the public method world.getChunkProvider().chunkExists().
  23. The world.isChunkLoaded() just calls the chunkExists() method. You don't need both.
  24. I'm not sure the draw screen event is really the best one. It should probably work, but I'd try something like the RenderWorldLastEvent. In any case make sure you confirm that it is firing at the refresh rate. The other possible issue is client versus server side. The server has nothing running at the client refresh rate so it can only make decisions at the tick rate, and furthemored any change in pitch and yaw initiated by the server can at best happen at the intervals that it can send packets to the client. So maybe you're already doing this, but I think what you have to do is change the pitch and yaw in an event like RenderWorldLastEvent. I would start with a simpler implementation to debug this. What happens if you simply add 1 to yaw in the render event? Forget all the randomness, the desired target and the partial ticks. Just see if you can get smooth steady transition with simply adding 1.
  25. If you look at the ChunkProviderServer code I think the chunkExists() is actually just the loaded chunks. There is another method called isChunkGeneratedAt(). Also, if you look at the implementation of the chunkExists() it looks at the id2ChunkMap which it also uses for methods like getLoadedChunkCount(). So it seems to be loaded chunks.
×
×
  • Create New...

Important Information

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