Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

[1.0.0] 13inc's MoreThan256BlockIDs (BETA v0.1) : Working in SSP & SMP


  • Please log in to reply
85 replies to this topic

#1

13inc
    13inc

    Tree Puncher

  • Members
  • 17 posts

Posted 06 December 2011 - 11:49 PM

13inc's MoreThan256BlockIDs

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 :

IT IS STILL A BETA VERSION !!!
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 I have still a few bug: Specially one in SMP, where I can't harvest block.

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.

For the SMP version, since we can't destroy block. people will think it's useless to test but you can at least test if the SMP version of your mod can be loaded.
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
EDIT : SMP is working !!!!
EDIT2 : A bug prevent the blockID more than 256 to be loaded: Will be fix in version 0.2
- Player can load the world throught network from server and move in the world BUT THEY CAN'T HARVEST BLOCK and probably can't place them.
- 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

For the smp bug, try going out of the initial spawn area It might just be the spawn protection from mojang.

So In fact, I just need to fix the bug in SMP and I could say my mod is finished. But, you know what programmation is, there are probably some bug that I didn't see because I didn't trigger the function where they are.



### 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
Spoiler:
Tale of Kingdoms Version 1.2.3 : Loaded but Crash in game
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:
Spoiler:

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.)

Register or log in to remove.

#2

DreamKiller69

Posted 07 December 2011 - 12:02 AM

no pics no clicks
Posted Image

#3

sadris
    sadris

    Gold Miner

  • Members
  • 374 posts

Posted 07 December 2011 - 12:08 AM

View PostDreamKiller69, on 07 December 2011 - 12:02 AM, said:

no pics no clicks

You are an idiot.

#4

mattbrvc

Posted 07 December 2011 - 12:21 AM

i cant believe he said that....

If you get this to work, this will change the face of mods forever by braking the chains of the 256 block limit
No I am not clicking the "+" on the bottom right of your post just because.
No I am not gonna ask you to click the "+" on the bottom right of my post just because.

#5

ClassyTurtle
  • Minecraft: lilmessi

Posted 07 December 2011 - 01:05 AM

Once all the bugs are worked out, I will give it a download. Will be checking back frequently.

#6

Murayama

Posted 07 December 2011 - 03:37 AM

I can't believe there aren't more responses to this. This is going to be HUGE if you get it working.

#7

TripleHealix
  • Location: Mal' Ganis
  • Minecraft: TripleHealix
  • Xbox:Zephrith
  • PSN:Zephrith

Posted 07 December 2011 - 05:08 AM

OMFG! Works great! Finally i can play my minecraft with both mo' creatures and more creeps and weirdos! Thanks!

NST! NST! NST! NST!

Posted Image


#8

zolo-skulldu
  • Location: Earth
  • Minecraft: zolo_skulldu

Posted 07 December 2011 - 06:29 AM

Once that is done, s it possible if you could also increase the sprite Id Limit?

Great Mod though
Posted Image

#9

13inc
    13inc

    Tree Puncher

  • Members
  • 17 posts

Posted 07 December 2011 - 08:22 AM

Quote

