give rocket an owner
This commit is contained in:
parent
0a21a0432e
commit
6da38814d2
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.entity
|
|||||||
import net.minecraft.core.particles.ParticleTypes
|
import net.minecraft.core.particles.ParticleTypes
|
||||||
import net.minecraft.sounds.SoundEvent
|
import net.minecraft.sounds.SoundEvent
|
||||||
import net.minecraft.sounds.SoundEvents
|
import net.minecraft.sounds.SoundEvents
|
||||||
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.projectile.AbstractArrow
|
import net.minecraft.world.entity.projectile.AbstractArrow
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
@ -11,6 +12,7 @@ import net.minecraft.world.phys.EntityHitResult
|
|||||||
import ru.dbotthepony.mc.otm.registry.game.MEntityTypes
|
import ru.dbotthepony.mc.otm.registry.game.MEntityTypes
|
||||||
|
|
||||||
class RocketProjectile(level: Level) : AbstractArrow(MEntityTypes.ROCKET, level) {
|
class RocketProjectile(level: Level) : AbstractArrow(MEntityTypes.ROCKET, level) {
|
||||||
|
var owner: LivingEntity? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setBaseDamage(5.0)
|
setBaseDamage(5.0)
|
||||||
@ -29,7 +31,7 @@ class RocketProjectile(level: Level) : AbstractArrow(MEntityTypes.ROCKET, level)
|
|||||||
|
|
||||||
override fun onHitEntity(result: EntityHitResult) {
|
override fun onHitEntity(result: EntityHitResult) {
|
||||||
if (!level().isClientSide) {
|
if (!level().isClientSide) {
|
||||||
level().explode(null, x, y, z, 2.0f, Level.ExplosionInteraction.NONE)
|
level().explode(owner, x, y, z, 2.0f, Level.ExplosionInteraction.NONE)
|
||||||
discard()
|
discard()
|
||||||
}
|
}
|
||||||
super.onHitEntity(result)
|
super.onHitEntity(result)
|
||||||
@ -37,7 +39,7 @@ class RocketProjectile(level: Level) : AbstractArrow(MEntityTypes.ROCKET, level)
|
|||||||
|
|
||||||
override fun onHitBlock(result: BlockHitResult) {
|
override fun onHitBlock(result: BlockHitResult) {
|
||||||
if (!level().isClientSide) {
|
if (!level().isClientSide) {
|
||||||
level().explode(null, x, y, z, 2.0f, Level.ExplosionInteraction.NONE)
|
level().explode(owner, x, y, z, 2.0f, Level.ExplosionInteraction.NONE)
|
||||||
discard()
|
discard()
|
||||||
}
|
}
|
||||||
super.onHitBlock(result)
|
super.onHitBlock(result)
|
||||||
|
Loading…
Reference in New Issue
Block a user