Update WitheredSkeletonSpawnHandler implementation
This commit is contained in:
parent
67ea3b977b
commit
e97967903b
@ -6,23 +6,24 @@ import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.Items
|
||||
import net.neoforged.bus.api.SubscribeEvent
|
||||
import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent
|
||||
import ru.dbotthepony.mc.otm.core.otmRandom
|
||||
import ru.dbotthepony.mc.otm.registry.game.MItems
|
||||
|
||||
|
||||
object WitheredSkeletonSpawnHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
fun onEntityJoin(event: EntityJoinLevelEvent) {
|
||||
val entity = event.entity
|
||||
if (entity is WitherSkeleton){
|
||||
|
||||
val giveHelmet = entity.random.nextFloat() < 0.1f
|
||||
val giveSword = entity.random.nextFloat() < 0.24f
|
||||
if (entity is WitherSkeleton) {
|
||||
val giveHelmet = event.level.otmRandom.nextFloat() < 0.1f
|
||||
val giveSword = event.level.otmRandom.nextFloat() < 0.24f
|
||||
|
||||
if (giveHelmet) {
|
||||
entity.setItemSlot(EquipmentSlot.HEAD, ItemStack(Items.NETHERITE_HELMET))
|
||||
entity.setItemSlot(EquipmentSlot.MAINHAND, ItemStack(MItems.WITHERED_STEEL_SWORD))
|
||||
} else if (giveSword) {
|
||||
}
|
||||
|
||||
if (giveSword || giveHelmet) {
|
||||
entity.setItemSlot(EquipmentSlot.MAINHAND, ItemStack(MItems.WITHERED_STEEL_SWORD))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user