[1.12.2]如何监听宝箱首次开启,或者监听原版网络事件? #102
Unanswered
TaoismDeepLake
asked this question in
Q&A
Replies: 3 comments 1 reply
-
|
你新写一个箱子就行了。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
直接监听与方块交互的事件呢( |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
这个问题解决了,打开宝箱的时候判断loottable是否是null就得了 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
简单来说,我想做个像原神里那种“每当玩家开启宝箱时,回血”的效果,然而mc里箱子可以反复开,我不想让玩家靠这个反复刷触发。
经查找,我发现TileEntityLockableLoot.lootTable的为空与否可以用来判断此事件。每当玩家打开一个箱子时,如果该内容为不为空,则生成宝箱内容,但这不触发任何事件。
摘自EntityPlayerMP:
我看到有个PlayerContainerEvent,但那是在宝箱内容生成之后触发了,无论是否首次打开都已经该值为空。
我也看到前面有个sendPacket的地方,那我是否有办法监听这个packet的内容?那样的话我就能在lootTable被清掉之前监听到。
当然,如果有其他方法实现最开始说的“每当首次开某个宝箱时,做某事“”,也请不吝赐教
Beta Was this translation helpful? Give feedback.
All reactions