Table of Contents
Description
Status
Mod compatibility : my 3 rules
Mod Compatibility List
Installation
ETA
Note
Copyright
### Description ###
Hello,
I am working on a mod that allow to have more than 256 IDBlocks.
I prefer telling this first :
THIS BETA VERSION WAS WORKING IN SSP AND SMP FROM THE BEGINNING !!!
My mod allow to use 4096 block ID. But it can be extend to 8096, 16192 easily.
BUT, it can be tested !!! And it seems to work well in SinglePlayer !!!
That why, I am asking people to test it to help me finding bug that I didn't see.
The problem is : This is not compatible with already existing map.
SO BACK UP YOUR EXISTING MAPS BEFORE INSTALLING MY MOD !!!
I am working on it to patch the saved data to the new format but my bug with SMP is prioritizing me.
I add a mod for testing purpose: It add a block with ID = 1313 to test that the limit of 256 is no more !!!
It's recipe is :
Dirt - Sand - Cobblestone
Dirt - Sand - Cobblestone
Dirt - Sand - Cobblestone
(easy to test it with a new world)
You can deactivate my mod in modloader.cfg if you want. It will not prevent the blockID to go more than 256.
EDIT : My block didn't exist in the SMP version so trying to craft it, will crash your client for the version 0.1
### Status ###
SSP:
- Should work : I can create, loaded and saved world, harvest block, place block, craft item, put block in a chest ... and all of this with a block whose ID is more than 256 !!!
- Need to do :
+ Patch saved data (blocks in chunk and items in inventory and chests) of existing map to use them with my mod
+ Continue to tell modder: fix your mod in respecting my 3 rules listed below!!!
SMP:
- World created, loaded and saved and block can be destroy and placed
EDIT2 : A bug prevent the blockID more than 256 to be loaded: Will be fix in version 0.2
- Need to do :
+ fix the bug for Destroying block.
- BUT don't try to create my block in SMP, I didn't add my mod in the SMP version. Try the server with other mod please.
- Need to do :
+ Add the SMP version of my Block ( fix for version 0.2 )
- Bug found :
+ Block ID is wrong reload when chunk is reload : a mask ( 0xff ) was forget to remove ( fix for version 0.2 )
Thanks a lot Volgon8 it was as you said :
Quote
### Mod compatibility : my 3 rules ###
Normally, it is compatible with mods that don't modify the same class that I modify.
BUT, the modder must have anticipated the possibility to use more than 256 blocks.
This can be done in respecting these 3 rules:
- First, when processing the following tables of the Block class, in a loop for example, don't use 256 :
Block.blocksList[]
Block.tickOnLoad[]
Block.opaqueCubeLookup[]
Block.isBlockContainer[]
Block.lightOpacity[]
Block.canBlockGrass[]
Block.lightValue[]
Block.requiresSelfNotify[]
Block.useNeighborBrightness[]
//Wrong
for(int i = 0; i < 256; i++)
//Right
for(int i = 0; i < Block.blocksList.length; i++)
- Second, when declaring a ItemBlock, don't use "myBlockID - 256" but "myBlockID - Block.blocksList.length"
//Wrong
Item.itemsList[Block13incID] = new Item13inc(Block13incID - 256);
//Right
Item.itemsList[Block13incID] = new Item13inc(Block13incID - Block.blocksList.length);
The reason is that the first 256 Items are reserved to be the item version of the 256 blocks. So if I change the max number of Block, the max number of Items reserved for the blocks changed too.
- Third, when using function that return the BlockID, use an integer to save the data. Doesn't use variable byte, byte casting ("(byte)") and mask ( "& 0xff" )
Example from minecraft code :
Class Chunk
public boolean setBlockID(int i, int j, int k, int l)
//Wrong
byte byte0 = (byte)l;
...
blocks[i << worldObj.field_35471_b | k << worldObj.field_35473_a | j] = (byte)(byte0 & 0xff);
//Right
blocks[i << worldObj.field_35471_b | k << worldObj.field_35473_a | j] = l;
=> So you must BAN most of the "256" and the "byte" in our code and it will, probably, work !!!
The advantage of these 3 rules is that the mod will work with and without my mod: without my mod, the "Block.blocksList.length" will stay at 256. Even if you think it is useless, don't forget that the day Mojang will remove the limitation directly in the code of Minecraft, these sorts of error will appear and it will be the same fix that I propose. So better take the good resolution sooner when you have time. Instead of waiting the last minute when a new version of minecraft will appear with the same modification that I made and that you will need more time to update your mod to the new version !!!
Don't do something tomorrow that you can do today !!!
( Note: I probably should not be the one telling this sentence because I am someone that is reporting to tomorrow something that I can do today )
75 % of my work was to apply these rules to minecraft code.
The last 25% was to make it work with the new datas, specially tab of int instead of byte : It take 4 bytes intead of 1 in the saved data on local and the packets send and received between server and client.
Example:
I hope that the creators of the mods I will evocate now will not be angry at me:
- I test Tale of Kingdoms Version 1.2.3 : The world generated well, the guild castle too, the NPC too ... But when I ask my "daily bread", it crash.
- I test BuildCraft 2.2.7 with all its sub elements (core, builder, energy, factory and transport): It crashes at the launch of minecraft with this error :
java.lang.NullPointerException
at uw.<init>(ItemBlock.java:21)
at buildcraft.energy.ItemEngine.<init>(ItemEngine.java:20)
at BuildCraftEnergy.initialize(BuildCraftEnergy.java:109)
at mod_BuildCraftEnergy.ModsLoaded(mod_BuildCraftEnergy.java:34)
at ModLoader.init(ModLoader.java:749)
at ModLoader.AddAllRenderers(ModLoader.java:162)
at wb.<init>(wb.java:76)
at wb.<clinit>(wb.java:9)
at net.minecraft.client.Minecraft.a(SourceFile:265)
at net.minecraft.client.Minecraft.run(SourceFile:644)
at java.lang.Thread.run(Unknown Source)
I look in the source code of buildcraft and specially the class "BuildCraftEnergy.java" and it was because of this line :
Item.itemsList[engineBlock.blockID] = (new ItemEngine( engineBlock.blockID - 256));
The fix is :
Item.itemsList[engineBlock.blockID] = (new ItemEngine( engineBlock.blockID - Block.blocksList.length));
I didn't look any further but this example is a typical example of bug that should appear for people who will test my mod with other mods.
( NOTE for buildcraft's modder : Please don't be angry at me, I love your mod !! And one reason I made this mod was to be able to continued using your mod with new mods but the limit of 256 Blocks was a problem )
BUT, I have to say it: If there is an error, it can be my fault too. There is probably some bugs that I didn't fix too.
EDIT : Buildcraft 2.2.8 is working with my mod now !!!
But I let the example because it is a good example of why an error can happen when using my mod with others.
### Mod Compatibility List ###
In this list, I will add the mod that I or you will test and give me feedback.
The legend is :
- Error during Loading : When you launch minecraft, ModLoader raise an error and you can't go to main scrren ( Single Player, Multi Player, Option ... ) -> The error mentionned in Buildcraft is an example of this
- Loaded but error during map creation : Modloader didn't raised an error, but you have an error when creating a map
- Loaded but Crash in game : Modloader didn't raised an error, you can create a map and play it. But when you do a specific action, it crash -> The error mentionned in Tales of Kingdom is an example of this
I repeat it : It is not because there is an error that it is not my fault !!! I may be responsible of the error so don't tell the modder : Your mod has an error because it can't work with the mod "13inc's MoreThan256BlockIDs". I will try to contact them when there are some erros, that I think, are not my fault. So don't complain or harass them. I already post a request on the forum of buildcraft.
BuildCraft 2.2.8 : World create load and save, can craft Buildcraft item ...
-> Spacetoad fix its coding that didn't respect my 3 rules as I ask him in the post
ID Resolver : Its modder released a patch to allow Robinton's and my mod to work with its mod. But I had to update my version for using Forge 1.2.2 -> Please, wait a moment ( probably this week end )
Optifine : I post a message ( Message 9794 in this page ) showing what need to be fixed in its code since he override some of the class I need to modify : Waiting its reponse.
### Installation ###
In order to install it, you must install :
- Risugami's ModLoader 1.0.0
- SDK's ModLoaderMp 1.0.0
- API Minecraft Forge 1.2.0
NOTE : use Forge 1.2.0 and not 1.2.1 !!!
My version v0.1 doesn't work with Forge 1.21 but only with Forge 1.20. Use link 'Previous version' in the main post of Minecraft Forge or use directly this link.
- Copy the files of my archive in bin/minecraft.jar for the client and minecraft_server.jar for the server
- And don't forget :
BACK UP YOUR EXISTING MAPS BEFORE INSTALLING MY MOD !!!
SORRY BUT FOR THE LINK OF VERSION 0.1, THEY ARE DEAD : MEGAUPLOAD HAS BEEN CLOSED BY THE FBI !!!
I will reupload them somewhere else during the week end.
Previous link dead:
Why did you need to install all of it even if your mod don't need them ?
Because I don't want to create one version for each possible configuration (ModLoader only, ModLoader with forge, ModLoader with ModLoader MP ... ) since they are overriding the class that I modify.
### ETA ###
Please do not ask this in the post. I will release when I will finish coding what I think is necessary for each version.
Update 11 december 2011 :
For version 0.2:
- Patcing existing map : Currently most of the code are done, I just need to find how to force the game to load the whole world to apply my patch in one go.
- Fix reloading ID block bug in SMP : DONE
- Add my mod in SMP : DONE
### Note ###
I apologize for my bad english.
Thanks killernerd who answered some of my questions I had for my mod here.
Thanks Robinton for your advices. Robinton is working on a similary mod that would allow to use 4096 blocks ID too : 4096BlockIDs
Note for Ritsugami, I need to change your ModLoader class and StatList class because you write 256 instead of Block.blocksList.length here :
"Integer.valueOf(i - 256)" and "itemblock = new ItemBlock(i - 256);" in your function "RegisterBlock" in "Modloader"
"StatBase astatbase[] = new StatBase[256];" and "for(int j = 0; j < 256; j++)" in the function "initMinableStats" of "StatList"
Note for Forge : I didn't modify any file in the package "net.minecraft.src.forge" because your developpers already respect the 3 rules.
### Copyright ###
This software is Copyright ©(2011) of 13inc (hereafter referred to as "The Owner") and is the intellectual property of The Owner. Only Minecraftforum.net is able to host any of The Owner's material without the consent of The Owner. It may not be placed on any other web site or otherwise distributed publicly without advance written permission. (Electronic mail is acceptable as long as you wait for a response.)















