maruohon / placementpreview

A Minecraft mod that renders a preview of the blocks that would be placed
GNU General Public License v3.0
8 stars 2 forks source link

[1.10.2] Strange Fake World Rendering #9

Open ChloeDawn opened 7 years ago

ChloeDawn commented 7 years ago

I placed and broke a trough from Animalia, but it continued to render when mousing over blocks in the world, even with an empty hand. The same occurred with a Mekanism advanced solar panel a few months ago, but I forgot to report it until now.

Mod version: 1.10.2-0.3.0 Forge version: 1.10.2-12.18.3.2221

I tried adding the trough to the blacklist, then placed one and broke it. It continued to render in the world, and everything else I broke got replaced with a fake render of itself from what i presume is your fake world. This message was printed to the console when I broke the trough:

[placementpreview]: Block 'minecraft:air' at BlockPos{x=-98, y=65, z=152} threw an exception while trying to copy it to the fake world, blacklisting it for this session

As I moved around, more blocks from the fake world started rendering, and eventually the game became unplayable with the amount of fake world blocks being rendered. Here is a collection of clips showing what happened.

Breaking blocks in the world: https://streamable.com/a416x Placing new blocks in the world: https://streamable.com/ozhyt Looking at a block after moving around in the world: https://streamable.com/w3kts

ChloeDawn commented 7 years ago

Picked up on another thrown exception that causes fake world rendering problems: bark blocks.

[placementpreview]: Block 'minecraft:log[axis=none,variant=oak]' at BlockPos{x=-46, y=66, z=336} threw an exception while trying to copy it to the fake world, blacklisting it for this session

maruohon commented 7 years ago

I have now officially released new versions for both 1.10.2 and 1.11.2 (0.3.2 and 0.3.3 respectively), which include several fixes for various crash issues. There are also more fixes made today on top of the earlier test build I gave you. Could you try if these new versions fix the issues you were having?

Zelaphor commented 7 years ago

So, I've been having the same issue, and I'm using Placement Preview 0.3.3 on Minecraft 1.10.2

[17:17:58] [Client thread/WARN]: Block 'minecraft:air' at BlockPos{x=-85, y=58, z=0} threw an exception while trying to copy it to the fake world, blacklisting it for this session

As you can see, your mod is blacklisting air blocks from the preview, which logically, could cause the issue at hand. The same thing is happening in InsomniaKitten's inital report.  I figure that without being able to place air in the preview world, it can't clear out old blocks, and it shows sections of the world as a result.  Holding a block which can be previewed also makes it preview as it should, but the block is never removed from the preview, so you end up with copies of it everywhere you've looked while holding the block.

That said, I could be totally wrong, but I do feel like the behavior makes sense for the situation, so I  would suggest just making sure that the mod is unable to blacklist air as a whole.

maruohon commented 7 years ago

Well, the exception likely comes from some other block that is tried to be replaced by air... which then results in the air block getting blacklisted instead, because it's what is being read from the real world and tried to be written to the fake world. The end result being of course that you are right, I should exclude air from being blacklisted.

Does the log include the stacktrace from that exception? (it should) It might help me fix something that is ultimately causing the exception in the first place.

Zelaphor commented 7 years ago

Quick reply, I am impressed.

Can't say for sure that it's specifically blocks being replaced with air, because it happens just from running around with the preview enabled for a while.

Is this what you needed? If not, the full log log should be attached, and the error occurs a whole bunch of times. I was testing what caused it for a while. The Redstone interface is also not the only block which makes the mod blacklist air, so if you'd like to see what else is doing it, I suggest looking through the log.

java.lang.NullPointerException
    at lumien.randomthings.block.BlockRedstoneInterface.func_180663_b(BlockRedstoneInterface.java:50) ~[BlockRedstoneInterface.class:?]
    at fi.dy.masa.placementpreview.fake.FakeChunk.setBlockState(FakeChunk

.java:68) ~[FakeChunk.class:?]
    at fi.dy.masa.placementpreview.fake.FakeWorld.setBlockState(FakeWorld.java:178) ~[FakeWorld.class:?]
    at fi.dy.masa.placementpreview.event.TickHandler.copyCurrentBlocksToFakeWorld(TickHandler.java:405) [TickHandler.class:?]
    at fi.dy.masa.placementpreview.event.TickHandler.checkAndUpdateBlocks(TickHandler.java:248) [TickHandler.class:?]
    at fi.dy.masa.placementpreview.event.TickHandler.onClientTick(TickHandler.java:95) [TickHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_825_TickHandler_onClientTick_ClientTickEvent.invoke(.dynamic) [?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) [ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) [EventBus.class:?]
    at net.minecraftforge.fml.common.FMLCommonHandler.onPostClientTick(FMLCommonHandler.java:344) [FMLCommonHandler.class:?]
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1851) [bcx.class:?]
    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1055) [bcx.class:?]
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:371) [bcx.class:?]
    at net.minecraft.client.main.Main.main(SourceFile:124) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
    at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
