Chipped

Chipped

67M Downloads

[Bug]: Errors when attempting to mine multiple Chipped blocks with GregTech tools

jtuc opened this issue ยท 1 comments

commented

Bug Description

When mining Chipped blocks with GregTech tools, if you attempt to mine multiple Chipped blocks, one block will appear to be removed on the client. The "removed" block will reappear if e.g. you attempt to replace it with another block, and you will be unable to move into the gap.

Also, the log will fill with exceptions, e.g.

[minecraft/PacketUtils]: Failed to handle packet net.minecraft.network.protocol.game.ServerboundPlayerActionPacket@6bc10449, suppressing error
java.lang.UnsupportedOperationException: null
	at java.util.ImmutableCollections.uoe(ImmutableCollections.java:142) ~[?:?] {}
	at java.util.ImmutableCollections$ListItr.remove(ImmutableCollections.java:380) ~[?:?] {}
	at com.gregtechceu.gtceu.common.item.tool.ToolEventHandlers.onHarvestDrops(ToolEventHandlers.java:145) 

I think this is probably due to the Chipped BlockBehaviourMixin returning an immutable list (List.of(...))?
https://github.com/terrarium-earth/Chipped/blob/1.20.1/common/src/main/java/earth/terrarium/chipped/mixins/BlockBehaviourMixin.java#L46
In vanilla, only empty/mutable lists are returned here, and GregTech's ToolEventHandlers attempts to call remove on the iterator:
https://github.com/GregTechCEu/GregTech-Modern/blob/1.20.1/src/main/java/com/gregtechceu/gtceu/common/item/tool/ToolEventHandlers.java#L145

In theory this could be worked around in GregTech by copying the list, but I suspect other mods will also assume that the drop list is mutable; changing the Chipped mixin could fix those too.

How to Reproduce?

  1. Install GregTech and Chipped
  2. /give @p gtceu:iv_naquadah_alloy_drill
  3. /give @p chipped:hazard_black_concrete 64
  4. Place the blocks; attempt to mine multiple with the drill
  5. Observe that only one block is removed, and that gap still has collision

Expected Behavior

I would expect the drill to remove all the concrete, and no errors to appear in the log.

Version

3.0.7

Mod Loader Version

1.20.1 - 47.3.0

Mod Loader

Forge

Logs or additional context

GregTech Modern version: 1.6.3

[16:48:24] [Server thread/ERROR] [minecraft/PacketUtils]: Failed to handle packet net.minecraft.network.protocol.game.ServerboundPlayerActionPacket@6bc10449, suppressing error
java.lang.UnsupportedOperationException: null
	at java.util.ImmutableCollections.uoe(ImmutableCollections.java:142) ~[?:?] {}
	at java.util.ImmutableCollections$ListItr.remove(ImmutableCollections.java:380) ~[?:?] {}
	at com.gregtechceu.gtceu.common.item.tool.ToolEventHandlers.onHarvestDrops(ToolEventHandlers.java:145) ~[gtceu-1.20.1-1.6.3.jar%23165!/:1.6.3] {re:mixin,re:classloading}
	at net.minecraft.world.level.block.Block.modifyReturnValue$zce000$gtceu$modifyDrops(Block.java:659) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:gtceu.mixins.json:BlockMixin,pl:mixin:A}
	at net.minecraft.world.level.block.Block.m_49874_(Block.java:258) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:gtceu.mixins.json:BlockMixin,pl:mixin:A}
	at net.minecraft.world.level.block.Block.dropResources(Block.java:286) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:gtceu.mixins.json:BlockMixin,pl:mixin:A}
	at net.minecraft.world.level.block.Block.m_6240_(Block.java:356) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:gtceu.mixins.json:BlockMixin,pl:mixin:A}
	at net.minecraft.server.level.ServerPlayerGameMode.m_9280_(ServerPlayerGameMode.java:256) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:classloading}
	at net.minecraft.server.level.ServerPlayerGameMode.m_215116_(ServerPlayerGameMode.java:218) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:classloading}
	at net.minecraft.server.level.ServerPlayerGameMode.m_214168_(ServerPlayerGameMode.java:188) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:classloading}
	at net.minecraft.server.network.ServerGamePacketListenerImpl.m_7502_(ServerGamePacketListenerImpl.java:1020) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:gtceu.mixins.json:ServerGamePacketListenerImplAccessor,pl:mixin:A}
	at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.m_5797_(ServerboundPlayerActionPacket.java:42) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:classloading}
	at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.m_5797_(ServerboundPlayerActionPacket.java:8) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:classloading}
	at net.minecraft.network.protocol.PacketUtils.m_263899_(PacketUtils.java:22) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:classloading}
	at net.minecraft.server.TickTask.run(TickTask.java:18) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:classloading}
	at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:156) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,re:computing_frames,re:classloading}
	at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:770) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:161) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:130) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.m_129961_(MinecraftServer.java:753) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.m_7245_(MinecraftServer.java:747) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.thread.BlockableEventLoop.m_18699_(BlockableEventLoop.java:115) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.m_130012_(MinecraftServer.java:732) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:665) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[client-1.20.1-20230612.114412-srg.jar%23168!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:833) ~[?:?] {re:mixin}

Code of Conduct

  • I have searched the issue tracker and confirmed that the issue has not been reported
  • I have checked the FAQ (if one is present) and my issue is not listed
  • I have verified that I am using the latest version of the mod
  • I have verified that I have installed all the required dependencies for the mod
  • I have verified that I do not have Optifine installed. We will close issues if we detect Optifine is in your pack. We cannot fix Optifine issues. Please do not report issues with Optifine present.
commented

This is a greg tech issue, blocks can override this there is no requirement that it must be mutable, empty list for example is immutable