update minecart item
This commit is contained in:
parent
d4806dfb2a
commit
ecb9d8a95d
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.item
|
package ru.dbotthepony.mc.otm.item
|
||||||
|
|
||||||
import net.minecraft.core.Direction
|
import net.minecraft.core.Direction
|
||||||
|
import net.minecraft.core.component.DataComponents
|
||||||
import net.minecraft.core.dispenser.BlockSource
|
import net.minecraft.core.dispenser.BlockSource
|
||||||
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior
|
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior
|
||||||
import net.minecraft.core.dispenser.DispenseItemBehavior
|
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 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)
|
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
|
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)
|
val entity = MinecartCargoCrate(type, color, level, x, y + d3, z)
|
||||||
|
|
||||||
if (itemStack.hasCustomHoverName()) {
|
if (itemStack.has(DataComponents.CUSTOM_NAME)) {
|
||||||
entity.customName = itemStack.hoverName
|
entity.customName = itemStack.hoverName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user