codetaylor / pyrotech-1.12

An early game mod with new primitive devices, combustion machines, smelting mechanics, storage options, tools, torches, advancements, and absolutely zero GUIs -- with exception to the substantially complete, mostly illustrated, and charred guidebook.
https://pyrotech.readthedocs.io/en/latest/
Other
52 stars 19 forks source link

Error when clicking compactor with a hammer #246

Closed jamesreii closed 4 years ago

jamesreii commented 4 years ago

Issue Description

VanillaFix notices an error when I click on a mechanical compactor with a hammer

If this issue occurs in a modpack, please report this to the modpack author. Also, please take the time to look at existing issues to ensure you don't create a duplicate. You may remove this line and place your issue description here.

What Happens

Does not crash me but gives me an error when I click on a mechanical compactor with any hammer

What You Expect to Happen

No error involved

I wouldn't really expect anything to happen since you dont usually use a hammer with the compactors lol

Crash Log

https://paste.dimdev.org/azabazehoh.mccrash

Affected Versions

Do not use latest; please supply accurate version numbers.

codetaylor commented 4 years ago

Thanks for the report!

I was able to reproduce this by using an empty hand, holding down the right mouse button and moving the crosshairs from the mechanical compacting bin (the bin part) to an adjacent stone worktable.

[14:15:57] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.ClassCastException: com.codetaylor.mc.pyrotech.modules.tech.basic.tile.TileWorktableStone cannot be cast to com.codetaylor.mc.pyrotech.modules.tech.basic.tile.TileCompactingBin
    at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_144]
    at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_144]
    at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
Caused by: java.lang.ClassCastException: com.codetaylor.mc.pyrotech.modules.tech.basic.tile.TileWorktableStone cannot be cast to com.codetaylor.mc.pyrotech.modules.tech.basic.tile.TileCompactingBin
    at com.codetaylor.mc.pyrotech.modules.tech.basic.tile.TileCompactingBin$InteractionShovel.allowInteraction(TileCompactingBin.java:352) ~[TileCompactingBin$InteractionShovel.class:?]
    at com.codetaylor.mc.pyrotech.interaction.spi.InteractionUseItemBase.interact(InteractionUseItemBase.java:33) ~[InteractionUseItemBase.class:?]
    at com.codetaylor.mc.pyrotech.interaction.spi.ITileInteractable.interact(ITileInteractable.java:130) ~[ITileInteractable.class:?]
    at com.codetaylor.mc.pyrotech.interaction.spi.IBlockInteractable.interact(IBlockInteractable.java:35) ~[IBlockInteractable.class:?]
    at com.codetaylor.mc.pyrotech.modules.tech.basic.block.spi.BlockWorktableBase.onBlockActivated(BlockWorktableBase.java:57) ~[BlockWorktableBase.class:?]
    at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:475) ~[PlayerInteractionManager.class:?]
    at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:769) ~[NetHandlerPlayServer.class:?]
    at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?]
    at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?]
    at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_144]
    at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) ~[?:1.8.0_144]
    at java.util.concurrent.FutureTask.run(FutureTask.java) ~[?:1.8.0_144]
    at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
    ... 5 more

This can also be caused by placing a crate adjacent to a worktable and performing the same steps.

Caused by: java.lang.ClassCastException: com.codetaylor.mc.pyrotech.modules.storage.tile.TileCrate cannot be cast to com.codetaylor.mc.pyrotech.modules.tech.basic.tile.TileWorktable

This seems to occur when the client sends a packet indicating a client click and the server's player head position is updated before the server's raycast takes place. The server's raycast then returns a different position than the block actually clicked.

Should be fixed in 1.4.12.