JustEnoughIDs icon indicating copy to clipboard operation
JustEnoughIDs copied to clipboard

Chisel crash when hitting/destroying the block with the id 4250

Open Xalcon opened this issue 5 years ago • 12 comments

Disclaimer: I dont know if this really is a JEID issue, so I've also opened an issue on the Chisel issue tracker. https://github.com/Chisel-Team/Chisel/issues/758

When you destroy a chisel block that has the internal block id of 4250, the game client will crash with the following stack trace:

java.lang.IllegalArgumentException: Cannot set property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[down, north, south, west, east]} to up on block minecraft:hopper, it is not an allowed value
	at net.minecraft.block.state.BlockStateContainer$StateImplementation.func_177226_a(BlockStateContainer.java:227)
	at net.minecraft.block.BlockHopper.func_176203_a(SourceFile:188)
	at net.minecraft.block.Block.func_176220_d(Block.java:2717)
	at net.minecraft.client.particle.ParticleDigging$Factory.func_178902_a(SourceFile:105)
	at net.minecraft.client.particle.ParticleManager.func_178927_a(ParticleManager.java:142)
	at team.chisel.client.util.ClientUtil.addDestroyEffects(ClientUtil.java:95)
   [...]

Full Crashlog

This is a rather rare bug since a few things need to align perfectly in order for this to happen. In order to reproduce this, i had to write a small mod that registers 3950 blocks, just so chisel will definitely occupy the block id 4250.

The code for the mod (BlockIdEater) can be found here https://gist.github.com/Xalcon/542e5f1bc16921dfb46d408b1f63ee15

The interesting thing is: 4250 - 4096 = 154 154 is the BlockId of the minecraft hopper

Something that I found out though: Chisels last method in the stack trace is ClientUtil.addDestroyEffects() which retrieves a block ID via Block.getIdFromBlock(). Afterwards it calls ParticleDigging.Factory#createParticle() (indirectly via ParticleManager#spawnEffectParticle()) which in turn uses this ID with Block.getStateById(). At this point, it seems JEID returns the hopper block state but with an invalid meta value. I'm not sure if this is a bug with JEID or if chisel should actually use Block#getStateId() instead of Block.getIdFromBlock().

Used Mods:

	| State  | ID           | Version           | Source                        | Signature                                |
	|:------ |:------------ |:----------------- |:----------------------------- |:---------------------------------------- |
	| LCHIJA | minecraft    | 1.12.2            | minecraft.jar                 | None                                     |
	| LCHIJA | mcp          | 9.42              | minecraft.jar                 | None                                     |
	| LCHIJA | FML          | 8.0.99.99         | forge-1.12.2-14.23.5.2805.jar | e3c3d50c7c986df74c645c0ac54639741c90a557 |
	| LCHIJA | forge        | 14.23.5.2805      | forge-1.12.2-14.23.5.2805.jar | e3c3d50c7c986df74c645c0ac54639741c90a557 |
	| LCHIJA | blockideater | 1.0               | blockideater-1.0.jar          | None                                     |
	| LCHIJA | ctm          | MC1.12.2-0.3.3.22 | CTM-MC1.12.2-0.3.3.22.jar     | None                                     |
	| LCHIJA | chisel       | MC1.12.2-0.2.1.35 | Chisel-MC1.12.2-0.2.1.35.jar  | None                                     |
	| LCHIJA | jeid         | 1.0.2-26          | JustEnoughIDs-1.0.2-26.jar    | None                                     |

How to reproduce:

  • Install the mods listed above (the code for the block id eater mod can be found here)
  • Make sure the block Id eater mod is loaded first so it can occupy all the IDs in range up to 4050~
  • Create a new world and place the block that occupies the block id 4250. In my case this was chisel:block_coal2 (either Block of Coal (Raw) or Block of Coal (Cuts)). I've used NBTExplorer to look for the block id 4250 to get the right block.
  • Destroy the block
  • ....
  • ~Profit~ crash.

Xalcon avatar Jan 06 '19 01:01 Xalcon

What the hell is this? LCHIJA | blockideater | 1.0 | blockideater-1.0.jar | None

P3rf3ctXZer0 avatar Jan 15 '19 11:01 P3rf3ctXZer0

