修改弹射物
This commit is contained in:
parent
8f7db46aec
commit
c87d5c5a69
31 changed files with 108 additions and 83 deletions
|
@ -3,7 +3,6 @@ package net.mcreator.target.entity;
|
|||
import net.mcreator.target.headshot.BoundingBoxManager;
|
||||
import net.mcreator.target.headshot.IHeadshotBox;
|
||||
import net.mcreator.target.init.TargetCustomModEntities;
|
||||
import net.mcreator.target.init.TargetModItems;
|
||||
import net.mcreator.target.procedures.ProjectileHeadshotEntity;
|
||||
import net.mcreator.target.procedures.ProjectileHitEntity;
|
||||
import net.mcreator.target.util.math.ExtendedEntityRayTraceResult;
|
||||
|
@ -11,6 +10,8 @@ import net.minecraft.commands.CommandSource;
|
|||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
@ -19,8 +20,6 @@ import net.minecraft.world.entity.Entity;
|
|||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
|
@ -28,47 +27,38 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.*;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.entity.IEntityAdditionalSpawnData;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class ProjectileEntity extends ThrowableItemProjectile {
|
||||
|
||||
public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnData {
|
||||
private static final Predicate<Entity> PROJECTILE_TARGETS = input -> input != null && input.isPickable() && !input.isSpectator();
|
||||
|
||||
private static final Predicate<BlockState> IGNORE_LEAVES = input -> input != null && input.getBlock() instanceof LeavesBlock;
|
||||
protected LivingEntity shooter;
|
||||
protected int shooterId;
|
||||
private float damage;
|
||||
private float damage = 1f;
|
||||
|
||||
public ProjectileEntity(EntityType<? extends ProjectileEntity> p_i50159_1_, Level p_i50159_2_) {
|
||||
super(p_i50159_1_, p_i50159_2_);
|
||||
}
|
||||
|
||||
public ProjectileEntity(Level world, LivingEntity entity) {
|
||||
super(TargetCustomModEntities.PROJECTILE.get(), entity, world);
|
||||
this.damage = 0f;
|
||||
super(TargetCustomModEntities.PROJECTILE.get(), world);
|
||||
this.shooter = entity;
|
||||
}
|
||||
|
||||
public ProjectileEntity(Level world, LivingEntity entity, float damage) {
|
||||
super(TargetCustomModEntities.PROJECTILE.get(), entity, world);
|
||||
super(TargetCustomModEntities.PROJECTILE.get(), world);
|
||||
this.shooter = entity;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
public ProjectileEntity(Level p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) {
|
||||
super(TargetCustomModEntities.PROJECTILE.get(), p_i1775_2_, p_i1775_4_, p_i1775_6_, p_i1775_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHitEntity(EntityHitResult result) {
|
||||
super.onHitEntity(result);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected EntityResult findEntityOnPath(Vec3 startVec, Vec3 endVec) {
|
||||
Vec3 hitVec = null;
|
||||
|
@ -76,11 +66,13 @@ public class ProjectileEntity extends ThrowableItemProjectile {
|
|||
boolean headshot = false;
|
||||
List<Entity> entities = this.level().getEntities(this, this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(1.0), PROJECTILE_TARGETS);
|
||||
double closestDistance = Double.MAX_VALUE;
|
||||
|
||||
for (Entity entity : entities) {
|
||||
if (!entity.equals(this.shooter)) {
|
||||
EntityResult result = this.getHitResult(entity, startVec, endVec);
|
||||
if (result == null)
|
||||
if (result == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Vec3 hitPos = result.getHitPos();
|
||||
double distanceToHit = startVec.distanceTo(hitPos);
|
||||
|
@ -95,20 +87,20 @@ public class ProjectileEntity extends ThrowableItemProjectile {
|
|||
return hitEntity != null ? new EntityResult(hitEntity, hitVec, headshot) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected List<EntityResult> findEntitiesOnPath(Vec3 startVec, Vec3 endVec) {
|
||||
List<EntityResult> hitEntities = new ArrayList<>();
|
||||
List<Entity> entities = this.level().getEntities(this, this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(1.0), PROJECTILE_TARGETS);
|
||||
for (Entity entity : entities) {
|
||||
if (!entity.equals(this.shooter)) {
|
||||
EntityResult result = this.getHitResult(entity, startVec, endVec);
|
||||
if (result == null)
|
||||
continue;
|
||||
hitEntities.add(result);
|
||||
}
|
||||
}
|
||||
return hitEntities;
|
||||
}
|
||||
// @Nullable
|
||||
// protected List<EntityResult> findEntitiesOnPath(Vec3 startVec, Vec3 endVec) {
|
||||
// List<EntityResult> hitEntities = new ArrayList<>();
|
||||
// List<Entity> entities = this.level().getEntities(this, this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(1.0), PROJECTILE_TARGETS);
|
||||
// for (Entity entity : entities) {
|
||||
// if (!entity.equals(this.shooter)) {
|
||||
// EntityResult result = this.getHitResult(entity, startVec, endVec);
|
||||
// if (result == null)
|
||||
// continue;
|
||||
// hitEntities.add(result);
|
||||
// }
|
||||
// }
|
||||
// return hitEntities;
|
||||
// }
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -142,7 +134,7 @@ public class ProjectileEntity extends ThrowableItemProjectile {
|
|||
if (box != null) {
|
||||
box = box.move(boundingBox.getCenter().x, boundingBox.minY, boundingBox.getCenter().z);
|
||||
Optional<Vec3> headshotHitPos = box.clip(startVec, endVec);
|
||||
if (!headshotHitPos.isPresent()) {
|
||||
if (headshotHitPos.isEmpty()) {
|
||||
box = box.inflate(0.2, 0.2, 0.2);
|
||||
headshotHitPos = box.clip(startVec, endVec);
|
||||
}
|
||||
|
@ -161,6 +153,11 @@ public class ProjectileEntity extends ThrowableItemProjectile {
|
|||
return new EntityResult(entity, hitPos, headshot);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
@ -197,14 +194,21 @@ public class ProjectileEntity extends ThrowableItemProjectile {
|
|||
}
|
||||
}
|
||||
|
||||
protected void onProjectileTick() {
|
||||
@Override
|
||||
protected void readAdditionalSaveData(CompoundTag p_20052_) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHitBlock(BlockHitResult hitResult) {
|
||||
super.onHitBlock(hitResult);
|
||||
Vec3 location = hitResult.getLocation();
|
||||
protected void addAdditionalSaveData(CompoundTag p_20139_) {
|
||||
|
||||
}
|
||||
|
||||
protected void onProjectileTick() {
|
||||
}
|
||||
|
||||
protected void onHitBlock(Vec3 location) {
|
||||
// TODO 修改成正常的音效播放/粒子显示方法
|
||||
if (this.level() instanceof ServerLevel _level)
|
||||
_level.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(location.x, location.y, location.z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(),
|
||||
"particle target:bullthole ~ ~ ~ 0 0 0 0 1 force");
|
||||
|
@ -219,6 +223,15 @@ public class ProjectileEntity extends ThrowableItemProjectile {
|
|||
}
|
||||
|
||||
private void onHit(HitResult result, Vec3 startVec, Vec3 endVec) {
|
||||
if (result instanceof BlockHitResult blockHitResult) {
|
||||
if (blockHitResult.getType() == HitResult.Type.MISS) {
|
||||
return;
|
||||
}
|
||||
|
||||
Vec3 hitVec = result.getLocation();
|
||||
this.onHitBlock(hitVec);
|
||||
}
|
||||
|
||||
if (result instanceof ExtendedEntityRayTraceResult entityHitResult) {
|
||||
Entity entity = entityHitResult.getEntity();
|
||||
if (entity.getId() == this.shooterId) {
|
||||
|
@ -243,11 +256,6 @@ public class ProjectileEntity extends ThrowableItemProjectile {
|
|||
ProjectileHitEntity.execute(this.level(), entity, this, this.shooter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item getDefaultItem() {
|
||||
return TargetModItems.RIFLE_AMMO.get().asItem();
|
||||
}
|
||||
|
||||
public void setDamage(float damage) {
|
||||
this.damage = damage;
|
||||
}
|
||||
|
@ -256,6 +264,17 @@ public class ProjectileEntity extends ThrowableItemProjectile {
|
|||
return this.damage;
|
||||
}
|
||||
|
||||
public void shoot(double p_37266_, double p_37267_, double p_37268_, float p_37269_, float p_37270_) {
|
||||
Vec3 vec3 = (new Vec3(p_37266_, p_37267_, p_37268_)).normalize().add(this.random.triangle(0.0D, 0.0172275D * (double)p_37270_), this.random.triangle(0.0D, 0.0172275D * (double)p_37270_), this.random.triangle(0.0D, 0.0172275D * (double)p_37270_)).scale((double)p_37269_);
|
||||
this.setDeltaMovement(vec3);
|
||||
double d0 = vec3.horizontalDistance();
|
||||
this.setYRot((float)(Mth.atan2(vec3.x, vec3.z) * (double)(180F / (float)Math.PI)));
|
||||
this.setXRot((float)(Mth.atan2(vec3.y, d0) * (double)(180F / (float)Math.PI)));
|
||||
this.yRotO = this.getYRot();
|
||||
this.xRotO = this.getXRot();
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
private static BlockHitResult rayTraceBlocks(Level world, ClipContext context, Predicate<BlockState> ignorePredicate) {
|
||||
return performRayTrace(context, (rayTraceContext, blockPos) -> {
|
||||
BlockState blockState = world.getBlockState(blockPos);
|
||||
|
@ -353,6 +372,16 @@ public class ProjectileEntity extends ThrowableItemProjectile {
|
|||
this.xRotO = this.getXRot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData(FriendlyByteBuf buffer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData(FriendlyByteBuf additionalData) {
|
||||
|
||||
}
|
||||
|
||||
public static class EntityResult {
|
||||
private final Entity entity;
|
||||
private final Vec3 hitVec;
|
||||
|
|
|
@ -51,7 +51,7 @@ public class AKfireProcedure {
|
|||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "stopsound @s player target:ak47_fire_3p");
|
||||
}
|
||||
}
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
AkDsProcedure.execute(entity);
|
||||
usehand.getOrCreateTag().putDouble("fireanim", 2);
|
||||
usehand.getOrCreateTag().putDouble("ammo", (usehand.getOrCreateTag().getDouble("ammo") - 1));
|
||||
|
|
|
@ -37,7 +37,7 @@ public class Aa12autofireProcedure {
|
|||
if (usehand.getItem() == TargetModItems.AA_12.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && usehand.getOrCreateTag().getDouble("ammo") > 0
|
||||
&& !(entity instanceof Player _plrCldCheck6 && _plrCldCheck6.getCooldowns().isOnCooldown(usehand.getItem()))) {
|
||||
for (int index0 = 0; index0 < 8; index0++) {
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
}
|
||||
As12DsProcedure.execute(entity);
|
||||
if (entity instanceof Player _player)
|
||||
|
@ -68,7 +68,7 @@ public class Aa12autofireProcedure {
|
|||
if (usehand.getItem() == TargetModItems.AA_12.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && usehand.getOrCreateTag().getDouble("ammo") > 0
|
||||
&& !(entity instanceof Player _plrCldCheck20 && _plrCldCheck20.getCooldowns().isOnCooldown(usehand.getItem()))) {
|
||||
for (int index1 = 0; index1 < 8; index1++) {
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
}
|
||||
As12DsProcedure.execute(entity);
|
||||
if (entity instanceof Player _player)
|
||||
|
|
|
@ -32,7 +32,7 @@ public class AbkrfireProcedure {
|
|||
if (usehand.getItem() == TargetModItems.ABEKIRI.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck4 && _plrCldCheck4.getCooldowns().isOnCooldown(usehand.getItem()))
|
||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
||||
for (int index0 = 0; index0 < 8; index0++) {
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
}
|
||||
{
|
||||
if (usehand.hurt(1, RandomSource.create(), null)) {
|
||||
|
|
|
@ -39,7 +39,7 @@ public class Ak47autofireProcedure {
|
|||
usehand.getOrCreateTag().putDouble("firecooldown", 7);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 2);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
AkDsProcedure.execute(entity);
|
||||
{
|
||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||
|
|
|
@ -86,7 +86,6 @@ public class BowlooseProcedure {
|
|||
for (int index0 = 0; index0 < 10; index0++) {
|
||||
if (!entity.level().isClientSide() && entity instanceof LivingEntity living) {
|
||||
ProjectileEntity projectile = new ProjectileEntity(entity.level(), living);
|
||||
projectile.setOwner(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);
|
||||
|
|
|
@ -7,12 +7,11 @@ import net.minecraft.world.entity.Entity;
|
|||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class BulletfireNormalProcedure {
|
||||
public class BulletFireNormalProcedure {
|
||||
public static void execute(Entity entity) {
|
||||
if (entity == null)
|
||||
return;
|
||||
ItemStack usehand;
|
||||
usehand = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY);
|
||||
ItemStack heldItem = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY);
|
||||
if (Math.random() < 0.5) {
|
||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
capability.recoilhorizon = -1;
|
||||
|
@ -35,11 +34,10 @@ public class BulletfireNormalProcedure {
|
|||
});
|
||||
|
||||
if (!entity.level().isClientSide() && entity instanceof LivingEntity living) {
|
||||
ProjectileEntity projectile = new ProjectileEntity(entity.level(), living);
|
||||
projectile.setOwner(living);
|
||||
ProjectileEntity projectile = new ProjectileEntity(entity.level(), living, (float) heldItem.getOrCreateTag().getDouble("dmg"));
|
||||
|
||||
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) usehand.getOrCreateTag().getDouble("velocity"),
|
||||
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);
|
||||
}
|
|
@ -45,7 +45,7 @@ public class DevofireProcedure {
|
|||
capability.syncPlayerVariables(entity);
|
||||
});
|
||||
}
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
ArDsProcedure.execute(entity);
|
||||
{
|
||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||
|
|
|
@ -13,7 +13,7 @@ public class Hk416autofireProcedure {
|
|||
return;
|
||||
ItemStack usehand = ItemStack.EMPTY;
|
||||
usehand = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
HkDsProcedure.execute(entity);
|
||||
{
|
||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||
|
|
|
@ -33,7 +33,7 @@ public class Hk416fireProcedure {
|
|||
if (usehand.getOrCreateTag().getDouble("reloading") == 0 && usehand.getOrCreateTag().getDouble("ammo") > 0 && !(entity instanceof Player _plrCldCheck6 && _plrCldCheck6.getCooldowns().isOnCooldown(usehand.getItem()))) {
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 2);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
HkDsProcedure.execute(entity);
|
||||
{
|
||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||
|
|
|
@ -30,7 +30,7 @@ public class HrfireProcedure {
|
|||
usehand = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY);
|
||||
if (usehand.getItem() == TargetModItems.HUNTING_RIFLE.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck4 && _plrCldCheck4.getCooldowns().isOnCooldown(usehand.getItem()))
|
||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 13);
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ public class KraberfireProcedure {
|
|||
if (usehand.getItem() == TargetModItems.KRABER.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck4 && _plrCldCheck4.getCooldowns().isOnCooldown(usehand.getItem()))
|
||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
||||
usehand.getOrCreateTag().putDouble("fireanim", 40);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
KraberDsProcedure.execute(entity);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 40);
|
||||
|
|
|
@ -13,7 +13,7 @@ public class M4autofireProcedure {
|
|||
return;
|
||||
ItemStack usehand;
|
||||
usehand = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
ArDsProcedure.execute(entity);
|
||||
{
|
||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||
|
|
|
@ -34,7 +34,7 @@ public class M4fireProcedure {
|
|||
if (usehand.getOrCreateTag().getDouble("reloading") == 0 && usehand.getOrCreateTag().getDouble("ammo") > 0 && !(entity instanceof Player _plrCldCheck6 && _plrCldCheck6.getCooldowns().isOnCooldown(usehand.getItem()))) {
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 2);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
ArDsProcedure.execute(entity);
|
||||
{
|
||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||
|
|
|
@ -44,7 +44,7 @@ public class M60autofireProcedure {
|
|||
}
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 2);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
{
|
||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
||||
|
|
|
@ -34,7 +34,7 @@ public class M870fireProcedure {
|
|||
if (usehand.getItem() == TargetModItems.M_870.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck8 && _plrCldCheck8.getCooldowns().isOnCooldown(usehand.getItem()))
|
||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
||||
for (int index0 = 0; index0 < 12; index0++) {
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
}
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 13);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class M98bfireProcedure {
|
|||
if (usehand.getItem() == TargetModItems.M_98B.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck4 && _plrCldCheck4.getCooldowns().isOnCooldown(usehand.getItem()))
|
||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
||||
usehand.getOrCreateTag().putDouble("fireanim", 17);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 17);
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ public class MarlinfireProcedure {
|
|||
usehand.getOrCreateTag().putDouble("fastfiring", 1);
|
||||
usehand.getOrCreateTag().putDouble("firing", 10);
|
||||
}
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
{
|
||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
||||
|
|
|
@ -101,7 +101,7 @@ public class MinigunautofireProcedure {
|
|||
entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "stopsound @s player target:minigun_fire_3p");
|
||||
}
|
||||
}
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
{
|
||||
double _setval = (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleammo - 1;
|
||||
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
|
|
|
@ -38,7 +38,7 @@ public class Mk14autofireProcedure {
|
|||
&& !(entity instanceof Player _plrCldCheck5 && _plrCldCheck5.getCooldowns().isOnCooldown(usehand.getItem()))) {
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 2);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
{
|
||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
|
||||
|
|
|
@ -31,7 +31,7 @@ public class Mk14fireProcedure {
|
|||
if (usehand.getItem() == TargetModItems.MK_14.get()) {
|
||||
if (usehand.getOrCreateTag().getDouble("firemode") == 0) {
|
||||
if (usehand.getOrCreateTag().getDouble("reloading") == 0 && usehand.getOrCreateTag().getDouble("ammo") > 0 && !(entity instanceof Player _plrCldCheck6 && _plrCldCheck6.getCooldowns().isOnCooldown(usehand.getItem()))) {
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 2);
|
||||
{
|
||||
|
|
|
@ -23,10 +23,9 @@ public class ProjectileHeadshotEntity {
|
|||
double dam = 0;
|
||||
usehand = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY);
|
||||
{
|
||||
Entity _ent = sourceentity;
|
||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
||||
_ent.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, _ent.position(), _ent.getRotationVector(), _ent.level() instanceof ServerLevel ? (ServerLevel) _ent.level() : null, 4,
|
||||
_ent.getName().getString(), _ent.getDisplayName(), _ent.level().getServer(), _ent), "playsound target:headshot voice @s ~ ~ ~ 1 1");
|
||||
if (!sourceentity.level().isClientSide() && sourceentity.getServer() != null) {
|
||||
sourceentity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, sourceentity.position(), sourceentity.getRotationVector(), sourceentity.level() instanceof ServerLevel ? (ServerLevel) sourceentity.level() : null, 4,
|
||||
sourceentity.getName().getString(), sourceentity.getDisplayName(), sourceentity.level().getServer(), sourceentity), "playsound target:headshot voice @s ~ ~ ~ 1 1");
|
||||
}
|
||||
}
|
||||
double _setval = 25;
|
||||
|
|
|
@ -38,7 +38,7 @@ public class RpkautofireProcedure {
|
|||
&& !(entity instanceof Player _plrCldCheck5 && _plrCldCheck5.getCooldowns().isOnCooldown(usehand.getItem()))) {
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 2);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
AkDsProcedure.execute(entity);
|
||||
{
|
||||
Entity _ent = entity;
|
||||
|
|
|
@ -33,7 +33,7 @@ public class RpkfireProcedure {
|
|||
if (usehand.getOrCreateTag().getDouble("reloading") == 0 && usehand.getOrCreateTag().getDouble("ammo") > 0 && !(entity instanceof Player _plrCldCheck6 && _plrCldCheck6.getCooldowns().isOnCooldown(usehand.getItem()))) {
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 2);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
AkDsProcedure.execute(entity);
|
||||
{
|
||||
if (!entity.level().isClientSide() && entity.getServer() != null) {
|
||||
|
|
|
@ -77,7 +77,7 @@ public class SentinelFireProcedure {
|
|||
}
|
||||
}
|
||||
}
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
usehand.getOrCreateTag().putDouble("crot", 20);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 23);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SksfireProcedure {
|
|||
usehand = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY);
|
||||
if (usehand.getItem() == TargetModItems.SKS.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck4 && _plrCldCheck4.getCooldowns().isOnCooldown(usehand.getItem()))
|
||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
SksDsProcedure.execute(entity);
|
||||
{
|
||||
Entity _ent = entity;
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SvdfireProcedure {
|
|||
usehand = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY);
|
||||
if (usehand.getItem() == TargetModItems.SVD.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck4 && _plrCldCheck4.getCooldowns().isOnCooldown(usehand.getItem()))
|
||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
SvdDsProcedure.execute(entity);
|
||||
{
|
||||
Entity _ent = entity;
|
||||
|
|
|
@ -30,7 +30,7 @@ public class TracheliumfireProcedure {
|
|||
usehand = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY);
|
||||
if (usehand.getItem() == TargetModItems.TRACHELIUM.get() && usehand.getOrCreateTag().getDouble("reloading") == 0 && !(entity instanceof Player _plrCldCheck4 && _plrCldCheck4.getCooldowns().isOnCooldown(usehand.getItem()))
|
||||
&& usehand.getOrCreateTag().getDouble("ammo") > 0) {
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 4);
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ public class VecBurstFireProcedure {
|
|||
_player.getCooldowns().addCooldown(usehand.getItem(), 1);
|
||||
}
|
||||
usehand.getOrCreateTag().putDouble("burst", (usehand.getOrCreateTag().getDouble("burst") - 1));
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
{
|
||||
Entity _ent = entity;
|
||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
||||
|
|
|
@ -38,7 +38,7 @@ public class VecautofireProcedure {
|
|||
&& !(entity instanceof Player _plrCldCheck5 && _plrCldCheck5.getCooldowns().isOnCooldown(usehand.getItem()))) {
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 1);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
{
|
||||
Entity _ent = entity;
|
||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
||||
|
|
|
@ -33,7 +33,7 @@ public class VecfireProcedure {
|
|||
if (usehand.getOrCreateTag().getDouble("reloading") == 0 && usehand.getOrCreateTag().getDouble("ammo") > 0 && !(entity instanceof Player _plrCldCheck6 && _plrCldCheck6.getCooldowns().isOnCooldown(usehand.getItem()))) {
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(usehand.getItem(), 1);
|
||||
BulletfireNormalProcedure.execute(entity);
|
||||
BulletFireNormalProcedure.execute(entity);
|
||||
{
|
||||
Entity _ent = entity;
|
||||
if (!_ent.level().isClientSide() && _ent.getServer() != null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue