diff --git a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java index 62d3c2f1a..5ce5a50ac 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java @@ -1,5 +1,6 @@ package com.atsuishio.superbwarfare.event; +import com.atsuishio.superbwarfare.Mod; import com.atsuishio.superbwarfare.api.event.PreKillEvent; import com.atsuishio.superbwarfare.component.ModDataComponents; import com.atsuishio.superbwarfare.config.common.GameplayConfig; @@ -45,6 +46,7 @@ import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.common.util.TriState; +import net.neoforged.neoforge.event.entity.item.ItemTossEvent; import net.neoforged.neoforge.event.entity.living.*; import net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent; import net.neoforged.neoforge.network.PacketDistributor; @@ -656,4 +658,12 @@ public class LivingEventHandler { event.setResult(MobEffectEvent.Applicable.Result.DO_NOT_APPLY); } } + + @SubscribeEvent + public static void onItemSpawned(ItemTossEvent event) { + if (event.getEntity().getItem().getItem() == ModItems.STEEL_PIPE.get()) { + Mod.queueServerWork(5, () -> + event.getEntity().level().playSound(null, event.getEntity().getOnPos(), ModSounds.STEEL_PIPE_DROP.get(), SoundSource.PLAYERS, 2, 1)); + } + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java b/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java index b68584ce9..686d525a0 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java @@ -153,6 +153,7 @@ public class ModItems { public static final DeferredHolder HAMMER = ITEMS.register("hammer", Hammer::new); public static final DeferredHolder T_BATON = ITEMS.register("t_baton", TBaton::new); public static final DeferredHolder ELECTRIC_BATON = ITEMS.register("electric_baton", ElectricBaton::new); + public static final DeferredHolder STEEL_PIPE = ITEMS.register("steel_pipe", SteelPipe::new); public static final DeferredHolder CROWBAR = ITEMS.register("crowbar", Crowbar::new); public static final DeferredHolder DEFUSER = ITEMS.register("defuser", Defuser::new); public static final DeferredHolder ARMOR_PLATE = ITEMS.register("armor_plate", ArmorPlate::new); diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java b/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java index 85a8d9f2c..952d3a733 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java @@ -479,5 +479,8 @@ public class ModSounds { public static final DeferredHolder AURELIA_SCEPTRE_FIRE_3P = REGISTRY.register("aurelia_sceptre_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("aurelia_sceptre_fire_3p"))); public static final DeferredHolder DPS_GENERATOR_EVOLVE = REGISTRY.register("dps_generator_evolve", () -> SoundEvent.createVariableRangeEvent(Mod.loc("dps_generator_evolve"))); + public static final DeferredHolder STEEL_PIPE_HIT = REGISTRY.register("steel_pipe_hit", () -> SoundEvent.createVariableRangeEvent(Mod.loc("steel_pipe_hit"))); + public static final DeferredHolder STEEL_PIPE_DROP = REGISTRY.register("steel_pipe_drop", () -> SoundEvent.createVariableRangeEvent(Mod.loc("steel_pipe_drop"))); + } diff --git a/src/main/java/com/atsuishio/superbwarfare/item/Hammer.java b/src/main/java/com/atsuishio/superbwarfare/item/Hammer.java index 9f1e9f9e8..5d73876a9 100644 --- a/src/main/java/com/atsuishio/superbwarfare/item/Hammer.java +++ b/src/main/java/com/atsuishio/superbwarfare/item/Hammer.java @@ -21,7 +21,7 @@ public class Hammer extends SwordItem { public Hammer() { super(Tiers.IRON, new Item.Properties() .durability(400) - .attributes(SwordItem.createAttributes(Tiers.IRON, 9, -3.2f)) + .attributes(SwordItem.createAttributes(Tiers.IRON, 11, -3.2f)) ); } diff --git a/src/main/java/com/atsuishio/superbwarfare/item/SteelPipe.java b/src/main/java/com/atsuishio/superbwarfare/item/SteelPipe.java new file mode 100644 index 000000000..97fd723b6 --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/item/SteelPipe.java @@ -0,0 +1,25 @@ +package com.atsuishio.superbwarfare.item; + +import com.atsuishio.superbwarfare.init.ModSounds; +import com.atsuishio.superbwarfare.tiers.ModItemTier; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.SwordItem; +import org.jetbrains.annotations.NotNull; + +public class SteelPipe extends SwordItem { + public SteelPipe() { + super(ModItemTier.STEEL, new Item.Properties() + .durability(1919) + .attributes(SwordItem.createAttributes(ModItemTier.STEEL, 6, -2.5f)) + ); + } + + @Override + public boolean hurtEnemy(@NotNull ItemStack pStack, LivingEntity pTarget, LivingEntity pAttacker) { + pAttacker.level().playSound(null, pTarget.getOnPos(), ModSounds.STEEL_PIPE_HIT.get(), SoundSource.PLAYERS, 1, (float) ((2 * org.joml.Math.random() - 1) * 0.1f + 1.0f)); + return super.hurtEnemy(pStack, pTarget, pAttacker); + } +} diff --git a/src/main/resources/assets/superbwarfare/lang/en_us.json b/src/main/resources/assets/superbwarfare/lang/en_us.json index 4bc650518..8150426d6 100644 --- a/src/main/resources/assets/superbwarfare/lang/en_us.json +++ b/src/main/resources/assets/superbwarfare/lang/en_us.json @@ -196,6 +196,7 @@ "item.superbwarfare.hammer": "Hammer", "item.superbwarfare.t_baton": "T-Baton", "item.superbwarfare.electric_baton": "Electric Baton", + "item.superbwarfare.steel_pipe": "Steel Pope", "des.superbwarfare.electric_baton": "Right click while sneaking to switch electroshock mode", "des.superbwarfare.electric_baton.open": "Electroshock Mode Enabled", "des.superbwarfare.electric_baton.close": "Electroshock Mode Disabled", diff --git a/src/main/resources/assets/superbwarfare/lang/zh_cn.json b/src/main/resources/assets/superbwarfare/lang/zh_cn.json index 28c55bb24..fb5e5b64f 100644 --- a/src/main/resources/assets/superbwarfare/lang/zh_cn.json +++ b/src/main/resources/assets/superbwarfare/lang/zh_cn.json @@ -196,6 +196,7 @@ "item.superbwarfare.hammer": "大锤", "item.superbwarfare.t_baton": "警棍", "item.superbwarfare.electric_baton": "电棍", + "item.superbwarfare.steel_pipe": "钢管", "des.superbwarfare.electric_baton": "潜行使用以开关电击模式", "des.superbwarfare.electric_baton.open": "已开启电击模式", "des.superbwarfare.electric_baton.close": "已关闭电击模式", diff --git a/src/main/resources/assets/superbwarfare/models/item/steel_pipe.json b/src/main/resources/assets/superbwarfare/models/item/steel_pipe.json new file mode 100644 index 000000000..c73144adf --- /dev/null +++ b/src/main/resources/assets/superbwarfare/models/item/steel_pipe.json @@ -0,0 +1,140 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [32, 32], + "textures": { + "0": "superbwarfare:item/steel_pipe", + "particle": "superbwarfare:item/steel_pipe" + }, + "elements": [ + { + "from": [7.75, 0, 7.39645], + "to": [8.25, 24, 7.52145], + "rotation": {"angle": -22.5, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "north": {"uv": [0, 0, 0.5, 12], "texture": "#0"}, + "south": {"uv": [0.5, 0, 1, 12], "texture": "#0"}, + "up": {"uv": [8.5, 0.5, 8, 0], "texture": "#0"}, + "down": {"uv": [8.5, 0.5, 8, 1], "texture": "#0"} + } + }, + { + "from": [7.75, 0, 7.39645], + "to": [8.25, 24, 7.52145], + "rotation": {"angle": 22.5, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "north": {"uv": [1, 0, 1.5, 12], "texture": "#0"}, + "south": {"uv": [1.5, 0, 2, 12], "texture": "#0"}, + "up": {"uv": [8.5, 1.5, 8, 1], "texture": "#0"}, + "down": {"uv": [8.5, 1.5, 8, 2], "texture": "#0"} + } + }, + { + "from": [7.39645, 0, 7.75], + "to": [7.52145, 24, 8.25], + "rotation": {"angle": -22.5, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "east": {"uv": [2, 0, 2.5, 12], "texture": "#0"}, + "west": {"uv": [2.5, 0, 3, 12], "texture": "#0"}, + "up": {"uv": [8.5, 2.5, 8, 2], "texture": "#0"}, + "down": {"uv": [8.5, 2.5, 8, 3], "texture": "#0"} + } + }, + { + "from": [7.39645, 0, 7.75], + "to": [7.52145, 24, 8.25], + "rotation": {"angle": 22.5, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "east": {"uv": [3, 0, 3.5, 12], "texture": "#0"}, + "west": {"uv": [3.5, 0, 4, 12], "texture": "#0"}, + "up": {"uv": [8.5, 3.5, 8, 3], "texture": "#0"}, + "down": {"uv": [8.5, 3.5, 8, 4], "texture": "#0"} + } + }, + { + "from": [8.47855, 0, 7.75], + "to": [8.60355, 24, 8.25], + "rotation": {"angle": 22.5, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "east": {"uv": [4, 0, 4.5, 12], "texture": "#0"}, + "west": {"uv": [4.5, 0, 5, 12], "texture": "#0"}, + "up": {"uv": [8.5, 4.5, 8, 4], "texture": "#0"}, + "down": {"uv": [8.5, 4.5, 8, 5], "texture": "#0"} + } + }, + { + "from": [7.75, 0, 8.47855], + "to": [8.25, 24, 8.60355], + "rotation": {"angle": -22.5, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "north": {"uv": [5, 0, 5.5, 12], "texture": "#0"}, + "south": {"uv": [5.5, 0, 6, 12], "texture": "#0"}, + "up": {"uv": [8.5, 5.5, 8, 5], "texture": "#0"}, + "down": {"uv": [8.5, 5.5, 8, 6], "texture": "#0"} + } + }, + { + "from": [7.75, 0, 8.47855], + "to": [8.25, 24, 8.60355], + "rotation": {"angle": 22.5, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "north": {"uv": [6, 0, 6.5, 12], "texture": "#0"}, + "south": {"uv": [6.5, 0, 7, 12], "texture": "#0"}, + "up": {"uv": [8.5, 6.5, 8, 6], "texture": "#0"}, + "down": {"uv": [8.5, 6.5, 8, 7], "texture": "#0"} + } + }, + { + "from": [8.47855, 0, 7.75], + "to": [8.60355, 24, 8.25], + "rotation": {"angle": -22.5, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "east": {"uv": [7, 0, 7.5, 12], "texture": "#0"}, + "west": {"uv": [7.5, 0, 8, 12], "texture": "#0"}, + "up": {"uv": [8.5, 7.5, 8, 7], "texture": "#0"}, + "down": {"uv": [8.5, 7.5, 8, 8], "texture": "#0"} + } + } + ], + "gui_light": "front", + "display": { + "thirdperson_righthand": { + "translation": [0, 3, 1.25] + }, + "thirdperson_lefthand": { + "translation": [0, 3, 1.25] + }, + "firstperson_righthand": { + "rotation": [11.75, 0, 0], + "translation": [-0.5, 2.25, 1], + "scale": [0.75, 0.75, 0.75] + }, + "firstperson_lefthand": { + "rotation": [11.75, 0, 0], + "translation": [-0.5, 2.25, 1], + "scale": [0.75, 0.75, 0.75] + }, + "ground": { + "translation": [0, 5.25, 0] + }, + "gui": { + "rotation": [180, 0, -135], + "translation": [-2.25, -2.25, 0], + "scale": [0.8, 0.8, 0.8] + }, + "head": { + "translation": [0, 13.5, 0] + }, + "fixed": { + "rotation": [0, 0, 45], + "scale": [1.25, 1.25, 1.25] + } + }, + "groups": [ + { + "name": "group", + "origin": [6.73483, 1, 6.44194], + "color": 0, + "children": [0, 1, 2, 3, 4, 5, 6, 7] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/superbwarfare/sounds.json b/src/main/resources/assets/superbwarfare/sounds.json index 7d56ca469..a232ab284 100644 --- a/src/main/resources/assets/superbwarfare/sounds.json +++ b/src/main/resources/assets/superbwarfare/sounds.json @@ -3290,5 +3290,21 @@ "stream": false } ] + }, + "steel_pipe_hit": { + "sounds": [ + { + "name": "superbwarfare:steel_pipe_hit", + "stream": false + } + ] + }, + "steel_pipe_drop": { + "sounds": [ + { + "name": "superbwarfare:steel_pipe_drop", + "stream": false + } + ] } } \ No newline at end of file diff --git a/src/main/resources/assets/superbwarfare/sounds/steel_pipe_drop.ogg b/src/main/resources/assets/superbwarfare/sounds/steel_pipe_drop.ogg new file mode 100644 index 000000000..404541cda Binary files /dev/null and b/src/main/resources/assets/superbwarfare/sounds/steel_pipe_drop.ogg differ diff --git a/src/main/resources/assets/superbwarfare/sounds/steel_pipe_hit.ogg b/src/main/resources/assets/superbwarfare/sounds/steel_pipe_hit.ogg new file mode 100644 index 000000000..c432dd7c5 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/sounds/steel_pipe_hit.ogg differ diff --git a/src/main/resources/assets/superbwarfare/textures/item/steel_pipe.png b/src/main/resources/assets/superbwarfare/textures/item/steel_pipe.png new file mode 100644 index 000000000..55d6da416 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/item/steel_pipe.png differ diff --git a/src/main/resources/data/superbwarfare/recipe/steel_pipe_crafting.json b/src/main/resources/data/superbwarfare/recipe/steel_pipe_crafting.json new file mode 100644 index 000000000..8ecc0d9c9 --- /dev/null +++ b/src/main/resources/data/superbwarfare/recipe/steel_pipe_crafting.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "pattern": [ + " a", + "a " + ], + "key": { + "a": { + "item": "superbwarfare:steel_barrel" + } + }, + "result": { + "id": "superbwarfare:steel_pipe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/superbwarfare/weapon_attributes/steel_pipe.json b/src/main/resources/data/superbwarfare/weapon_attributes/steel_pipe.json new file mode 100644 index 000000000..85577bdbd --- /dev/null +++ b/src/main/resources/data/superbwarfare/weapon_attributes/steel_pipe.json @@ -0,0 +1,40 @@ +{ + "attributes": { + "attack_range": 3.3, + "two_handed": false, + "category": "katana", + "attacks": [ + { + "hitbox": "HORIZONTAL_PLANE", + "damage_multiplier": 1, + "angle": 160, + "upswing": 0.5, + "animation": "bettercombat:two_handed_slash_horizontal_right", + "swing_sound": { + "id": "bettercombat:axe_slash" + } + }, + { + "hitbox": "HORIZONTAL_PLANE", + "damage_multiplier": 1, + "angle": 160, + "upswing": 0.5, + "animation": "bettercombat:two_handed_slash_horizontal_left", + "swing_sound": { + "id": "bettercombat:axe_slash" + } + }, + { + "hitbox": "VERTICAL_PLANE", + "damage_multiplier": 1.5, + "angle": 150, + "upswing": 0.5, + "animation": "bettercombat:two_handed_slam_heavy", + "swing_sound": { + "id": "bettercombat:hammer_slam", + "randomness": 0 + } + } + ] + } +} \ No newline at end of file