A mod that registers a ton of blocks so chisel is forced to register blocks in the ID range around 4250. I wrote this mod so I can reproduce the issue without having to rely on a 200+ mod modpack, see my original post:

In order to reproduce this, i had to write a small mod that registers 3950 blocks, just so chisel will definitely occupy the block id 4250.

Xalcon avatar Jan 15 '19 11:01 Xalcon

understood.

P3rf3ctXZer0 avatar Jan 15 '19 11:01 P3rf3ctXZer0

have you tried running NotEnoughIds alongside JEID? Many users report these mods tend to make eachother work better. JEID for biomes and everything else but NotEnoughIDs seems to have a much better time dealing with itemblockid limits.

P3rf3ctXZer0 avatar Jan 15 '19 11:01 P3rf3ctXZer0

I did not try NotEnoughIDs yet, I was assuming that 2 mods that do more or less the same thing (just differently) could cause issues. I've worked around the issue by modifying the block registry and assigning a different block to the ID 4250 that is not a chisel block. I figured I should just report this bug, since I was able to reproduce it with a rather simple setup - just in case someone else runs into this issue as well. If I run into this issue again during my normal play sessions, I may try out NEID. At the moment I cant be bothered :) thanks for your time though.

Xalcon avatar Jan 15 '19 11:01 Xalcon

Yeah do not do that - my world is 100% corrupted. Um so yeah can you slide me your fix?

P3rf3ctXZer0 avatar Jan 15 '19 13:01 P3rf3ctXZer0

I dont have a Fix, just a workaround. I dont even know if my workaround causes other issues since I started a new world after reproducing this bug (and fortunately, chisel doesnt occupy the ID in that world)

Using a NBT Editor (I've used NBT Explorer), you will need to invalidate the registered block 4250 (should be registered to a chisel block). The block registry can be found in the level.dat inside the Node FML -> Registries -> minecraft:blocks -> ids. (use the search and search for the value 4250, make sure the ids node is active) I've just set the key to invalidmod:corruptblockid. Forge will see that the chisel block is no longer in the registry and just add it at the end. It will also prompt you to confirm that the block invalidmod:corruptblockid is missing and you want to continue. All instances of the defect chisel block in your world will be replaced with air blocks though, so keep this in mind.

And again: I dont know if this causes any other issues. Do this at your own risk. Backup your world before you do this, etc.

Xalcon avatar Jan 15 '19 13:01 Xalcon

Consider how badly I just broke my world - pretty sure your minor change will not be nearly as destructive 🗡

P3rf3ctXZer0 avatar Jan 15 '19 13:01 P3rf3ctXZer0

Do you remember that one mod for 1.6.4 called "Glitch dimension" where the dimension was unsuitable for building because blocks would be replaced with other blocks mid game and you could legit see the world colapse before your eyes - yup I did the same thing by adding NEIDS and JEIDS at the same time. Feel free to make a junk world and see for yourself - takes about 5 mins to really see the glitch though

P3rf3ctXZer0 avatar Jan 15 '19 13:01 P3rf3ctXZer0

Only because we haven't gotten this from anyone else and it seems rather weird that one specific block ID is calling a crash, I'm gonna close this for the moment until someone can either test this or is able to recreate it.

ZombieHDGaming avatar Apr 17 '19 21:04 ZombieHDGaming

I am able to reproduce it with the test mod above.

Runemoro avatar Apr 17 '19 21:04 Runemoro

This only happens with chisel at the moment (as far as I know) due to their special block rendering code. Just to give you an explanation on how this happened to me: I've setup a modpack that had just below 4k block IDs. After playing for a while I noticed I forgot to add chisel, so I added it (i was using JEID from the get go since I assumed I would add more mods in the future).

Since I had an already existing world, the new chisel blocks occupied the new IDs around 4250. In a new world, this wouldnt be the case since chisel would be loaded much earlier.

But like I said earlier, this is super rare bug and quite a few things need to align for it to happen. I dont expect you to fix this if it isnt easily done, rather inform you about it and present a workaround for people that are affected.

Thank you for your time. :)

Xalcon avatar Apr 19 '19 09:04 Xalcon