添加BEAST(喜)
This commit is contained in:
parent
0a5d917c41
commit
140e764381
9 changed files with 171 additions and 40 deletions
|
@ -1,4 +1,4 @@
|
||||||
// 1.21.1 2025-05-13T23:25:47.0587486 Item Models: superbwarfare
|
// 1.21.1 2025-05-13T23:50:15.1356608 Item Models: superbwarfare
|
||||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/aa_12_blueprint.json
|
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/aa_12_blueprint.json
|
||||||
0a9bfb695c2b5668863a2de4770f5bfca663c1dc assets/superbwarfare/models/item/agm.json
|
0a9bfb695c2b5668863a2de4770f5bfca663c1dc assets/superbwarfare/models/item/agm.json
|
||||||
29ad5daadcdf7c10771fc45b649c527d16325cbb assets/superbwarfare/models/item/aircraft_catapult.json
|
29ad5daadcdf7c10771fc45b649c527d16325cbb assets/superbwarfare/models/item/aircraft_catapult.json
|
||||||
|
@ -9,6 +9,7 @@ a5cf666a970906ba6ac0af9a4d5d52dd0e093dec assets/superbwarfare/models/item/annihi
|
||||||
4b8fe8fbe5e64c3449ad539317254e4ed7188411 assets/superbwarfare/models/item/ap_head.json
|
4b8fe8fbe5e64c3449ad539317254e4ed7188411 assets/superbwarfare/models/item/ap_head.json
|
||||||
984c08ca6f6893a15721a85e30118f9e32c65c7f assets/superbwarfare/models/item/barbed_wire.json
|
984c08ca6f6893a15721a85e30118f9e32c65c7f assets/superbwarfare/models/item/barbed_wire.json
|
||||||
e8f16946c6f9429989d05e9ec250a72ffc64f9e1 assets/superbwarfare/models/item/beam_test.json
|
e8f16946c6f9429989d05e9ec250a72ffc64f9e1 assets/superbwarfare/models/item/beam_test.json
|
||||||
|
bda38dd5cb3ca4c3e289a012c0529609ac02ded2 assets/superbwarfare/models/item/beast.json
|
||||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/bocek_blueprint.json
|
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/bocek_blueprint.json
|
||||||
140e04e98d9d1c0ee790ca43cb28ad549900ab44 assets/superbwarfare/models/item/cannon_core.json
|
140e04e98d9d1c0ee790ca43cb28ad549900ab44 assets/superbwarfare/models/item/cannon_core.json
|
||||||
1e5b4637c3787516305dd3d1598f401a5e78a954 assets/superbwarfare/models/item/cemented_carbide_action.json
|
1e5b4637c3787516305dd3d1598f401a5e78a954 assets/superbwarfare/models/item/cemented_carbide_action.json
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:item/handheld",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "superbwarfare:item/beast"
|
||||||
|
}
|
||||||
|
}
|
|
@ -71,6 +71,7 @@ public class ModItemModelProvider extends ItemModelProvider {
|
||||||
simpleItem(ModItems.TRANSCRIPT);
|
simpleItem(ModItems.TRANSCRIPT);
|
||||||
simpleItem(ModItems.RAW_SILVER);
|
simpleItem(ModItems.RAW_SILVER);
|
||||||
simpleItem(ModItems.SILVER_INGOT);
|
simpleItem(ModItems.SILVER_INGOT);
|
||||||
|
handheldItem(ModItems.BEAST.getId());
|
||||||
handheldItem(ModItems.CROWBAR.getId());
|
handheldItem(ModItems.CROWBAR.getId());
|
||||||
handheldItem(ModItems.DEFUSER.getId());
|
handheldItem(ModItems.DEFUSER.getId());
|
||||||
simpleItem(ModItems.FIRING_PARAMETERS);
|
simpleItem(ModItems.FIRING_PARAMETERS);
|
||||||
|
|
|
@ -2,16 +2,15 @@ package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.block.BarbedWireBlock;
|
import com.atsuishio.superbwarfare.block.BarbedWireBlock;
|
||||||
import com.atsuishio.superbwarfare.component.ModDataComponents;
|
import com.atsuishio.superbwarfare.component.ModDataComponents;
|
||||||
import com.atsuishio.superbwarfare.config.server.MiscConfig;
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ProjectileConfig;
|
import com.atsuishio.superbwarfare.config.server.ProjectileConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.DPSGeneratorEntity;
|
import com.atsuishio.superbwarfare.entity.DPSGeneratorEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.mixin.ICustomKnockback;
|
import com.atsuishio.superbwarfare.entity.mixin.ICustomKnockback;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
|
import com.atsuishio.superbwarfare.item.Beast;
|
||||||
import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessage;
|
import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessage;
|
||||||
import com.atsuishio.superbwarfare.network.message.receive.ClientMotionSyncMessage;
|
import com.atsuishio.superbwarfare.network.message.receive.ClientMotionSyncMessage;
|
||||||
import com.atsuishio.superbwarfare.network.message.receive.PlayerGunKillMessage;
|
|
||||||
import com.atsuishio.superbwarfare.tools.*;
|
import com.atsuishio.superbwarfare.tools.*;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -45,7 +44,6 @@ import net.minecraft.world.level.ClipContext;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.*;
|
import net.minecraft.world.level.block.*;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.gameevent.GameEvent;
|
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.phys.*;
|
import net.minecraft.world.phys.*;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
|
@ -485,42 +483,7 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beast && entity instanceof LivingEntity living) {
|
if (beast && entity instanceof LivingEntity living) {
|
||||||
if (living.isDeadOrDying()) return;
|
Beast.beastKill(this.shooter, living);
|
||||||
if (living instanceof TargetEntity) return;
|
|
||||||
if (living instanceof DPSGeneratorEntity dpsGeneratorEntity) {
|
|
||||||
dpsGeneratorEntity.beastCharge();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.shooter instanceof ServerPlayer player) {
|
|
||||||
PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5));
|
|
||||||
var holder = Holder.direct(ModSounds.INDICATION.get());
|
|
||||||
player.connection.send(new ClientboundSoundPacket(holder, SoundSource.PLAYERS, player.getX(), player.getY(), player.getZ(), 1f, 1f, player.level().random.nextLong()));
|
|
||||||
((ServerLevel) this.level()).sendParticles(ParticleTypes.DAMAGE_INDICATOR, living.getX(), living.getY() + .5, living.getZ(), 1000, .4, .7, .4, 0);
|
|
||||||
|
|
||||||
if (MiscConfig.SEND_KILL_FEEDBACK.get()) {
|
|
||||||
PacketDistributor.sendToAllPlayers(new PlayerGunKillMessage(player.getId(), living.getId(), false, ModDamageTypes.BEAST));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (living instanceof ServerPlayer victim) {
|
|
||||||
living.setHealth(0);
|
|
||||||
living.level().players().forEach(
|
|
||||||
p -> p.sendSystemMessage(
|
|
||||||
Component.translatable("death.attack.beast_gun",
|
|
||||||
victim.getDisplayName(),
|
|
||||||
shooter == null ? "" : shooter.getDisplayName()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
living.setHealth(0);
|
|
||||||
living.level().broadcastEntityEvent(living, (byte) 60);
|
|
||||||
living.remove(RemovalReason.KILLED);
|
|
||||||
living.gameEvent(GameEvent.ENTITY_DIE);
|
|
||||||
}
|
|
||||||
|
|
||||||
level().playSound(living, new BlockPos((int) living.getX(), (int) living.getY(), (int) living.getZ()), ModSounds.OUCH.get(), SoundSource.PLAYERS, 2.0F, 1.0F);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,7 @@ public class ModItems {
|
||||||
public static final DeferredHolder<Item, BatteryItem> SMALL_BATTERY_PACK = ITEMS.register("small_battery_pack", () -> new BatteryItem(500000, new Item.Properties()));
|
public static final DeferredHolder<Item, BatteryItem> SMALL_BATTERY_PACK = ITEMS.register("small_battery_pack", () -> new BatteryItem(500000, new Item.Properties()));
|
||||||
public static final DeferredHolder<Item, BatteryItem> MEDIUM_BATTERY_PACK = ITEMS.register("medium_battery_pack", () -> new BatteryItem(5000000, new Item.Properties()));
|
public static final DeferredHolder<Item, BatteryItem> MEDIUM_BATTERY_PACK = ITEMS.register("medium_battery_pack", () -> new BatteryItem(5000000, new Item.Properties()));
|
||||||
public static final DeferredHolder<Item, BatteryItem> LARGE_BATTERY_PACK = ITEMS.register("large_battery_pack", () -> new BatteryItem(20000000, new Item.Properties()));
|
public static final DeferredHolder<Item, BatteryItem> LARGE_BATTERY_PACK = ITEMS.register("large_battery_pack", () -> new BatteryItem(20000000, new Item.Properties()));
|
||||||
|
public static final DeferredHolder<Item, Beast> BEAST = ITEMS.register("beast", Beast::new);
|
||||||
public static final DeferredHolder<Item, Transcript> TRANSCRIPT = ITEMS.register("transcript", Transcript::new);
|
public static final DeferredHolder<Item, Transcript> TRANSCRIPT = ITEMS.register("transcript", Transcript::new);
|
||||||
public static final DeferredHolder<Item, FiringParameters> FIRING_PARAMETERS = ITEMS.register("firing_parameters", FiringParameters::new);
|
public static final DeferredHolder<Item, FiringParameters> FIRING_PARAMETERS = ITEMS.register("firing_parameters", FiringParameters::new);
|
||||||
|
|
||||||
|
|
155
src/main/java/com/atsuishio/superbwarfare/item/Beast.java
Normal file
155
src/main/java/com/atsuishio/superbwarfare/item/Beast.java
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
package com.atsuishio.superbwarfare.item;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.config.server.MiscConfig;
|
||||||
|
import com.atsuishio.superbwarfare.entity.DPSGeneratorEntity;
|
||||||
|
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModEnumExtensions;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessage;
|
||||||
|
import com.atsuishio.superbwarfare.network.message.receive.PlayerGunKillMessage;
|
||||||
|
import com.atsuishio.superbwarfare.tools.TraceTool;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.core.component.DataComponents;
|
||||||
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundSoundPacket;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.sounds.SoundSource;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.SwordItem;
|
||||||
|
import net.minecraft.world.item.Tiers;
|
||||||
|
import net.minecraft.world.item.TooltipFlag;
|
||||||
|
import net.minecraft.world.item.component.Unbreakable;
|
||||||
|
import net.minecraft.world.level.gameevent.GameEvent;
|
||||||
|
import net.minecraft.world.phys.AABB;
|
||||||
|
import net.neoforged.neoforge.network.PacketDistributor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Beast extends SwordItem {
|
||||||
|
|
||||||
|
public Beast() {
|
||||||
|
super(Tiers.NETHERITE, new Properties()
|
||||||
|
.stacksTo(1)
|
||||||
|
.rarity(ModEnumExtensions.getLegendary())
|
||||||
|
.setNoRepair()
|
||||||
|
.durability(114514)
|
||||||
|
.component(DataComponents.UNBREAKABLE, new Unbreakable(false))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) {
|
||||||
|
beastKill(attacker, target);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void beastKill(@Nullable Entity attacker, @NotNull Entity target) {
|
||||||
|
if (target.level().isClientSide ||
|
||||||
|
(target instanceof LivingEntity living && living.isDeadOrDying())
|
||||||
|
|| target instanceof TargetEntity
|
||||||
|
) return;
|
||||||
|
|
||||||
|
if (target instanceof DPSGeneratorEntity generator) {
|
||||||
|
generator.beastCharge();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attacker instanceof ServerPlayer player) {
|
||||||
|
PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5));
|
||||||
|
var holder = Holder.direct(ModSounds.INDICATION.get());
|
||||||
|
player.connection.send(new ClientboundSoundPacket(holder, SoundSource.PLAYERS, player.getX(), player.getY(), player.getZ(), 1f, 1f, player.level().random.nextLong()));
|
||||||
|
|
||||||
|
var box = target.getBoundingBox();
|
||||||
|
((ServerLevel) attacker.level()).sendParticles(ParticleTypes.DAMAGE_INDICATOR,
|
||||||
|
target.getX(), target.getY() + .5, target.getZ(),
|
||||||
|
1000,
|
||||||
|
box.getXsize() / 2.5, box.getYsize() / 3, box.getZsize() / 2.5,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
if (MiscConfig.SEND_KILL_FEEDBACK.get()) {
|
||||||
|
PacketDistributor.sendToAllPlayers(new PlayerGunKillMessage(player.getId(), target.getId(), false, ModDamageTypes.BEAST));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target instanceof ServerPlayer victim) {
|
||||||
|
victim.setHealth(0);
|
||||||
|
victim.level().players().forEach(
|
||||||
|
p -> p.sendSystemMessage(
|
||||||
|
Component.translatable("death.attack.beast_gun",
|
||||||
|
victim.getDisplayName(),
|
||||||
|
attacker != null ? attacker.getDisplayName() : ""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (target instanceof LivingEntity living) {
|
||||||
|
living.setHealth(0);
|
||||||
|
}
|
||||||
|
target.level().broadcastEntityEvent(target, (byte) 60);
|
||||||
|
target.remove(Entity.RemovalReason.KILLED);
|
||||||
|
target.gameEvent(GameEvent.ENTITY_DIE);
|
||||||
|
}
|
||||||
|
|
||||||
|
target.level().playSound(target, new BlockPos((int) target.getX(), (int) target.getY(), (int) target.getZ()), ModSounds.OUCH.get(), SoundSource.PLAYERS, 2.0F, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
public @NotNull AABB getSweepHitBox(ItemStack stack, Player player, Entity target) {
|
||||||
|
return super.getSweepHitBox(stack, player, target).inflate(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
public boolean canBeHurtBy(ItemStack stack, DamageSource source) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnchantable(@NotNull ItemStack stack) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
public boolean onEntitySwing(ItemStack stack, LivingEntity entity, InteractionHand hand) {
|
||||||
|
var target = TraceTool.findMeleeEntity(entity, 50);
|
||||||
|
if (target != null) {
|
||||||
|
beastKill(entity, target);
|
||||||
|
}
|
||||||
|
return super.onEntitySwing(stack, entity, hand);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
public boolean onLeftClickEntity(ItemStack stack, Player player, Entity entity) {
|
||||||
|
beastKill(player, entity);
|
||||||
|
return super.onLeftClickEntity(stack, player, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
public boolean canDisableShield(ItemStack stack, ItemStack shield, LivingEntity entity, LivingEntity attacker) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
public void appendHoverText(ItemStack stack, TooltipContext context, List<Component> tooltipComponents, TooltipFlag tooltipFlag) {
|
||||||
|
tooltipComponents.add(Component.translatable("des.superbwarfare.beast").withColor(0xa56855));
|
||||||
|
}
|
||||||
|
}
|
|
@ -173,6 +173,8 @@
|
||||||
"item.superbwarfare.agm": "Air-to-ground Missile",
|
"item.superbwarfare.agm": "Air-to-ground Missile",
|
||||||
"des.superbwarfare.agm": "Suitable for A-10 Thunderbolt II",
|
"des.superbwarfare.agm": "Suitable for A-10 Thunderbolt II",
|
||||||
|
|
||||||
|
"item.superbwarfare.beast": "BEAST",
|
||||||
|
"des.superbwarfare.beast": "You are one one one...",
|
||||||
"item.superbwarfare.firing_parameters": "Firing Parameters",
|
"item.superbwarfare.firing_parameters": "Firing Parameters",
|
||||||
"item.superbwarfare.ancient_cpu": "Ancient CPU",
|
"item.superbwarfare.ancient_cpu": "Ancient CPU",
|
||||||
"item.superbwarfare.target_deployer": "Target",
|
"item.superbwarfare.target_deployer": "Target",
|
||||||
|
|
|
@ -173,6 +173,8 @@
|
||||||
"item.superbwarfare.agm": "空对地导弹",
|
"item.superbwarfare.agm": "空对地导弹",
|
||||||
"des.superbwarfare.agm": "适配A-10攻击机",
|
"des.superbwarfare.agm": "适配A-10攻击机",
|
||||||
|
|
||||||
|
"item.superbwarfare.beast": "BEAST",
|
||||||
|
"des.superbwarfare.beast": "你是一个一个一个......",
|
||||||
"item.superbwarfare.firing_parameters": "射击诸元",
|
"item.superbwarfare.firing_parameters": "射击诸元",
|
||||||
"item.superbwarfare.ancient_cpu": "古代处理器",
|
"item.superbwarfare.ancient_cpu": "古代处理器",
|
||||||
"item.superbwarfare.target_deployer": "标靶",
|
"item.superbwarfare.target_deployer": "标靶",
|
||||||
|
|
BIN
src/main/resources/assets/superbwarfare/textures/item/beast.png
Normal file
BIN
src/main/resources/assets/superbwarfare/textures/item/beast.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 286 B |
Loading…
Add table
Reference in a new issue