Skip to content

Commit

Permalink
feat(events): add missing Hand parameter to EntityInteractEvent for 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Aug 14, 2024
1 parent 8d76c7e commit 0463791
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ private void onEntityInteract(Entity targetEntity,
CallbackInfoReturnable<Boolean> cir
//#endif
) {
if (EventsKt.postCancellableSync(new EntityInteractEvent(targetEntity))) {
if (EventsKt.postCancellableSync(new EntityInteractEvent(
//#if MC>=12000
//$$ targetEntity, hand
//#else
targetEntity
//#endif
))) {
//#if MC>12000
//$$ cir.setReturnValue(ActionResult.FAIL);
//#else
Expand Down
11 changes: 10 additions & 1 deletion events/src/main/kotlin/gg/skytils/event/impl/play/world.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import net.minecraft.item.ItemStack
import net.minecraft.util.BlockPos
import net.minecraft.world.World

//#if MC>=12000
//$$ import net.minecraft.util.Hand;
//#endif

/**
* [gg.skytils.event.mixins.MixinMinecraft.worldChange]
*/
Expand All @@ -36,4 +40,9 @@ class WorldUnloadEvent(val world: World) : Event()
*/
class BlockInteractEvent(val item: ItemStack, val pos: BlockPos) : CancellableEvent()

class EntityInteractEvent(val entity: Entity) : CancellableEvent()
class EntityInteractEvent(
val entity: Entity,
//#if MC>=12000
//$$ val hand: Hand
//#endif
) : CancellableEvent()

0 comments on commit 0463791

Please sign in to comment.