diff --git a/src/main/java/net/mcreator/superbwarfare/entity/HandGrenadeEntity.java b/src/main/java/net/mcreator/superbwarfare/entity/HandGrenadeEntity.java index de411120f..67d72e4ff 100644 --- a/src/main/java/net/mcreator/superbwarfare/entity/HandGrenadeEntity.java +++ b/src/main/java/net/mcreator/superbwarfare/entity/HandGrenadeEntity.java @@ -127,7 +127,7 @@ public class HandGrenadeEntity extends ThrowableItemProjectile { private void causeExplode() { CustomExplosion explosion = new CustomExplosion(this.level(), this, ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), 90, - this.getX(), this.getY(), this.getZ(), 10f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(2); + this.getX(), this.getY(), this.getZ(), 6.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(2); explosion.explode(); net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion); explosion.finalizeExplosion(false); diff --git a/src/main/java/net/mcreator/superbwarfare/init/ModSounds.java b/src/main/java/net/mcreator/superbwarfare/init/ModSounds.java index 7d2bdd9d4..c93ba60ad 100644 --- a/src/main/java/net/mcreator/superbwarfare/init/ModSounds.java +++ b/src/main/java/net/mcreator/superbwarfare/init/ModSounds.java @@ -192,4 +192,6 @@ public class ModSounds { public static final RegistryObject BULLET_SUPPLY = REGISTRY.register("bullet_supply", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("superbwarfare", "bullet_supply"))); public static final RegistryObject ADJUST_FOV = REGISTRY.register("adjust_fov", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("superbwarfare", "adjust_fov"))); public static final RegistryObject DRONE_SOUND = REGISTRY.register("drone_sound", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("superbwarfare", "drone_sound"))); + public static final RegistryObject GRENADE_PULL = REGISTRY.register("grenade_pull", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("superbwarfare", "grenade_pull"))); + public static final RegistryObject GRENADE_THROW = REGISTRY.register("grenade_throw", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("superbwarfare", "grenade_throw"))); } diff --git a/src/main/java/net/mcreator/superbwarfare/item/HandGrenade.java b/src/main/java/net/mcreator/superbwarfare/item/HandGrenade.java index 34e1059df..35dc10f1f 100644 --- a/src/main/java/net/mcreator/superbwarfare/item/HandGrenade.java +++ b/src/main/java/net/mcreator/superbwarfare/item/HandGrenade.java @@ -2,8 +2,11 @@ package net.mcreator.superbwarfare.item; import net.mcreator.superbwarfare.entity.HandGrenadeEntity; import net.mcreator.superbwarfare.init.ModDamageTypes; +import net.mcreator.superbwarfare.init.ModSounds; import net.mcreator.superbwarfare.tools.CustomExplosion; import net.mcreator.superbwarfare.tools.ParticleTool; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.LivingEntity; @@ -25,6 +28,9 @@ public class HandGrenade extends Item { public @NotNull InteractionResultHolder use(Level worldIn, Player playerIn, InteractionHand handIn) { ItemStack stack = playerIn.getItemInHand(handIn); playerIn.startUsingItem(handIn); + if (playerIn instanceof ServerPlayer serverPlayer) { + serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.GRENADE_PULL.get(), SoundSource.PLAYERS, 1, 1); + } return InteractionResultHolder.consume(stack); } @@ -45,6 +51,10 @@ public class HandGrenade extends Item { handGrenade.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0f, power, 0.0f); worldIn.addFreshEntity(handGrenade); + if (player instanceof ServerPlayer serverPlayer) { + serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.GRENADE_THROW.get(), SoundSource.PLAYERS, 1, 1); + } + if (!player.isCreative()) { stack.shrink(1); } @@ -59,7 +69,7 @@ public class HandGrenade extends Item { if (!pLevel.isClientSide) { CustomExplosion explosion = new CustomExplosion(pLevel, null, ModDamageTypes.causeProjectileBoomDamage(pLevel.registryAccess(), pLivingEntity, pLivingEntity), 90, - pLivingEntity.getX(), pLivingEntity.getY(), pLivingEntity.getZ(), 10f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(2); + pLivingEntity.getX(), pLivingEntity.getY(), pLivingEntity.getZ(), 6.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(2); explosion.explode(); net.minecraftforge.event.ForgeEventFactory.onExplosionStart(pLevel, explosion); explosion.finalizeExplosion(false); diff --git a/src/main/resources/assets/superbwarfare/models/item/hand_grenade.json b/src/main/resources/assets/superbwarfare/models/item/hand_grenade.json index a992c648a..29a8df9d4 100644 --- a/src/main/resources/assets/superbwarfare/models/item/hand_grenade.json +++ b/src/main/resources/assets/superbwarfare/models/item/hand_grenade.json @@ -285,14 +285,14 @@ ], "display": { "firstperson_righthand": { - "rotation": [0, -9, -7.25], - "translation": [-2, 2.25, 3.25], - "scale": [1.5, 1.5, 1] + "rotation": [-3, -19, -7.25], + "translation": [5.5, -0.75, -3.5], + "scale": [2, 2, 2] }, "firstperson_lefthand": { - "rotation": [0, -9, -7.25], - "translation": [-2, 2.25, 3.25], - "scale": [1.5, 1.5, 1] + "rotation": [-3, -19, -7.25], + "translation": [5.5, -0.75, -3.5], + "scale": [2, 2, 2] }, "ground": { "translation": [0, -2, 0] diff --git a/src/main/resources/assets/superbwarfare/sounds.json b/src/main/resources/assets/superbwarfare/sounds.json index 082215900..6db823959 100644 --- a/src/main/resources/assets/superbwarfare/sounds.json +++ b/src/main/resources/assets/superbwarfare/sounds.json @@ -1582,5 +1582,21 @@ "stream": false } ] + }, + "grenade_throw": { + "sounds": [ + { + "name": "superbwarfare:grenade_throw", + "stream": false + } + ] + }, + "grenade_pull": { + "sounds": [ + { + "name": "superbwarfare:grenade_pull", + "stream": false + } + ] } } \ No newline at end of file diff --git a/src/main/resources/assets/superbwarfare/sounds/grenade_pull.ogg b/src/main/resources/assets/superbwarfare/sounds/grenade_pull.ogg new file mode 100644 index 000000000..211acad10 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/sounds/grenade_pull.ogg differ diff --git a/src/main/resources/assets/superbwarfare/sounds/grenade_throw.ogg b/src/main/resources/assets/superbwarfare/sounds/grenade_throw.ogg new file mode 100644 index 000000000..47b8c43ec Binary files /dev/null and b/src/main/resources/assets/superbwarfare/sounds/grenade_throw.ogg differ