修改其他爆炸物的爆炸类型,添加波塞克,M79,RPG的怪物特攻
This commit is contained in:
parent
590e20e047
commit
9f355a1003
8 changed files with 113 additions and 49 deletions
|
@ -14,6 +14,7 @@ import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.monster.Monster;
|
||||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||||
import net.minecraft.world.entity.projectile.ItemSupplier;
|
import net.minecraft.world.entity.projectile.ItemSupplier;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -35,6 +36,8 @@ import java.util.Optional;
|
||||||
public class BocekArrowEntity extends AbstractArrow implements ItemSupplier {
|
public class BocekArrowEntity extends AbstractArrow implements ItemSupplier {
|
||||||
public static final ItemStack PROJECTILE_ITEM = new ItemStack(Items.ARROW);
|
public static final ItemStack PROJECTILE_ITEM = new ItemStack(Items.ARROW);
|
||||||
|
|
||||||
|
private int monsterMultiplier = 0;
|
||||||
|
|
||||||
public BocekArrowEntity(EntityType<? extends BocekArrowEntity> type, Level world) {
|
public BocekArrowEntity(EntityType<? extends BocekArrowEntity> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
}
|
}
|
||||||
|
@ -43,8 +46,9 @@ public class BocekArrowEntity extends AbstractArrow implements ItemSupplier {
|
||||||
super(type, x, y, z, world);
|
super(type, x, y, z, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BocekArrowEntity(LivingEntity entity, Level level) {
|
public BocekArrowEntity(LivingEntity entity, Level level, int monsterMultiplier) {
|
||||||
super(TargetModEntities.BOCEK_ARROW.get(), entity, level);
|
super(TargetModEntities.BOCEK_ARROW.get(), entity, level);
|
||||||
|
this.monsterMultiplier = monsterMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BocekArrowEntity(PlayMessages.SpawnEntity packet, Level world) {
|
public BocekArrowEntity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
|
@ -80,6 +84,8 @@ public class BocekArrowEntity extends AbstractArrow implements ItemSupplier {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHitEntity(EntityHitResult result) {
|
protected void onHitEntity(EntityHitResult result) {
|
||||||
|
float damageMultiplier = 1 + 0.4f * this.monsterMultiplier;
|
||||||
|
|
||||||
Entity entity = result.getEntity();
|
Entity entity = result.getEntity();
|
||||||
if (this.getOwner() instanceof LivingEntity living) {
|
if (this.getOwner() instanceof LivingEntity living) {
|
||||||
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
||||||
|
@ -136,9 +142,17 @@ public class BocekArrowEntity extends AbstractArrow implements ItemSupplier {
|
||||||
|
|
||||||
boolean hurt;
|
boolean hurt;
|
||||||
if (headshot) {
|
if (headshot) {
|
||||||
hurt = entity.hurt(TargetModDamageTypes.causeArrowInBrainDamage(this.level().registryAccess(), this, this.getOwner()), (float) i * 2);
|
if (entity instanceof Monster monster) {
|
||||||
|
hurt = monster.hurt(TargetModDamageTypes.causeArrowInBrainDamage(this.level().registryAccess(), this, this.getOwner()), (float) i * 2 * damageMultiplier);
|
||||||
|
} else {
|
||||||
|
hurt = entity.hurt(TargetModDamageTypes.causeArrowInBrainDamage(this.level().registryAccess(), this, this.getOwner()), (float) i * 2);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
hurt = entity.hurt(TargetModDamageTypes.causeArrowInKneeDamage(this.level().registryAccess(), this, this.getOwner()), (float) i);
|
if (entity instanceof Monster monster) {
|
||||||
|
hurt = monster.hurt(TargetModDamageTypes.causeArrowInBrainDamage(this.level().registryAccess(), this, this.getOwner()), (float) i * damageMultiplier);
|
||||||
|
} else {
|
||||||
|
hurt = entity.hurt(TargetModDamageTypes.causeArrowInBrainDamage(this.level().registryAccess(), this, this.getOwner()), (float) i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hurt) {
|
if (!hurt) {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package net.mcreator.target.entity;
|
package net.mcreator.target.entity;
|
||||||
|
|
||||||
import net.mcreator.target.TargetMod;
|
import net.mcreator.target.TargetMod;
|
||||||
|
import net.mcreator.target.init.TargetModDamageTypes;
|
||||||
import net.mcreator.target.init.TargetModEntities;
|
import net.mcreator.target.init.TargetModEntities;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
|
import net.mcreator.target.tools.CustomExplosion;
|
||||||
import net.mcreator.target.tools.ParticleTool;
|
import net.mcreator.target.tools.ParticleTool;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -26,6 +28,7 @@ import net.minecraft.world.entity.projectile.ThrownPotion;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.SpawnEggItem;
|
import net.minecraft.world.item.SpawnEggItem;
|
||||||
|
import net.minecraft.world.level.Explosion;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
@ -123,14 +126,23 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity, Animated
|
||||||
public void die(DamageSource source) {
|
public void die(DamageSource source) {
|
||||||
super.die(source);
|
super.die(source);
|
||||||
|
|
||||||
if (level() instanceof ServerLevel server) {
|
if (level() instanceof ServerLevel) {
|
||||||
server.explode(this, this.getX(), this.getY(), this.getZ(), 6.5f, Level.ExplosionInteraction.NONE);
|
destoryExplode();
|
||||||
|
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void destoryExplode() {
|
||||||
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
|
TargetModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), 45f,
|
||||||
|
this.getX(), this.getY(), this.getZ(), 7.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
|
explosion.explode();
|
||||||
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
explosion.finalizeExplosion(false);
|
||||||
|
|
||||||
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addAdditionalSaveData(CompoundTag compound) {
|
public void addAdditionalSaveData(CompoundTag compound) {
|
||||||
super.addAdditionalSaveData(compound);
|
super.addAdditionalSaveData(compound);
|
||||||
|
@ -227,7 +239,7 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity, Animated
|
||||||
|
|
||||||
TargetMod.queueServerWork(1, () -> {
|
TargetMod.queueServerWork(1, () -> {
|
||||||
if (!level.isClientSide())
|
if (!level.isClientSide())
|
||||||
level.explode(this, target.getX(), target.getY(), target.getZ(), 6.5f, Level.ExplosionInteraction.NONE);
|
triggerExplode(target);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,6 +247,17 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity, Animated
|
||||||
this.refreshDimensions();
|
this.refreshDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void triggerExplode(Entity target) {
|
||||||
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
|
TargetModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), 150f,
|
||||||
|
target.getX(), target.getY(), target.getZ(), 4f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
|
explosion.explode();
|
||||||
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
explosion.finalizeExplosion(false);
|
||||||
|
|
||||||
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityDimensions getDimensions(Pose p_33597_) {
|
public EntityDimensions getDimensions(Pose p_33597_) {
|
||||||
return super.getDimensions(p_33597_).scale((float) 0.5);
|
return super.getDimensions(p_33597_).scale((float) 0.5);
|
||||||
|
|
|
@ -79,12 +79,9 @@ public class GunGrenadeEntity extends ThrowableItemProjectile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getPersistentData().getInt("fuse") > 0) {
|
if (this.tickCount > 0) {
|
||||||
if (this.level() instanceof ServerLevel level) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
level.explode(this, (this.getX()), (this.getY()), (this.getZ()), 4.5f, Level.ExplosionInteraction.NONE);
|
causeExplode();
|
||||||
if (!entity.level().isClientSide()) {
|
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
|
||||||
}
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +143,7 @@ public class GunGrenadeEntity extends ThrowableItemProjectile {
|
||||||
@Override
|
@Override
|
||||||
public void onHitBlock(BlockHitResult blockHitResult) {
|
public void onHitBlock(BlockHitResult blockHitResult) {
|
||||||
super.onHitBlock(blockHitResult);
|
super.onHitBlock(blockHitResult);
|
||||||
if (this.getPersistentData().getInt("fuse") > 0) {
|
if (this.tickCount > 0) {
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
causeExplode();
|
causeExplode();
|
||||||
}
|
}
|
||||||
|
@ -159,8 +156,6 @@ public class GunGrenadeEntity extends ThrowableItemProjectile {
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
this.getPersistentData().putInt("fuse", this.getPersistentData().getInt("fuse") + 1);
|
|
||||||
|
|
||||||
if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {
|
if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {
|
||||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY(), this.getZ(),
|
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY(), this.getZ(),
|
||||||
1, 0, 0, 0, 0.02, true);
|
1, 0, 0, 0, 0.02, true);
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package net.mcreator.target.entity;
|
package net.mcreator.target.entity;
|
||||||
|
|
||||||
|
import net.mcreator.target.init.TargetModDamageTypes;
|
||||||
import net.mcreator.target.init.TargetModEntities;
|
import net.mcreator.target.init.TargetModEntities;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
|
import net.mcreator.target.tools.CustomExplosion;
|
||||||
import net.mcreator.target.tools.ParticleTool;
|
import net.mcreator.target.tools.ParticleTool;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
@ -12,6 +14,7 @@ import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.level.Explosion;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.EntityHitResult;
|
import net.minecraft.world.phys.EntityHitResult;
|
||||||
|
@ -59,11 +62,8 @@ public class MortarShellEntity extends ThrowableItemProjectile {
|
||||||
|
|
||||||
entity.hurt(this.level().damageSources().thrown(this, this.getOwner()), this.damage);
|
entity.hurt(this.level().damageSources().thrown(this, this.getOwner()), this.damage);
|
||||||
|
|
||||||
if (this.level() instanceof ServerLevel level) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
level.explode(this, (this.getX()), (this.getY()), (this.getZ()), 11, Level.ExplosionInteraction.NONE);
|
causeExplode();
|
||||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
|
||||||
ParticleTool.spawnMediumExplosionParticles(level, entity.position());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
@ -71,9 +71,8 @@ public class MortarShellEntity extends ThrowableItemProjectile {
|
||||||
@Override
|
@Override
|
||||||
public void onHitBlock(BlockHitResult blockHitResult) {
|
public void onHitBlock(BlockHitResult blockHitResult) {
|
||||||
super.onHitBlock(blockHitResult);
|
super.onHitBlock(blockHitResult);
|
||||||
if (!this.level().isClientSide() && this.level() instanceof ServerLevel level) {
|
if (!this.level().isClientSide() && this.level() instanceof ServerLevel) {
|
||||||
level.explode(this, this.getX(), this.getY(), this.getZ(), 11, Level.ExplosionInteraction.NONE);
|
causeExplode();
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
@ -87,13 +86,23 @@ public class MortarShellEntity extends ThrowableItemProjectile {
|
||||||
}
|
}
|
||||||
if (this.tickCount > 600 || this.isInWater()) {
|
if (this.tickCount > 600 || this.isInWater()) {
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 11f, Level.ExplosionInteraction.NONE);
|
causeExplode();
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void causeExplode() {
|
||||||
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
|
TargetModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), 150f,
|
||||||
|
this.getX(), this.getY(), this.getZ(), 12.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
|
explosion.explode();
|
||||||
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
explosion.finalizeExplosion(false);
|
||||||
|
|
||||||
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getGravity() {
|
protected float getGravity() {
|
||||||
return 0.05F;
|
return 0.05F;
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
||||||
protected int shooterId;
|
protected int shooterId;
|
||||||
private float damage = 1f;
|
private float damage = 1f;
|
||||||
private float headShot = 1f;
|
private float headShot = 1f;
|
||||||
private int monster_multiple = 1;
|
private int monster_multiple = 0;
|
||||||
private float legShot = 0.5f;
|
private float legShot = 0.5f;
|
||||||
private boolean beast = false;
|
private boolean beast = false;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.mcreator.target.init.TargetModEntities;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.network.message.ClientIndicatorMessage;
|
import net.mcreator.target.network.message.ClientIndicatorMessage;
|
||||||
|
import net.mcreator.target.tools.CustomExplosion;
|
||||||
import net.mcreator.target.tools.ParticleTool;
|
import net.mcreator.target.tools.ParticleTool;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
@ -18,8 +19,10 @@ import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.monster.Monster;
|
||||||
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.level.Explosion;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
@ -32,6 +35,8 @@ import net.minecraftforge.network.PlayMessages;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class RpgRocketEntity extends ThrowableItemProjectile {
|
public class RpgRocketEntity extends ThrowableItemProjectile {
|
||||||
|
|
||||||
|
private int monsterMultiplier = 0;
|
||||||
private float damage = 150f;
|
private float damage = 150f;
|
||||||
|
|
||||||
public RpgRocketEntity(EntityType<? extends RpgRocketEntity> type, Level world) {
|
public RpgRocketEntity(EntityType<? extends RpgRocketEntity> type, Level world) {
|
||||||
|
@ -42,9 +47,10 @@ public class RpgRocketEntity extends ThrowableItemProjectile {
|
||||||
super(type, entity, world);
|
super(type, entity, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RpgRocketEntity(LivingEntity entity, Level level, float damage) {
|
public RpgRocketEntity(LivingEntity entity, Level level, float damage, int monsterMultiplier) {
|
||||||
super(TargetModEntities.RPG_ROCKET.get(), entity, level);
|
super(TargetModEntities.RPG_ROCKET.get(), entity, level);
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
|
this.monsterMultiplier = monsterMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RpgRocketEntity(PlayMessages.SpawnEntity spawnEntity, Level level) {
|
public RpgRocketEntity(PlayMessages.SpawnEntity spawnEntity, Level level) {
|
||||||
|
@ -63,6 +69,7 @@ public class RpgRocketEntity extends ThrowableItemProjectile {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHitEntity(EntityHitResult result) {
|
protected void onHitEntity(EntityHitResult result) {
|
||||||
|
float damageMultiplier = 1 + 0.4f * this.monsterMultiplier;
|
||||||
Entity entity = result.getEntity();
|
Entity entity = result.getEntity();
|
||||||
if (this.getOwner() instanceof LivingEntity living) {
|
if (this.getOwner() instanceof LivingEntity living) {
|
||||||
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
||||||
|
@ -72,13 +79,9 @@ public class RpgRocketEntity extends ThrowableItemProjectile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.tickCount > 2) {
|
if (this.tickCount > 1) {
|
||||||
if (this.level() instanceof ServerLevel level) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
level.explode(this, this.getX(), this.getY(), this.getZ(), 5, Level.ExplosionInteraction.NONE);
|
causeExplode();
|
||||||
|
|
||||||
if (!entity.level().isClientSide()) {
|
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
|
||||||
}
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,9 +124,17 @@ public class RpgRocketEntity extends ThrowableItemProjectile {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (headshot) {
|
if (headshot) {
|
||||||
entity.hurt(TargetModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.getOwner()), this.damage * 5f);
|
if (entity instanceof Monster monster) {
|
||||||
|
monster.hurt(TargetModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.getOwner()), this.damage * 5f * damageMultiplier);
|
||||||
|
} else {
|
||||||
|
entity.hurt(TargetModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.getOwner()), this.damage * 5f);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
entity.hurt(TargetModDamageTypes.causeGunFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage);
|
if (entity instanceof Monster monster) {
|
||||||
|
monster.hurt(TargetModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.getOwner()), this.damage * damageMultiplier);
|
||||||
|
} else {
|
||||||
|
entity.hurt(TargetModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.getOwner()), this.damage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.discard();
|
this.discard();
|
||||||
|
@ -137,11 +148,9 @@ public class RpgRocketEntity extends ThrowableItemProjectile {
|
||||||
@Override
|
@Override
|
||||||
public void onHitBlock(BlockHitResult blockHitResult) {
|
public void onHitBlock(BlockHitResult blockHitResult) {
|
||||||
super.onHitBlock(blockHitResult);
|
super.onHitBlock(blockHitResult);
|
||||||
|
if (this.tickCount > 0) {
|
||||||
if (this.tickCount > 2) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
if (this.level() instanceof ServerLevel level) {
|
causeExplode();
|
||||||
level.explode(this, this.getX(), this.getY(), this.getZ(), 5, Level.ExplosionInteraction.NONE);
|
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,12 +161,12 @@ public class RpgRocketEntity extends ThrowableItemProjectile {
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
if (this.tickCount == 2) {
|
if (this.tickCount == 1) {
|
||||||
if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {
|
if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {
|
||||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY(), this.getZ(), 50, 0.8, 0.8, 0.8, 0.01, true);
|
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY(), this.getZ(), 50, 0.8, 0.8, 0.8, 0.01, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.tickCount > 2) {
|
if (this.tickCount > 1) {
|
||||||
this.setDeltaMovement(new Vec3((1.04 * this.getDeltaMovement().x()), (1.04 * this.getDeltaMovement().y() - 0.02), (1.04 * this.getDeltaMovement().z())));
|
this.setDeltaMovement(new Vec3((1.04 * this.getDeltaMovement().x()), (1.04 * this.getDeltaMovement().y() - 0.02), (1.04 * this.getDeltaMovement().z())));
|
||||||
|
|
||||||
if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {
|
if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {
|
||||||
|
@ -168,10 +177,20 @@ public class RpgRocketEntity extends ThrowableItemProjectile {
|
||||||
|
|
||||||
if (this.tickCount > 100 || this.isInWater()) {
|
if (this.tickCount > 100 || this.isInWater()) {
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 5f, Level.ExplosionInteraction.NONE);
|
causeExplode();
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void causeExplode() {
|
||||||
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
|
TargetModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), 100f,
|
||||||
|
this.getX(), this.getY(), this.getZ(), 10f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(this.monsterMultiplier);
|
||||||
|
explosion.explode();
|
||||||
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
explosion.finalizeExplosion(false);
|
||||||
|
|
||||||
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,10 @@ public class FireMessage {
|
||||||
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
|
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
|
||||||
Level level = player.level();
|
Level level = player.level();
|
||||||
if (!level.isClientSide()) {
|
if (!level.isClientSide()) {
|
||||||
|
int monsterMultiple = EnchantmentHelper.getTagEnchantmentLevel(TargetModEnchantments.MONSTER_HUNTER.get(), stack);
|
||||||
float damage = (float) (0.02 * stack.getOrCreateTag().getDouble("damage") * (1 + 0.05 * stack.getOrCreateTag().getInt("level")));
|
float damage = (float) (0.02 * stack.getOrCreateTag().getDouble("damage") * (1 + 0.05 * stack.getOrCreateTag().getInt("level")));
|
||||||
|
|
||||||
BocekArrowEntity arrow = new BocekArrowEntity(player, level);
|
BocekArrowEntity arrow = new BocekArrowEntity(player, level, monsterMultiple);
|
||||||
arrow.setBaseDamage(damage);
|
arrow.setBaseDamage(damage);
|
||||||
arrow.setKnockback(0);
|
arrow.setKnockback(0);
|
||||||
arrow.setSilent(true);
|
arrow.setSilent(true);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.mcreator.target.procedures;
|
||||||
|
|
||||||
import net.mcreator.target.entity.RpgRocketEntity;
|
import net.mcreator.target.entity.RpgRocketEntity;
|
||||||
import net.mcreator.target.init.TargetModAttributes;
|
import net.mcreator.target.init.TargetModAttributes;
|
||||||
|
import net.mcreator.target.init.TargetModEnchantments;
|
||||||
import net.mcreator.target.init.TargetModItems;
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.network.TargetModVariables;
|
import net.mcreator.target.network.TargetModVariables;
|
||||||
|
@ -12,6 +13,7 @@ import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
|
||||||
// TODO 内联这个类
|
// TODO 内联这个类
|
||||||
|
@ -36,7 +38,8 @@ public class RpgFireProcedure {
|
||||||
|
|
||||||
|
|
||||||
if (!level.isClientSide()) {
|
if (!level.isClientSide()) {
|
||||||
RpgRocketEntity rocketEntity = new RpgRocketEntity(player, level, (float) tag.getDouble("damage"));
|
int monsterMultiple = EnchantmentHelper.getTagEnchantmentLevel(TargetModEnchantments.MONSTER_HUNTER.get(), mainHandItem);
|
||||||
|
RpgRocketEntity rocketEntity = new RpgRocketEntity(player, level, (float) tag.getDouble("damage"), monsterMultiple);
|
||||||
rocketEntity.setPos(player.getX(), player.getEyeY() - 0.1, player.getZ());
|
rocketEntity.setPos(player.getX(), player.getEyeY() - 0.1, player.getZ());
|
||||||
rocketEntity.shoot(player.getLookAngle().x, player.getLookAngle().y, player.getLookAngle().z, (float) tag.getDouble("velocity"),
|
rocketEntity.shoot(player.getLookAngle().x, player.getLookAngle().y, player.getLookAngle().z, (float) tag.getDouble("velocity"),
|
||||||
(float) player.getAttribute(TargetModAttributes.SPREAD.get()).getBaseValue());
|
(float) player.getAttribute(TargetModAttributes.SPREAD.get()).getBaseValue());
|
||||||
|
|
Loading…
Add table
Reference in a new issue