sp614x / optifine

1.8k stars 418 forks source link

Immersive Engineering Rendering breaking when using optifine #86

Closed mindforger closed 8 years ago

mindforger commented 8 years ago

can you have a look at Immersive Engineering and what the heck is going on?

https://cloud.githubusercontent.com/assets/16712394/12343036/d9b70c84-bb0e-11e5-932c-afe0367b4131.png

this is called an improved blast furnace and supposed to look like a giant vase but the rendering fucks up pretty bad when using optifine

also many of the multiblocks have lighting issues as they are rendered ISRBH (hopefully i spelled it right) and become randomly darker whenever you get close to them while certain surrounding faces are covered ... nothing that can be reproduced with a certain logic .. it happens pretty random but often

support from IE is limited as optifine has very low documentation on how to work with it or on how to debug ... i will not let this become a shitstorm but going closed source is not helping with modding

sp614x commented 8 years ago

How should it look like (screenshot)?

mindforger commented 8 years ago

http://ftb.gamepedia.com/Improved_Blast_Furnace

mindforger commented 8 years ago

stupid close and comment button -.-

ahhhh i forgot to mention 1.7.10 not 1.8.x

malte0811 commented 8 years ago

Is there a download for a deobf version of Optifne anywhere? I think I know how to fix this, but I don't want to have to build for every test and I don't want to work with obfuscated code either.

sp614x commented 8 years ago

If this is 1.7.10 and it happens randomly, then "Chunk Loading -> Default" might fix it?

malte0811 commented 8 years ago

It isn't happening randomly, it happens every time, and default chunk loading does not appear to change anything. I am going to explain a bit of the involved IE code and some observations I made while testing: Most multiblocks are rendered by a single block, usually in the middle. The detection for this block in case of the advanced blast furnace triggers for the "default" TileEntity (new TileEntityBlastFurnaceAdvanced()). This causes the blast furnace to be rendered from every block of the multiblock. Forming the multiblock is done by this code: It sets the block and edits the TileEntity afterwards. Apparently these changes are send to the client precisely if Optifine is not present, the NBT data of the client side TE is the default one if Optifine is installed. Relogging fixes it since it forces the NBT data to be synced. Another interesting observation is that it happens for all stone multiblocks, but not for any of the metal multiblocks that I tested, I will look into differences between the metal- and the stone multiblocks now.

malte0811 commented 8 years ago

Update: still no idea what actually causes this, but NBT data does not seem to be synced at all for the coke oven (I am using a coke oven for testing since it is a little less complex, but has the same problem). This seems to be the cause for the reported issue as well as for BluSunrize/ImmersiveEngineering#703. @sp614x Two questions:

  1. Does Optifine use ASM to edit mod classes/Is it certain that the code I write is the code that runs?
  2. Does Optifine change how NBT syncing is done? TileEntity.markDirty and World.markBlockForUpdate usually cause NBT data to be synced, that does not appear to be working for stone multiblocks in my test instance.
malte0811 commented 8 years ago

And second update: I have found a fix, but it appears to be a bug on Optifines side: Block.hasTileEntity(int metadata) is sometimes called with 0 as the metadata instead of 1. The block used for stone multiblocks does not have a tile entity for metadata 0, causing half of Minecraft to believe that there is a TileEntity and the other half that there is no TE. The calls with 0 as metatadata are done in the server thread and have net.minecraft.block.Block.func_149716_u(Block.java:511) as the stack trace element directly above IE's code.

sp614x commented 8 years ago

Full stack trace of the metadata 0 call?

malte0811 commented 8 years ago

http://pastebin.com/AfL4SibU

sp614x commented 8 years ago

OptiFine is not using ASM and is not modifiying external classes.

sp614x commented 8 years ago

"Video Settings -> Performance -> Lazy Chunk Loading -> OFF" could help. Cleaned up: http://pastebin.com/rVDwHYEy

mindforger commented 8 years ago

maybe it's my imagination, but this sounds more like a workaround than a solution?!

I mean you made quiet a bit of work there with optifine, but many mod devs and me also recommend not using optifine because of such interferences (this sounds so mean, i hopw you understand XD) ... and some mod devs develop an alergic shock to crash reports with optifine :)

malte0811 commented 8 years ago

"Video Settings -> Performance -> Lazy Chunk Loading -> OFF" could help.

Does not seem to change anything... I can work around it from IE by making hasTileEntity() return true independent of metadata, but it isn't really a "nice" solution.

sp614x commented 8 years ago

Problem found, testing the bugfix.

sp614x commented 8 years ago

Fixed in preview D4 for 1.7.10: http://optifine.net/adloadx?f=preview_OptiFine_1.7.10_HD_U_D4_pre.jar

sp614x commented 8 years ago

Seems to work: http://i.imgur.com/hpp07JC.png