package net.mcreator.target.procedures; import net.mcreator.target.network.TargetModVariables; import net.minecraft.commands.CommandSource; import net.minecraft.commands.CommandSourceStack; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; public class DevofireProcedure { public static void execute(Entity entity) { if (entity == null) return; ItemStack usehand; usehand = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY); if (Math.random() < 0.5) { { double _setval = -1; entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.recoilhorizon = _setval; capability.syncPlayerVariables(entity); }); } } else { { double _setval = 1; entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.recoilhorizon = _setval; capability.syncPlayerVariables(entity); }); } } { double _setval = 0.1; entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.recoil = _setval; capability.syncPlayerVariables(entity); }); } { double _setval = 1; entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.firing = _setval; capability.syncPlayerVariables(entity); }); } BulletFireNormalProcedure.execute(entity); ArDsProcedure.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, entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:devotion_fire_1p player @s ~ ~ ~ 2 1"); } } { 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, entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "playsound target:devotion_fire_3p player @a ~ ~ ~ 4 1"); } } { 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, entity.getName().getString(), entity.getDisplayName(), entity.level().getServer(), entity), "stopsound @s player target:devotion_fire_3p"); } } usehand.getOrCreateTag().putDouble("fireanim", 2); usehand.getOrCreateTag().putDouble("ammo", (usehand.getOrCreateTag().getDouble("ammo") - 1)); } }