no pics no clicks
What picture can prove it to you that a block whose ID is more than 256 exist and work well ?
People will say it is not real printscreen but a fake printscreen made with Paint !!!
I will probably try to make a video where I show how to install it ( for the noobs ) and at the end, I will show it is working while showing the my mod config where the ID of my block will be 1313 = Proof Of concept !!
( People will say too it may be a fake but it's more difficult to modify a video than a picture )

Quote

I can't believe there aren't more responses to this. This is going to be HUGE if you get it working.
I didn't speak about it before. If I wasn't not able to do it after speaking about it, everyone will have laughed at me !!!

Quote

Once that is done, s it possible if you could also increase the sprite Id Limit?
This is another story that I will probably not try. Sorry. It take some time and the worst is it take less time to apply the 3 rules I speak in my first post to make it working with the new datas in saved data and network. While the code change correspond to 75% : 3 rules, 25% : new datas in saved data and network

Thank for your help and your answer.

#10

pwnedgod
    pwnedgod

    Void Walker

  • Members
  • 1843 posts
  • Location: ಠ_ಠ McF ಠ_ಠ
  • Minecraft: pwnedgod

Posted 07 December 2011 - 08:46 AM

Cool and nice!
Also instead of being like a API make it compatible to all mod blocks that didn't use this
Too addicted with Counter-Strike: Source for some reason...
Posted Image

#11

13inc
    13inc

    Tree Puncher

  • Members
  • 17 posts

Posted 07 December 2011 - 02:47 PM

View Postpwnedgod, on 07 December 2011 - 08:46 AM, said:

Cool and nice!
Also instead of being like a API make it compatible to all mod blocks that didn't use this

I can't, the errors don't come from "mod blocks that didn't use this". They come from the errors in coding from the modder that didn't respect my 3 rules.
The modder doesn't need to make modifications in their item or block except when declaring a new Item ( Second rule ). They just need to fix their functions that are processing one of the tables of the class Block ( Block.blocksList for example ) and the table of Item because of the ItemBlock ( First Rule ) :
DON'T USE 256 !! USE "Block.blocksList.length" !!!

#12

Nfams
    Nfams

    Carpenter

  • Members
  • 48 posts

Posted 07 December 2011 - 11:25 PM

Des this include sprites? Cos I ran out with my mods. I'm watching this and robinsons 4096.
Posted Image

#13

Builder4Free
  • Minecraft: pazzword

Posted 07 December 2011 - 11:35 PM

Awesome mod, Does it edit baseclasses?
MOD EDIT: Builder4Free is awesome!

#14

JordynX
    JordynX

    Gold Miner

  • Members
  • 474 posts
  • Location: California

Posted 07 December 2011 - 11:48 PM

So do you know if it works with other mods?
Edit: I mean what other mods does it work with?
Subscribe to my YouTube channel for Minecraft Mod Reviews, and Modded Let's Plays!
Youtube: http://www.youtube.com/user/jordynx096

#15

mattbrvc

Posted 07 December 2011 - 11:52 PM

this seriously needs more attention from other mod and mod pack creators...
No I am not clicking the "+" on the bottom right of your post just because.
No I am not gonna ask you to click the "+" on the bottom right of my post just because.

#16

Malivil
    Malivil

    Iron Miner

  • Curse Premium
  • Curse Premium
  • 333 posts
  • Minecraft: Malivil

Posted 08 December 2011 - 12:49 AM

This is an awesome concept but unfortunately a bunch of the mods I use seem to conflict with it.


FBL (Flat Bedrock Layer) - Link
- Overwrites xj.class (Having your mod overwrite it makes it unoperational)

Endermen Don't Pickup Blocks Mod - Link
- Overwrites aii.class (Not sure if it still works despite that)

Too Many Items - Link
- Last page is full of fire with various damage values. I didn't try to spawn it in and see what happens. The rest of TMI works fine as far as I can tell.

CraftGuide - Link
java.lang.ArrayIndexOutOfBoundsException: 33457
at acy.<init>(Item.java:192)
at CraftGuide.ItemCraftGuide.<init>(ItemCraftGuide.java:21)
at mod_CraftGuide.addItems(mod_CraftGuide.java:29)
at mod_CraftGuide.<init>(mod_CraftGuide.java:24)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at ModLoader.addMod(ModLoader.java:265)
at ModLoader.readFromModFolder(ModLoader.java:1272)
at ModLoader.init(ModLoader.java:734)
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)

Kaevator's Slops - Link
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at ModLoader.addMod(ModLoader.java:265)
at ModLoader.readFromModFolder(ModLoader.java:1272)
at ModLoader.init(ModLoader.java:734)
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)
Caused by: java.lang.NullPointerException
at uw.<init>(ItemBlock.java:21)
at ItemSlopes_Kaevator.<init>(ItemSlopes_Kaevator.java:11)
at mod_Kaevator_Slopes.<clinit>(mod_Kaevator_Slopes.java:931)
... 15 more

#17

megarlin
    megarlin

    Zombie Killer

  • Members
  • 190 posts
  • Minecraft: megarlin00

Posted 08 December 2011 - 01:00 AM

it would be awesome if this mod works with id resolver, thanks to foge i dont have problems with sprite id but now i always keep runing out of block ids

#18

J4yrad
    J4yrad

    Carpenter

  • Members
  • 43 posts

Posted 08 December 2011 - 01:05 AM

Epic job you should send this to the guy who compiled the Technic pack he could really use this.

#19

Volgon8
    Volgon8

    Redstone Miner

  • Members
  • 656 posts
  • Minecraft: Volgon8

Posted 08 December 2011 - 02:57 AM

For the smp bug, try going out of the initial spawn area It might just be the spawn protection from mojang.

I started this, but I didn't have the time to make the change from bytes to anything else. Thanks for this as it greatly helps. I'll be watching this. Let me know if you need an extra hand.
If you want to get my attention Quote me(MCforums will send me a message)
Posted Image

#20

pwnedgod
    pwnedgod

    Void Walker

  • Members
  • 1843 posts
  • Location: ಠ_ಠ McF ಠ_ಠ
  • Minecraft: pwnedgod

Posted 08 December 2011 - 06:42 AM

View Post13inc, on 07 December 2011 - 02:47 PM, said:

I can't, the errors don't come from "mod blocks that didn't use this". They come from the errors in coding from the modder that didn't respect my 3 rules.
The modder doesn't need to make modifications in their item or block except when declaring a new Item ( Second rule ). They just need to fix their functions that are processing one of the tables of the class Block ( Block.blocksList for example ) and the table of Item because of the ItemBlock ( First Rule ) :
DON'T USE 256 !! USE "Block.blocksList.length" !!!

I do know that mods works with this, But really make it like all mods can use this without their code being changed to use the code that you provide.
Too addicted with Counter-Strike: Source for some reason...
Posted Image