update minecart item

This commit is contained in:
DBotThePony 2024-08-10 01:39:07 +07:00
parent d4806dfb2a
commit ecb9d8a95d
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -1,6 +1,7 @@
package ru.dbotthepony.mc.otm.item
import net.minecraft.core.Direction
import net.minecraft.core.component.DataComponents
import net.minecraft.core.dispenser.BlockSource
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior
import net.minecraft.core.dispenser.DispenseItemBehavior
@ -49,7 +50,7 @@ class MinecartCargoCrateItem(val color: DyeColor?) : MatteryItem(Properties().st
val type = MEntityTypes.CARGO_CRATE_MINECARTS[color] ?: throw NullPointerException("Unable to find minecart entity type for color $color!")
val entity = MinecartCargoCrate(type, color, level, blockpos.x.toDouble() + 0.5, blockpos.y.toDouble() + 0.0625 + d0, blockpos.z.toDouble() + 0.5)
if (itemstack.hasCustomHoverName()) {
if (itemstack.has(DataComponents.CUSTOM_NAME)) {
entity.customName = itemstack.hoverName
}
@ -107,7 +108,7 @@ class MinecartCargoCrateItem(val color: DyeColor?) : MatteryItem(Properties().st
val entity = MinecartCargoCrate(type, color, level, x, y + d3, z)
if (itemStack.hasCustomHoverName()) {
if (itemStack.has(DataComponents.CUSTOM_NAME)) {
entity.customName = itemStack.hoverName
}