I have a few question about a mod that I am working on it:
- In SMP, when I destroy a block, it disappear and reappear after 1 seconde instead of turning into an itemblock.
I problably made an error or forget something in my modification. so I want to know exactly which packet and which functions are in action when :
+ Destroying a block on the client
+ Sending the data to the Server (my error is probably here)
+ On the server, processing the changement for the block
+ Sending the block disappearreance and the appeareance of the itemblock
+ Receiving the packet on the client and updating the chunk (or probably here)
( For the packet, its probably 52, 53 or 54, but I want to know exactly which one )
- When loading world, which functions do load the items (in inventory and chests ) from save data ?
I need to patch saved world data without my mod to a saved world data with my mod and my modification ( I need to change the Item ID of some Items )
- I had the same questions about Block ID but I find the function taking care of the loading of Block ID saved data.
- With modloader and forge, how can I make to allow the possibility to change my new Block ID from a config file and forcing a default value if the file doesn't not exist? I search some tutorial but all of them use a fixed ID Block like that:
Block myBlock = new myNewBlockClass(myfixedID, 1 , Material.stone);
Thank in advance for your help.
I will probably put a beta vesion of my mod this evening but I would like to fixed the bug in SMP before releasing it and I need to test its compatibility with other mods.
That why I don't reveal much about what my mod will do.
well... i'm not sure what you are trying to do but i can answer those questions:
- destroying a block calls the "onBlockDestroyedByPlayer" method (if you mine it) or a variation depending on how it was destroyed (think about onBlockDestroyed and onBlockDestroyedByExplosion for example)
- not sure what data you mean but mining a block just replaces that spot with air and drops the item version of said block. The methods used for that are: harvestBlock (in Block.java, returns the "item") and SetBlockWithNotify (in World.java, sets the block and notifies the server so it can update the world, it would still work if you did not do this but it would require you to either log out and back in or reload the current chunk)
- see above, processing a block change is done by the "notify" part of setBlockWithNotify
- same question really
- no need to do that manually
- why would you want to change item/block id's?
- why would you want to do that? It might be possible, but i have no ideas of what the consequences would be.
Thanks a lot for these informations, I will try it this evening after work.
The reason is I need to change the ID in the save data when the first time my mod is launched. My mod change the ID of some blocks, so their ItemBlock IDs change too. ( The blocks are saved in the Chunk data and I find where the chunk data are saved and loaded but not where the item datas are saved and loaded )
If I don't do that, my mod will not work with a existing map. Players should create a new map to use my mod : That can be a problem for people who don't want to lose their actual world.
It may be similar of a situation of a modder changing the ID of its block and item between two versions of its mod but don't want to force the users to create a new map.
If you have some more informations about where to find the code for this, don't hesitate to write it.