some kind of more projectile changes
This commit is contained in:
parent
5e067b7567
commit
e5e08fcf07
@ -15,6 +15,7 @@ import net.minecraft.nbt.ListTag
|
|||||||
import net.minecraft.nbt.LongArrayTag
|
import net.minecraft.nbt.LongArrayTag
|
||||||
import net.minecraft.nbt.Tag
|
import net.minecraft.nbt.Tag
|
||||||
import net.minecraft.world.Container
|
import net.minecraft.world.Container
|
||||||
|
import net.minecraft.world.entity.Entity
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.phys.Vec3
|
import net.minecraft.world.phys.Vec3
|
||||||
@ -162,3 +163,7 @@ inline fun <T> LazyOptional<T>.ifPresentK(lambda: (T) -> Unit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val ItemStack.tagNotNull get() = orCreateTag
|
val ItemStack.tagNotNull get() = orCreateTag
|
||||||
|
|
||||||
|
inline var Entity.position: Vec3
|
||||||
|
get() = position()
|
||||||
|
set(value) { setPos(value) }
|
||||||
|
@ -12,13 +12,19 @@ import net.minecraft.world.phys.BlockHitResult
|
|||||||
import net.minecraft.world.phys.EntityHitResult
|
import net.minecraft.world.phys.EntityHitResult
|
||||||
import net.minecraft.world.phys.HitResult
|
import net.minecraft.world.phys.HitResult
|
||||||
import net.minecraftforge.event.ForgeEventFactory
|
import net.minecraftforge.event.ForgeEventFactory
|
||||||
|
import ru.dbotthepony.mc.otm.core.Vector
|
||||||
|
import ru.dbotthepony.mc.otm.registry.MEntityTypes
|
||||||
import ru.dbotthepony.mc.otm.registry.PlasmaDamageSource
|
import ru.dbotthepony.mc.otm.registry.PlasmaDamageSource
|
||||||
|
|
||||||
class PlasmaProjectile(type: EntityType<out PlasmaProjectile>, level: Level) : Projectile(type, level) {
|
class PlasmaProjectile(level: Level) : Projectile(MEntityTypes.PLASMA as EntityType<out Projectile>, level) {
|
||||||
var inflictor: ItemStack? = null
|
var inflictor: ItemStack? = null
|
||||||
var damage = 6.0f
|
var damage = 6.0f
|
||||||
var ttl = 200
|
var ttl = 200
|
||||||
|
|
||||||
|
init {
|
||||||
|
deltaMovement = Vector(1.0, 0.0, 0.0)
|
||||||
|
}
|
||||||
|
|
||||||
override fun defineSynchedData() {
|
override fun defineSynchedData() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -46,7 +52,7 @@ class PlasmaProjectile(type: EntityType<out PlasmaProjectile>, level: Level) : P
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun tick() {
|
override fun tick() {
|
||||||
if (ttl-- <= 0) {
|
if (--ttl <= 0) {
|
||||||
discard()
|
discard()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import net.minecraft.world.entity.player.Player
|
|||||||
import net.minecraft.world.entity.projectile.Arrow
|
import net.minecraft.world.entity.projectile.Arrow
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import ru.dbotthepony.mc.otm.core.ImpreciseFraction
|
import ru.dbotthepony.mc.otm.core.ImpreciseFraction
|
||||||
|
import ru.dbotthepony.mc.otm.entity.PlasmaProjectile
|
||||||
|
import ru.dbotthepony.mc.otm.position
|
||||||
|
|
||||||
class PlasmaRifleItem : PlasmaWeaponItem<WeaponDataTable>(WeaponDataTable::class, ImpreciseFraction(200_000)) {
|
class PlasmaRifleItem : PlasmaWeaponItem<WeaponDataTable>(WeaponDataTable::class, ImpreciseFraction(200_000)) {
|
||||||
override val roundsPerMinute: Int = 400
|
override val roundsPerMinute: Int = 400
|
||||||
@ -18,6 +20,10 @@ class PlasmaRifleItem : PlasmaWeaponItem<WeaponDataTable>(WeaponDataTable::class
|
|||||||
arrow.shootFromRotation(player, player.xRot, player.yRot, 0f, 2f, 0f)
|
arrow.shootFromRotation(player, player.xRot, player.yRot, 0f, 2f, 0f)
|
||||||
|
|
||||||
player.level.addFreshEntity(arrow)
|
player.level.addFreshEntity(arrow)
|
||||||
|
|
||||||
|
//val arrow = PlasmaProjectile(player.level)
|
||||||
|
//arrow.position = player.position
|
||||||
|
//player.level.addFreshEntity(arrow)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -11,7 +11,9 @@ import ru.dbotthepony.mc.otm.entity.PlasmaProjectile
|
|||||||
object MEntityTypes {
|
object MEntityTypes {
|
||||||
private val registry: DeferredRegister<EntityType<*>> = DeferredRegister.create(ForgeRegistries.ENTITIES, OverdriveThatMatters.MOD_ID)
|
private val registry: DeferredRegister<EntityType<*>> = DeferredRegister.create(ForgeRegistries.ENTITIES, OverdriveThatMatters.MOD_ID)
|
||||||
|
|
||||||
val PLASMA: EntityType<*> by registry.register(MNames.PLASMA) { EntityType.Builder.of(::PlasmaProjectile, MobCategory.MISC).build(MNames.PLASMA) }
|
val PLASMA: EntityType<*> by registry.register(MNames.PLASMA) {
|
||||||
|
EntityType.Builder.of<PlasmaProjectile>({ _, level -> PlasmaProjectile(level) }, MobCategory.MISC).build(MNames.PLASMA)
|
||||||
|
}
|
||||||
|
|
||||||
internal fun register() {
|
internal fun register() {
|
||||||
registry.register(FMLJavaModLoadingContext.get().modEventBus)
|
registry.register(FMLJavaModLoadingContext.get().modEventBus)
|
||||||
|
Loading…
Reference in New Issue
Block a user