添加钢管(

This commit is contained in:
Atsuishio 2025-06-23 15:14:26 +08:00 committed by Light_Quanta
parent bfb9ca04cf
commit b7e69a1e2b
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
14 changed files with 255 additions and 1 deletions

View file

@ -1,5 +1,6 @@
package com.atsuishio.superbwarfare.event; package com.atsuishio.superbwarfare.event;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.api.event.PreKillEvent; import com.atsuishio.superbwarfare.api.event.PreKillEvent;
import com.atsuishio.superbwarfare.component.ModDataComponents; import com.atsuishio.superbwarfare.component.ModDataComponents;
import com.atsuishio.superbwarfare.config.common.GameplayConfig; 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.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.common.util.TriState; 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.living.*;
import net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent; import net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent;
import net.neoforged.neoforge.network.PacketDistributor; import net.neoforged.neoforge.network.PacketDistributor;
@ -656,4 +658,12 @@ public class LivingEventHandler {
event.setResult(MobEffectEvent.Applicable.Result.DO_NOT_APPLY); 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));
}
}
} }

View file

@ -153,6 +153,7 @@ public class ModItems {
public static final DeferredHolder<Item, Hammer> HAMMER = ITEMS.register("hammer", Hammer::new); public static final DeferredHolder<Item, Hammer> HAMMER = ITEMS.register("hammer", Hammer::new);
public static final DeferredHolder<Item, TBaton> T_BATON = ITEMS.register("t_baton", TBaton::new); public static final DeferredHolder<Item, TBaton> T_BATON = ITEMS.register("t_baton", TBaton::new);
public static final DeferredHolder<Item, ElectricBaton> ELECTRIC_BATON = ITEMS.register("electric_baton", ElectricBaton::new); public static final DeferredHolder<Item, ElectricBaton> ELECTRIC_BATON = ITEMS.register("electric_baton", ElectricBaton::new);
public static final DeferredHolder<Item, SteelPipe> STEEL_PIPE = ITEMS.register("steel_pipe", SteelPipe::new);
public static final DeferredHolder<Item, Crowbar> CROWBAR = ITEMS.register("crowbar", Crowbar::new); public static final DeferredHolder<Item, Crowbar> CROWBAR = ITEMS.register("crowbar", Crowbar::new);
public static final DeferredHolder<Item, Defuser> DEFUSER = ITEMS.register("defuser", Defuser::new); public static final DeferredHolder<Item, Defuser> DEFUSER = ITEMS.register("defuser", Defuser::new);
public static final DeferredHolder<Item, ArmorPlate> ARMOR_PLATE = ITEMS.register("armor_plate", ArmorPlate::new); public static final DeferredHolder<Item, ArmorPlate> ARMOR_PLATE = ITEMS.register("armor_plate", ArmorPlate::new);

View file

@ -479,5 +479,8 @@ public class ModSounds {
public static final DeferredHolder<SoundEvent, SoundEvent> AURELIA_SCEPTRE_FIRE_3P = REGISTRY.register("aurelia_sceptre_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("aurelia_sceptre_fire_3p"))); public static final DeferredHolder<SoundEvent, SoundEvent> AURELIA_SCEPTRE_FIRE_3P = REGISTRY.register("aurelia_sceptre_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("aurelia_sceptre_fire_3p")));
public static final DeferredHolder<SoundEvent, SoundEvent> DPS_GENERATOR_EVOLVE = REGISTRY.register("dps_generator_evolve", () -> SoundEvent.createVariableRangeEvent(Mod.loc("dps_generator_evolve"))); public static final DeferredHolder<SoundEvent, SoundEvent> DPS_GENERATOR_EVOLVE = REGISTRY.register("dps_generator_evolve", () -> SoundEvent.createVariableRangeEvent(Mod.loc("dps_generator_evolve")));
public static final DeferredHolder<SoundEvent, SoundEvent> STEEL_PIPE_HIT = REGISTRY.register("steel_pipe_hit", () -> SoundEvent.createVariableRangeEvent(Mod.loc("steel_pipe_hit")));
public static final DeferredHolder<SoundEvent, SoundEvent> STEEL_PIPE_DROP = REGISTRY.register("steel_pipe_drop", () -> SoundEvent.createVariableRangeEvent(Mod.loc("steel_pipe_drop")));
} }

View file

@ -21,7 +21,7 @@ public class Hammer extends SwordItem {
public Hammer() { public Hammer() {
super(Tiers.IRON, new Item.Properties() super(Tiers.IRON, new Item.Properties()
.durability(400) .durability(400)
.attributes(SwordItem.createAttributes(Tiers.IRON, 9, -3.2f)) .attributes(SwordItem.createAttributes(Tiers.IRON, 11, -3.2f))
); );
} }

View file

@ -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);
}
}

View file

@ -196,6 +196,7 @@
"item.superbwarfare.hammer": "Hammer", "item.superbwarfare.hammer": "Hammer",
"item.superbwarfare.t_baton": "T-Baton", "item.superbwarfare.t_baton": "T-Baton",
"item.superbwarfare.electric_baton": "Electric 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": "Right click while sneaking to switch electroshock mode",
"des.superbwarfare.electric_baton.open": "Electroshock Mode Enabled", "des.superbwarfare.electric_baton.open": "Electroshock Mode Enabled",
"des.superbwarfare.electric_baton.close": "Electroshock Mode Disabled", "des.superbwarfare.electric_baton.close": "Electroshock Mode Disabled",

View file

@ -196,6 +196,7 @@
"item.superbwarfare.hammer": "大锤", "item.superbwarfare.hammer": "大锤",
"item.superbwarfare.t_baton": "警棍", "item.superbwarfare.t_baton": "警棍",
"item.superbwarfare.electric_baton": "电棍", "item.superbwarfare.electric_baton": "电棍",
"item.superbwarfare.steel_pipe": "钢管",
"des.superbwarfare.electric_baton": "潜行使用以开关电击模式", "des.superbwarfare.electric_baton": "潜行使用以开关电击模式",
"des.superbwarfare.electric_baton.open": "已开启电击模式", "des.superbwarfare.electric_baton.open": "已开启电击模式",
"des.superbwarfare.electric_baton.close": "已关闭电击模式", "des.superbwarfare.electric_baton.close": "已关闭电击模式",

View file

@ -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]
}
]
}

View file

@ -3290,5 +3290,21 @@
"stream": false "stream": false
} }
] ]
},
"steel_pipe_hit": {
"sounds": [
{
"name": "superbwarfare:steel_pipe_hit",
"stream": false
}
]
},
"steel_pipe_drop": {
"sounds": [
{
"name": "superbwarfare:steel_pipe_drop",
"stream": false
}
]
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

View file

@ -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
}
}

View file

@ -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
}
}
]
}
}