HaCブロックに対してアイテム化してドロップさせるコード実行でエラーが発生
Closed this issue · 2 comments
RedRayz commented
一部のHaCブロックに対して以下のようなブロックをアイテム化してドロップするコードを実行するとエラーが発生します。
BlockEntity blockentity = state.hasBlockEntity() ? lv.getBlockEntity(pos) : null;
Block.dropResources(lv.getBlockState(pos), level, ドロップアイテムの出現位置, blockentity, null, ItemStack.EMPTY);
スタックトレースは以下の通りです。
[125月2023 23:08:25.045] [Server thread/ERROR] [net.minecraft.network.protocol.PacketUtils/]: Failed to handle packet net.minecraft.network.protocol.game.ServerboundPlayerActionPacket@48f67953, suppressing error
java.lang.NullPointerException: Cannot invoke "net.minecraftforge.registries.RegistryObject.get()" because "this.secondary" is null
at defeatedcrow.hac.core.material.block.OreBlockGemDC.getSecondary(OreBlockGemDC.java:55) ~[HeatAndClimate-1.19.2-v4-alpha5.jar%23234!/:1.19.2_v4-alpha5]
at defeatedcrow.hac.core.material.block.OreBlockGemDC.getAdditionalDrop(OreBlockGemDC.java:71) ~[HeatAndClimate-1.19.2-v4-alpha5.jar%23234!/:1.19.2_v4-alpha5]
at defeatedcrow.hac.core.material.block.BlockDC.m_7381_(BlockDC.java:40) ~[HeatAndClimate-1.19.2-v4-alpha5.jar%23234!/:1.19.2_v4-alpha5]
at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.m_60724_(BlockBehaviour.java:710) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.world.level.block.Block.m_49874_(Block.java:262) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.world.level.block.Block.m_49881_(Block.java:296) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.world.level.block.Block.m_6240_(Block.java:365) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.level.ServerPlayerGameMode.m_9280_(ServerPlayerGameMode.java:256) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.level.ServerPlayerGameMode.m_215116_(ServerPlayerGameMode.java:218) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.level.ServerPlayerGameMode.m_214168_(ServerPlayerGameMode.java:188) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.m_7502_(ServerGamePacketListenerImpl.java:1024) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.m_5797_(ServerboundPlayerActionPacket.java:42) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.m_5797_(ServerboundPlayerActionPacket.java:8) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.network.protocol.PacketUtils.m_131356_(PacketUtils.java:22) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:157) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:763) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:157) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:131) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.MinecraftServer.m_129961_(MinecraftServer.java:746) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.MinecraftServer.m_7245_(MinecraftServer.java:740) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.util.thread.BlockableEventLoop.m_18701_(BlockableEventLoop.java:140) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.MinecraftServer.m_130012_(MinecraftServer.java:726) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:658) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:244) ~[client-1.19.2-20220805.130853-srg.jar%23265!/:?]
at java.lang.Thread.run(Thread.java:833) [?:?]
defeatedcrow/hac/core/material/block/OreBlockGemDC.javaの55行目の三項演算子のミスが原因であると思います。
defeatedcrow commented
ご報告ありがとうございます。
おっしゃるとおりミスでしたので修正しました。次回更新時に反映します。
defeatedcrow commented
Fixed at e6d8360