- 2,955
- 12
Я даже дам пример.
class EntityParticleSpawner(world: World, maxLive: Int) extends EntityLiving(world) {
setInvisible(true)
override def attackEntityFrom(source: DamageSource, amount: Float) : Boolean = false;
def onUpdate() = {
val live: Int = 0
if(live <= maxLive) {
live + 1
if(world.isRemote) {
spawnParticle(posX, posY, posZ, world)
}
} else {
setDead()
}
}
@SideOnly(Side.CLIENT)
def spawnParticle(x: Double, y: Double, z: Double, w: World) = {
val flameFX: EntityFlameFX = new EntityFlameFX(w, x, y, z, 0.0D, 0.0D, 0.0D)
Minecraft.getMinecraft.effectRenderer.addEffect(flame)
}
}
class EntityParticleSpawner(world: World, maxLive: Int) extends EntityLiving(world) {
setInvisible(true)
override def attackEntityFrom(source: DamageSource, amount: Float) : Boolean = false;
def onUpdate() = {
val live: Int = 0
if(live <= maxLive) {
live + 1
if(world.isRemote) {
spawnParticle(posX, posY, posZ, world)
}
} else {
setDead()
}
}
@SideOnly(Side.CLIENT)
def spawnParticle(x: Double, y: Double, z: Double, w: World) = {
val flameFX: EntityFlameFX = new EntityFlameFX(w, x, y, z, 0.0D, 0.0D, 0.0D)
Minecraft.getMinecraft.effectRenderer.addEffect(flame)
}
}