From b816adc06caf9b37ec30dbbb995f8e5e4f0e4b2b Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Thu, 16 May 2024 05:00:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=88=86=E7=82=B8=E5=91=BD?= =?UTF-8?q?=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../target/command/BigExpCommand.java | 25 ------------ .../target/command/MediumExpCommand.java | 32 ++++++++++++++- .../target/procedures/HugeexpProcedure.java | 38 ------------------ .../target/procedures/MedexpProcedure.java | 39 ------------------- 4 files changed, 30 insertions(+), 104 deletions(-) delete mode 100644 src/main/java/net/mcreator/target/command/BigExpCommand.java delete mode 100644 src/main/java/net/mcreator/target/procedures/HugeexpProcedure.java delete mode 100644 src/main/java/net/mcreator/target/procedures/MedexpProcedure.java diff --git a/src/main/java/net/mcreator/target/command/BigExpCommand.java b/src/main/java/net/mcreator/target/command/BigExpCommand.java deleted file mode 100644 index 35c105d37..000000000 --- a/src/main/java/net/mcreator/target/command/BigExpCommand.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.mcreator.target.command; - -import net.mcreator.target.procedures.HugeexpProcedure; -import net.minecraft.commands.Commands; -import net.minecraft.world.level.Level; -import net.minecraftforge.event.RegisterCommandsEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; - -@Mod.EventBusSubscriber -public class BigExpCommand { - @SubscribeEvent - public static void registerCommand(RegisterCommandsEvent event) { - event.getDispatcher().register(Commands.literal("target:bigexp") - .executes(arguments -> { - Level world = arguments.getSource().getUnsidedLevel(); - double x = arguments.getSource().getPosition().x(); - double y = arguments.getSource().getPosition().y(); - double z = arguments.getSource().getPosition().z(); - - HugeexpProcedure.execute(world, x, y, z); - return 0; - })); - } -} diff --git a/src/main/java/net/mcreator/target/command/MediumExpCommand.java b/src/main/java/net/mcreator/target/command/MediumExpCommand.java index 5f5742cd5..677a414e5 100644 --- a/src/main/java/net/mcreator/target/command/MediumExpCommand.java +++ b/src/main/java/net/mcreator/target/command/MediumExpCommand.java @@ -1,11 +1,21 @@ package net.mcreator.target.command; -import net.mcreator.target.procedures.MedexpProcedure; +import net.mcreator.target.init.TargetModSounds; +import net.minecraft.commands.CommandSource; +import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundSource; import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec2; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.RegisterCommandsEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.registries.ForgeRegistries; @Mod.EventBusSubscriber public class MediumExpCommand { @@ -18,7 +28,25 @@ public class MediumExpCommand { double y = arguments.getSource().getPosition().y(); double z = arguments.getSource().getPosition().z(); - MedexpProcedure.execute(world, x, y, z); + if (!world.isClientSide()) { + world.playSound(null, BlockPos.containing(x, y + 1, z), TargetModSounds.EXP.get(), SoundSource.BLOCKS, 8, 1); + world.playSound(null, BlockPos.containing(x, y + 1, z), TargetModSounds.EXPFAR.get(), SoundSource.BLOCKS, 16, 1); + world.playSound(null, BlockPos.containing(x, y + 1, z), TargetModSounds.EXPVERYFAR.get(), SoundSource.BLOCKS, 32, 1); + } else { + world.playLocalSound(x, (y + 1), z, TargetModSounds.EXP.get(), SoundSource.BLOCKS, 24, 1, false); + world.playLocalSound(x, (y + 1), z, TargetModSounds.EXPFAR.get(), SoundSource.BLOCKS, 24, 1, false); + world.playLocalSound(x, (y + 1), z, TargetModSounds.EXPVERYFAR.get(), SoundSource.BLOCKS, 64, 1, false); + } + if (world instanceof ServerLevel server) { + server.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, server, 4, "", Component.literal(""), server.getServer(), null).withSuppressedOutput(), + "particle minecraft:campfire_cosy_smoke ~ ~ ~ 0.4 1 0.4 0.02 80 force"); + server.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, server, 4, "", Component.literal(""), server.getServer(), null).withSuppressedOutput(), + "particle minecraft:large_smoke ~ ~1 ~ 0.4 1 0.4 0.02 80 force"); + server.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, server, 4, "", Component.literal(""), server.getServer(), null).withSuppressedOutput(), + "particle minecraft:campfire_cosy_smoke ~ ~ ~ 2 0.001 2 0.01 80 force"); + server.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, server, 4, "", Component.literal(""), server.getServer(), null).withSuppressedOutput(), + "particle target:firestar ~ ~ ~ 0 0 0 0.2 80 force"); + } return 0; })); } diff --git a/src/main/java/net/mcreator/target/procedures/HugeexpProcedure.java b/src/main/java/net/mcreator/target/procedures/HugeexpProcedure.java deleted file mode 100644 index 29ae767d0..000000000 --- a/src/main/java/net/mcreator/target/procedures/HugeexpProcedure.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.mcreator.target.procedures; - -import net.mcreator.target.init.TargetModSounds; -import net.minecraft.commands.CommandSource; -import net.minecraft.commands.CommandSourceStack; -import net.minecraft.core.BlockPos; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.sounds.SoundSource; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; -import net.minecraftforge.registries.ForgeRegistries; - -public class HugeexpProcedure { - public static void execute(Level world, double x, double y, double z) { - if (!world.isClientSide()) { - world.playSound(null, BlockPos.containing(x, y + 1, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("target:c4exp")), SoundSource.BLOCKS, 12, 1); - world.playSound(null, BlockPos.containing(x, y + 1, z), TargetModSounds.EXPFAR.get(), SoundSource.BLOCKS, 24, 1); - world.playSound(null, BlockPos.containing(x, y + 1, z), TargetModSounds.EXPVERYFAR.get(), SoundSource.BLOCKS, 64, 1); - } else { - world.playLocalSound(x, (y + 1), z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("target:c4exp")), SoundSource.BLOCKS, 12, 1, false); - world.playLocalSound(x, (y + 1), z, TargetModSounds.EXPFAR.get(), SoundSource.BLOCKS, 24, 1, false); - world.playLocalSound(x, (y + 1), z, TargetModSounds.EXPVERYFAR.get(), SoundSource.BLOCKS, 64, 1, false); - } - if (world instanceof ServerLevel server) { - server.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, server, 4, "", Component.literal(""), server.getServer(), null).withSuppressedOutput(), - "particle minecraft:campfire_cosy_smoke ~ ~ ~ 1 3 1 0.04 200 force"); - server.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, server, 4, "", Component.literal(""), server.getServer(), null).withSuppressedOutput(), - "particle minecraft:large_smoke ~ ~1 ~ 1 3 1 0.02 1000 force"); - server.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, server, 4, "", Component.literal(""), server.getServer(), null).withSuppressedOutput(), - "particle minecraft:campfire_cosy_smoke ~ ~ ~ 6 0.01 6 0.02 500 force"); - server.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, server, 4, "", Component.literal(""), server.getServer(), null).withSuppressedOutput(), - "particle target:firestar ~ ~ ~ 0 0 0 0.5 600 force"); - } - } -} diff --git a/src/main/java/net/mcreator/target/procedures/MedexpProcedure.java b/src/main/java/net/mcreator/target/procedures/MedexpProcedure.java deleted file mode 100644 index 9f0f200df..000000000 --- a/src/main/java/net/mcreator/target/procedures/MedexpProcedure.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.mcreator.target.procedures; - -import net.mcreator.target.init.TargetModSounds; -import net.minecraft.commands.CommandSource; -import net.minecraft.commands.CommandSourceStack; -import net.minecraft.core.BlockPos; -import net.minecraft.network.chat.Component; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.sounds.SoundSource; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; - -public class MedexpProcedure { - public static void execute(LevelAccessor world, double x, double y, double z) { - if (world instanceof Level level) { - if (!level.isClientSide()) { - level.playSound(null, BlockPos.containing(x, y + 1, z), TargetModSounds.EXP.get(), SoundSource.BLOCKS, 12, 1); - level.playSound(null, BlockPos.containing(x, y + 1, z), TargetModSounds.EXPFAR.get(), SoundSource.BLOCKS, 28, 1); - level.playSound(null, BlockPos.containing(x, y + 1, z), TargetModSounds.EXPVERYFAR.get(), SoundSource.BLOCKS, 48, 1); - } else { - level.playLocalSound(x, (y + 1), z, TargetModSounds.EXP.get(), SoundSource.BLOCKS, 12, 1, false); - level.playLocalSound(x, (y + 1), z, TargetModSounds.EXPFAR.get(), SoundSource.BLOCKS, 28, 1, false); - level.playLocalSound(x, (y + 1), z, TargetModSounds.EXPVERYFAR.get(), SoundSource.BLOCKS, 48, 1, false); - } - } - if (world instanceof ServerLevel level) { - level.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, level, 4, "", Component.literal(""), level.getServer(), null).withSuppressedOutput(), - "particle minecraft:campfire_cosy_smoke ~ ~ ~ 0.4 1 0.4 0.02 80 force"); - level.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, level, 4, "", Component.literal(""), level.getServer(), null).withSuppressedOutput(), - "particle minecraft:large_smoke ~ ~1 ~ 0.4 1 0.4 0.02 100 force"); - level.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, level, 4, "", Component.literal(""), level.getServer(), null).withSuppressedOutput(), - "particle minecraft:campfire_cosy_smoke ~ ~ ~ 2 0.001 2 0.01 100 force"); - level.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, (y + 1), z), Vec2.ZERO, level, 4, "", Component.literal(""), level.getServer(), null).withSuppressedOutput(), - "particle target:firestar ~ ~ ~ 0 0 0 0.2 100 force"); - } - } -}