修复了波塞克散射模式伤害

This commit is contained in:
Atsuihsio 2024-05-06 17:18:36 +08:00
parent 26f63be31f
commit cc8bbcdade
3 changed files with 22 additions and 17 deletions

View file

@ -19,6 +19,6 @@ public class TargetCustomModEntities {
public static final RegistryObject<EntityType<ProjectileEntity>> PROJECTILE = public static final RegistryObject<EntityType<ProjectileEntity>> PROJECTILE =
ENTITY_TYPES.register("projectile", ENTITY_TYPES.register("projectile",
() -> EntityType.Builder.<ProjectileEntity>of(ProjectileEntity::new, MobCategory.MISC).setTrackingRange(0).sized(0.5f, 0.5f).build("projectile")); () -> EntityType.Builder.<ProjectileEntity>of(ProjectileEntity::new, MobCategory.MISC).sized(0.5f, 0.5f).build("projectile"));
} }

View file

@ -2,6 +2,7 @@ package net.mcreator.target.procedures;
import net.mcreator.target.entity.BocekarrowEntity; import net.mcreator.target.entity.BocekarrowEntity;
import net.mcreator.target.entity.ProjectileEntity; import net.mcreator.target.entity.ProjectileEntity;
import net.mcreator.target.init.TargetModAttributes;
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.network.TargetModVariables; import net.mcreator.target.network.TargetModVariables;
@ -62,12 +63,7 @@ public class BowlooseProcedure {
} }
} else { } else {
for (int index0 = 0; index0 < 10; index0++) { for (int index0 = 0; index0 < 10; index0++) {
if (!entity.level().isClientSide() && entity instanceof LivingEntity living) { BulletFireNormalProcedure.execute(entity);
ProjectileEntity projectile = new ProjectileEntity(entity.level(), living);
projectile.setPos(living.getX(), living.getEyeY() - 0.1, living.getZ());
projectile.shoot(living.getLookAngle().x, living.getLookAngle().y, living.getLookAngle().z, (float) (4 * power), 2);
entity.level().addFreshEntity(projectile);
}
} }
if (!entity.level().isClientSide() && entity.getServer() != null) { if (!entity.level().isClientSide() && entity.getServer() != null) {

View file

@ -36,21 +36,30 @@ public class BulletFireNormalProcedure {
if (!entity.level().isClientSide() && entity instanceof LivingEntity living) { if (!entity.level().isClientSide() && entity instanceof LivingEntity living) {
float damage; float damage;
float headshot = (float) heldItem.getOrCreateTag().getDouble("headshot");
float velocity = 4 * (float) heldItem.getOrCreateTag().getDouble("power");
if (heldItem.getItem() == TargetModItems.BOCEK.get()) { if (heldItem.getItem() == TargetModItems.BOCEK.get()) {
damage = (float) heldItem.getOrCreateTag().getDouble("speed") * (float) heldItem.getOrCreateTag().getDouble("damageadd");
damage = 0.2f * (float) heldItem.getOrCreateTag().getDouble("speed") * (float) heldItem.getOrCreateTag().getDouble("damageadd");
ProjectileEntity projectile = new ProjectileEntity(entity.level(), living, damage, headshot);
projectile.setPos((living.getX() + (-0.5) * living.getLookAngle().x), (living.getEyeY() - 0.1 + (-0.5) * living.getLookAngle().y), (living.getZ() + (-0.5) * living.getLookAngle().z));
projectile.shoot(living.getLookAngle().x, living.getLookAngle().y, living.getLookAngle().z, velocity, 2);
entity.level().addFreshEntity(projectile);
} else { } else {
damage = (float) (heldItem.getOrCreateTag().getDouble("damage") + heldItem.getOrCreateTag().getDouble("adddamage")) damage = (float) (heldItem.getOrCreateTag().getDouble("damage") + heldItem.getOrCreateTag().getDouble("adddamage"))
* (float) heldItem.getOrCreateTag().getDouble("damageadd"); * (float) heldItem.getOrCreateTag().getDouble("damageadd");
ProjectileEntity projectile = new ProjectileEntity(entity.level(), living, damage, headshot);
projectile.setPos((living.getX() + (-0.5) * living.getLookAngle().x), (living.getEyeY() - 0.1 + (-0.5) * living.getLookAngle().y), (living.getZ() + (-0.5) * living.getLookAngle().z));
projectile.shoot(living.getLookAngle().x, living.getLookAngle().y, living.getLookAngle().z, (float) heldItem.getOrCreateTag().getDouble("velocity"),
(float) living.getAttribute(TargetModAttributes.SPREAD.get()).getBaseValue());
entity.level().addFreshEntity(projectile);
} }
float headshot = (float) heldItem.getOrCreateTag().getDouble("headshot");
ProjectileEntity projectile = new ProjectileEntity(entity.level(), living, damage, headshot);
projectile.setPos((living.getX() + (-0.5) * living.getLookAngle().x), (living.getEyeY() - 0.1 + (-0.5) * living.getLookAngle().y), (living.getZ() + (-0.5) * living.getLookAngle().z));
projectile.shoot(living.getLookAngle().x, living.getLookAngle().y, living.getLookAngle().z, (float) heldItem.getOrCreateTag().getDouble("velocity"),
(float) living.getAttribute(TargetModAttributes.SPREAD.get()).getBaseValue());
entity.level().addFreshEntity(projectile);
} }
} }
} }