Skip to content

Commit

Permalink
Fix Feature Pickup
Browse files Browse the repository at this point in the history
  • Loading branch information
Cierra-Runis committed Nov 18, 2024
1 parent b6dc6d7 commit aec349d
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package pers.cierra_runis.survired.pickup
package pers.cierra_runis.survired.features.pickup

import net.fabricmc.fabric.api.event.player.UseEntityCallback
import net.minecraft.entity.Entity
import net.minecraft.item.ItemStack
import net.minecraft.item.SpawnEggItem
import net.minecraft.nbt.NbtCompound
import net.minecraft.util.ActionResult
import org.slf4j.LoggerFactory
import pers.cierra_runis.survired.common.SurviRedRegister

object SurviRedPickupEventListener {
private val logger = LoggerFactory.getLogger(this.javaClass)

fun registerRightClickEvent() {
object SurviRedPickup : SurviRedRegister {
override fun register() {
UseEntityCallback.EVENT.register(UseEntityCallback { playerEntity, world, hand, entity, entityHitResult ->
if (!playerEntity.isSneaking) return@UseEntityCallback ActionResult.PASS

Expand All @@ -21,7 +19,7 @@ object SurviRedPickupEventListener {
for (key in arrayOf("Pos", "Motion", "Rotation", "UUID")) entityNbt.remove(key)

val stack = ItemStack(spawnEgg).apply {
NbtCompound().apply {
nbt = NbtCompound().apply {
put("EntityTag", entityNbt)
}
}
Expand Down

0 comments on commit aec349d

Please sign in to comment.