调整了破片的伤害计算公式
This commit is contained in:
parent
ac1c4f5f4b
commit
56d43058b5
3 changed files with 17 additions and 17 deletions
|
@ -1,8 +1,9 @@
|
||||||
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.*;
|
import net.mcreator.target.init.TargetModDamageTypes;
|
||||||
import net.mcreator.target.network.TargetModVariables;
|
import net.mcreator.target.init.TargetModEntities;
|
||||||
|
import net.mcreator.target.init.TargetModItems;
|
||||||
import net.mcreator.target.tools.CustomExplosion;
|
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;
|
||||||
|
@ -27,7 +28,6 @@ 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.item.enchantment.EnchantmentHelper;
|
|
||||||
import net.minecraft.world.level.Explosion;
|
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;
|
||||||
|
@ -254,18 +254,14 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity, Animated
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
explosion.finalizeExplosion(false);
|
explosion.finalizeExplosion(false);
|
||||||
for (int index0 = 0; index0 < 250; index0++) {
|
for (int index0 = 0; index0 < 100; index0++) {
|
||||||
fragShoot();
|
fragShoot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fragShoot() {
|
public void fragShoot() {
|
||||||
|
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
|
FragEntity frag = new FragEntity(this.getOwner(), level()).setPosition0(this.position());
|
||||||
Vec3 vec3 = (this.position());
|
|
||||||
|
|
||||||
FragEntity frag = new FragEntity(this.getOwner(), level());
|
|
||||||
|
|
||||||
frag.setPos(this.getX(), this.getEyeY() + 0.1, this.getZ());
|
frag.setPos(this.getX(), this.getEyeY() + 0.1, this.getZ());
|
||||||
frag.shoot(this.getLookAngle().x, this.getLookAngle().y + 0.5f, this.getLookAngle().z, 7,
|
frag.shoot(this.getLookAngle().x, this.getLookAngle().y + 0.5f, this.getLookAngle().z, 7,
|
||||||
|
|
|
@ -24,9 +24,8 @@ import net.minecraftforge.network.NetworkHooks;
|
||||||
import net.minecraftforge.network.PacketDistributor;
|
import net.minecraftforge.network.PacketDistributor;
|
||||||
import net.minecraftforge.network.PlayMessages;
|
import net.minecraftforge.network.PlayMessages;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class FragEntity extends ThrowableItemProjectile {
|
public class FragEntity extends ThrowableItemProjectile {
|
||||||
|
private Vec3 position0;
|
||||||
|
|
||||||
public FragEntity(EntityType<? extends FragEntity> type, Level world) {
|
public FragEntity(EntityType<? extends FragEntity> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
|
@ -43,6 +42,12 @@ public class FragEntity extends ThrowableItemProjectile {
|
||||||
public FragEntity(PlayMessages.SpawnEntity spawnEntity, Level level) {
|
public FragEntity(PlayMessages.SpawnEntity spawnEntity, Level level) {
|
||||||
this(TargetModEntities.FRAG.get(), level);
|
this(TargetModEntities.FRAG.get(), level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FragEntity setPosition0(Vec3 position0) {
|
||||||
|
this.position0 = position0;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Packet<ClientGamePacketListener> getAddEntityPacket() {
|
public Packet<ClientGamePacketListener> getAddEntityPacket() {
|
||||||
return NetworkHooks.getEntitySpawningPacket(this);
|
return NetworkHooks.getEntitySpawningPacket(this);
|
||||||
|
@ -66,7 +71,9 @@ public class FragEntity extends ThrowableItemProjectile {
|
||||||
living.level().playSound(null, living.blockPosition(), TargetModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1);
|
living.level().playSound(null, living.blockPosition(), TargetModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1);
|
||||||
TargetMod.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> player), new ClientIndicatorMessage(0, 5));
|
TargetMod.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> player), new ClientIndicatorMessage(0, 5));
|
||||||
|
|
||||||
entity.hurt(TargetModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), 4 - (float) Mth.clamp(0.04 * this.position().distanceTo(this.getOwner().position()) * (entity instanceof LivingEntity living_ ? living_.getMaxHealth() : 1),0,3.5));
|
entity.hurt(TargetModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
||||||
|
5 - (float) Mth.clamp(0.2 * this.position0.distanceTo(entity.position())
|
||||||
|
* (entity instanceof LivingEntity livingEntity ? livingEntity.getMaxHealth() / 100 + 1 : 1), 0, 4.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +84,6 @@ public class FragEntity extends ThrowableItemProjectile {
|
||||||
public void onHitBlock(BlockHitResult blockHitResult) {
|
public void onHitBlock(BlockHitResult blockHitResult) {
|
||||||
super.onHitBlock(blockHitResult);
|
super.onHitBlock(blockHitResult);
|
||||||
|
|
||||||
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,16 +178,14 @@ public class GunGrenadeEntity extends ThrowableItemProjectile {
|
||||||
explosion.finalizeExplosion(false);
|
explosion.finalizeExplosion(false);
|
||||||
|
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
for (int index0 = 0; index0 < 200; index0++) {
|
for (int index0 = 0; index0 < 50; index0++) {
|
||||||
fragShoot();
|
fragShoot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fragShoot() {
|
public void fragShoot() {
|
||||||
|
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
|
FragEntity frag = new FragEntity((LivingEntity) this.getOwner(), level()).setPosition0(this.position());
|
||||||
FragEntity frag = new FragEntity((LivingEntity) this.getOwner(), level());
|
|
||||||
|
|
||||||
frag.setPos(this.getX(), this.getEyeY() + 0.1, this.getZ());
|
frag.setPos(this.getX(), this.getEyeY() + 0.1, this.getZ());
|
||||||
frag.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 5,
|
frag.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 5,
|
||||||
|
|
Loading…
Add table
Reference in a new issue