[17:17:09] [Server thread/INFO]: Saving and pausing game...
[17:17:09] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[17:17:09] [Server thread/INFO]: Saving chunks for level 'New World'/ExtraUtils2_Quarry_Dim
[17:17:09] [Server thread/INFO]: Saving chunks for level 'New World'/fakeend
[17:17:09] [Server thread/INFO]: Saving chunks for level 'New World'/fakenether
[17:17:09] [Server thread/INFO]: Saving chunks for level 'New World'/fakeoverworld
[17:17:09] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[17:17:29] [Server thread/INFO]: Saving and pausing game...
[17:17:29] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[17:17:30] [Server thread/INFO]: Saving chunks for level 'New World'/ExtraUtils2_Quarry_Dim
[17:17:30] [Server thread/INFO]: Saving chunks for level 'New World'/fakeend
[17:17:30] [Server thread/INFO]: Saving chunks for level 'New World'/fakenether
[17:17:30] [Server thread/INFO]: Saving chunks for level 'New World'/fakeoverworld
[17:17:30] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[17:17:46] [Client thread/WARN]: CCL's Dummy mod was not found inside the mod gui list!
[17:17:58] [Client thread/WARN]: Block 'minecraft:air' at BlockPos{x=-85, y=58, z=0} threw an exception while trying to copy it to the fake world, blacklisting it for this session

latest.txt

maruohon commented 7 years ago

Hmm, seems that the Redstone Interface doesn't check that the world has the TileEntity, when the block is being broken: https://github.com/lumien231/Random-Things/blob/1.10.2/src/main/java/lumien/randomthings/block/BlockRedstoneInterface.java#L50

Which means that if the TileEntity failed to get created, then removing that block isn't possible as it will crash when something else is attempted to set there... :D I guess I'll need to add a try-catch in the FakeChunk#setBlockState() method to protect against naughty blocks trying to crash while being broken.

Zelaphor commented 7 years ago

Yeah, that sounds like it would cause problems. That said, I'm not breaking the block myself, so it may have something to to with how the Tile Entities update with new data that essentially removes the block, and replaces it with a new one. Don't have a good enough knowledge of the code to be sure though.

I would still recommend excluding air from being blacklisted, but I would definitely make sure the errors still report so that the cause can be fixed.

ComputerCraft computers, and Hatchery nesting pens also cause it to break, so they likely have the same problem. Here's another section of the same log, if you feel like looking into it.

Also, thank you very much for listening, and continuing to improve the mod, I truly appreciate it!

java.lang.NullPointerException
    at dan200.computercraft.shared.computer.blocks.TileComputerBase.writeDescription(TileComputerBase.java:126) ~[TileComputerBase.class:?]
    at dan200.computercraft.shared.common.TileGeneric.func_189517_E_(TileGeneric.java:17) ~[TileGeneric.class:?]
    at fi.dy.masa.placementpreview.event.TickHandler.copyCurrentBlocksToFakeWorld(TickHandler.java:416) [TickHandler.class:?]
    at fi.dy.masa.placementpreview.event.TickHandler.checkAndUpdateBlocks(TickHandler.java:248) [TickHandler.class:?]
    at fi.dy.masa.placementpreview.event.TickHandler.onClientTick(TickHandler.java:95) [TickHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_825_TickHandler_onClientTick_ClientTickEvent.invoke(.dynamic) [?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) [ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) [EventBus.class:?]
    at net.minecraftforge.fml.common.FMLCommonHandler.onPostClientTick(FMLCommonHandler.java:344) [FMLCommonHandler.class:?]
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1851) [bcx.class:?]
    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1055) [bcx.class:?]
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:371) [bcx.class:?]
    at net.minecraft.client.main.Main.main(SourceFile:124) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
    at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
[17:04:23] [Client thread/WARN]: Block 'minecraft:air' at BlockPos{x=-88, y=58, z=31} threw an exception while trying to copy it to the fake world, blacklisting it for this session

java.lang.NullPointerException
    at com.gendeathrow.hatchery.block.nestpen.NestingPenBlock.func_180663_b(NestingPenBlock.java:160) ~[NestingPenBlock.class:?]
    at fi.dy.masa.placementpreview.fake.FakeChunk.setBlockState(FakeChunk.java:68) ~[FakeChunk.class:?]
    at fi.dy.masa.placementpreview.fake.FakeWorld.setBlockState(FakeWorld.java:178) ~[FakeWorld.class:?]
    at fi.dy.masa.placementpreview.event.TickHandler.copyCurrentBlocksToFakeWorld(TickHandler.java:405) [TickHandler.class:?]
    at fi.dy.masa.placementpreview.event.TickHandler.checkAndUpdateBlocks(TickHandler.java:248) [TickHandler.class:?]
    at fi.dy.masa.placementpreview.event.TickHandler.onClientTick(TickHandler.java:95) [TickHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_825_TickHandler_onClientTick_ClientTickEvent.invoke(.dynamic) [?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) [ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) [EventBus.class:?]
    at net.minecraftforge.fml.common.FMLCommonHandler.onPostClientTick(FMLCommonHandler.java:344) [FMLCommonHandler.class:?]
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1851) [bcx.class:?]
    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1055) [bcx.class:?]
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:371) [bcx.class:?]
    at net.minecraft.client.main.Main.main(SourceFile:124) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
    at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
[17:04:24] [Client thread/WARN]: Block 'minecraft:fence[east=false,north=false,south=false,west=false]' at BlockPos{x=-85, y=58, z=32} threw an exception while trying to copy it to the fake world, blacklisting it for this session
maruohon commented 7 years ago

A big part of the problem with this mod is that I need to copy the blocks to the fake world from the client world. That causes issues with many mod TileEntities, since they often throw exceptions if the writeToNBT() or getUpdateTag() method is called on the client side, as they might need data or resources that are normally only available on the server. I will probably need to rewrite the way I copy the blocks a bit, so that I separately clear the fake world's blocks using a separate method, before copying the new blocks over. And I'll also need to see if there is a better way to copy over the TileEntities.

Zelaphor commented 7 years ago

Hm, very interesting. That sounds like a lot of work to do, and like it would take some time. Hopefully you can get things worked out, and you enjoy doing it, since that's the most important thing!