添加二次灾变配方和小型炮弹,修复无人机bug

This commit is contained in:
Atsuihsio 2025-01-17 21:18:32 +08:00
parent 0429c59831
commit 7e59b33c83
18 changed files with 175 additions and 18 deletions

View file

@ -1,4 +1,4 @@
// 1.20.1 2025-01-09T05:18:04.2557625 Item Models: superbwarfare
// 1.20.1 2025-01-17T20:28:44.4663695 Item Models: superbwarfare
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/aa_12_blueprint.json
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/ak_12_blueprint.json
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/ak_47_blueprint.json
@ -89,10 +89,12 @@ ce0f0949b0545d8ef08aeaa52dd423dbe592f704 assets/superbwarfare/models/item/raw_ce
34aecddee2e3b903c075b1625e1b23c57ea23fd1 assets/superbwarfare/models/item/ru_chest_6b43.json
66a2586547a7cc44a80f950036a1795af580518a assets/superbwarfare/models/item/ru_helmet_6b47.json
ce2232fbc6a9186371c6ae6745ec3be2a0a33546 assets/superbwarfare/models/item/scheelite.json
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/secondary_cataclysm_blueprint.json
c010baff106b3307ec585df4757f7c3d756e9794 assets/superbwarfare/models/item/seeker.json
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/sentinel_blueprint.json
129239c26d14526d65764dc10ef99864c9ef7fff assets/superbwarfare/models/item/silver_ingot.json
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/sks_blueprint.json
6c55bc5d7664a4bc351118876c97c78597f05df7 assets/superbwarfare/models/item/small_shell.json
93a18630b8c0a5aab1f0202f42b8bd5ee7153c38 assets/superbwarfare/models/item/steel_action.json
321bafbe4487eda1a6ca82eec647eabc3230a4e3 assets/superbwarfare/models/item/steel_barrel.json
b4e009177af3af6ad6dda54e3e2fed43dc243ff2 assets/superbwarfare/models/item/steel_ingot.json

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "superbwarfare:item/gun_blueprint"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "superbwarfare:item/small_shell"
}
}

View file

@ -386,8 +386,29 @@ public class ClickHandler {
Player player = Minecraft.getInstance().player;
if (player == null) return;
handleVehicleMove(key, state, player);
handleDroneMove(key, state, player);
}
private static void handleDroneMove(int key, int state, Player player) {
ItemStack stack = player.getMainHandItem();
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
var options = Minecraft.getInstance().options;
if (key == options.keyLeft.getKey().getValue()) {
ModUtils.PACKET_HANDLER.sendToServer(new VehicleMovementMessage(0, state == 1));
} else if (key == options.keyRight.getKey().getValue()) {
ModUtils.PACKET_HANDLER.sendToServer(new VehicleMovementMessage(1, state == 1));
} else if (key == options.keyUp.getKey().getValue()) {
ModUtils.PACKET_HANDLER.sendToServer(new VehicleMovementMessage(2, state == 1));
} else if (key == options.keyDown.getKey().getValue()) {
ModUtils.PACKET_HANDLER.sendToServer(new VehicleMovementMessage(3, state == 1));
} else if (key == options.keyJump.getKey().getValue()) {
ModUtils.PACKET_HANDLER.sendToServer(new VehicleMovementMessage(4, state == 1));
} else if (key == options.keyShift.getKey().getValue()) {
ModUtils.PACKET_HANDLER.sendToServer(new VehicleMovementMessage(5, state == 1));
}
}
}
private static void handleVehicleMove(int key, int state, Player player) {

View file

@ -68,6 +68,7 @@ public class ModItemModelProvider extends ItemModelProvider {
simpleItem(ModItems.BEAM_TEST);
simpleItem(ModItems.HEAVY_AMMO);
simpleItem(ModItems.ROCKET_70);
simpleItem(ModItems.SMALL_SHELL);
simpleItem(ModItems.TUNGSTEN_ROD);
simpleItem(ModItems.IRON_BARREL);
@ -136,6 +137,7 @@ public class ModItemModelProvider extends ItemModelProvider {
cannonBlueprintItem(ModItems.MLE_1934_BLUEPRINT);
cannonBlueprintItem(ModItems.ANNIHILATOR_BLUEPRINT);
gunBlueprintItem(ModItems.M_2_HB_BLUEPRINT);
gunBlueprintItem(ModItems.SECONDARY_CATACLYSM_BLUEPRINT);
// blocks
evenSimplerBlockItem(ModBlocks.BARBED_WIRE);

View file

@ -66,7 +66,7 @@ public class SmallCannonShellEntity extends ThrowableItemProjectile implements G
@Override
protected Item getDefaultItem() {
return ModItems.GRENADE_40MM.get();
return ModItems.SMALL_SHELL.get();
}
@Override

View file

@ -226,7 +226,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
}
if (this.getEntityData().get(WEAPON_TYPE) == 0) {
this.entityData.set(AMMO, this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).mapToInt(ItemStack::getCount).sum());
this.entityData.set(AMMO, this.getItemStacks().stream().filter(stack -> stack.is(ModItems.SMALL_SHELL.get())).mapToInt(ItemStack::getCount).sum());
} else {
this.entityData.set(AMMO, this.getEntityData().get(LOADED_COAX_AMMO));
}
@ -356,7 +356,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
this.entityData.set(HEAT, this.entityData.get(HEAT) + 7);
this.entityData.set(FIRE_ANIM, 3);
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).findFirst().ifPresent(stack -> stack.shrink(1));
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.SMALL_SHELL.get())).findFirst().ifPresent(stack -> stack.shrink(1));
} else if (entityData.get(WEAPON_TYPE) == 1) {
if (this.cannotFireCoax) return;
@ -466,7 +466,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
}
this.entityData.set(POWER, this.entityData.get(POWER) * 0.97f);
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * (float)Math.max(0.7f - 0.1f * this.getDeltaMovement().horizontalDistance(), 0.3));
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * (float)Math.max(0.76f - 0.1f * this.getDeltaMovement().horizontalDistance(), 0.3));
float angle = (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1));
double s0;
@ -483,7 +483,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
this.setRudderRot(Mth.clamp(this.getRudderRot() - this.entityData.get(DELTA_ROT), -0.8f, 0.8f) * 0.75f);
if (this.isInWater() || onGround()) {
this.setYRot((float) (this.getYRot() - Math.max(10 * this.getDeltaMovement().horizontalDistance(), 0) * this.getRudderRot() * (this.entityData.get(POWER) > 0 ? 1 : -1)));
this.setYRot((float) (this.getYRot() - Math.max(12 * this.getDeltaMovement().horizontalDistance(), 0) * this.getRudderRot() * (this.entityData.get(POWER) > 0 ? 1 : -1)));
this.setDeltaMovement(this.getDeltaMovement().add(Mth.sin(-this.getYRot() * 0.017453292F) * (isInWater() && !onGround() ? 0.3f : 1) * this.entityData.get(POWER), 0.0, Mth.cos(this.getYRot() * 0.017453292F) * (isInWater() && !onGround() ? 0.3f : 1) * this.entityData.get(POWER)));
}
}

View file

@ -108,6 +108,7 @@ public class ModItems {
public static final RegistryObject<Item> CLAYMORE_MINE = AMMO.register("claymore_mine", ClaymoreMine::new);
public static final RegistryObject<Item> HEAVY_AMMO = AMMO.register("heavy_ammo", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> ROCKET_70 = AMMO.register("rocket_70", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> SMALL_SHELL = AMMO.register("small_shell", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> BEAM_TEST = AMMO.register("beam_test", BeamTest::new);
/**
@ -223,10 +224,11 @@ public class ModItems {
public static final RegistryObject<Item> K_98_BLUEPRINT = ITEMS.register("k_98_blueprint", () -> new BlueprintItem(Rarity.RARE));
public static final RegistryObject<Item> MOSIN_NAGANT_BLUEPRINT = ITEMS.register("mosin_nagant_blueprint", () -> new BlueprintItem(Rarity.RARE));
public static final RegistryObject<Item> JAVELIN_BLUEPRINT = ITEMS.register("javelin_blueprint", () -> new BlueprintItem(RarityTool.LEGENDARY));
public static final RegistryObject<Item> M_2_HB_BLUEPRINT = ITEMS.register("m2hb_blueprint", () -> new BlueprintItem(Rarity.RARE));
public static final RegistryObject<Item> SECONDARY_CATACLYSM_BLUEPRINT = ITEMS.register("secondary_cataclysm_blueprint", () -> new BlueprintItem(RarityTool.LEGENDARY));
public static final RegistryObject<Item> MK_42_BLUEPRINT = ITEMS.register("mk_42_blueprint", () -> new BlueprintItem(RarityTool.LEGENDARY));
public static final RegistryObject<Item> MLE_1934_BLUEPRINT = ITEMS.register("mle_1934_blueprint", () -> new BlueprintItem(RarityTool.LEGENDARY));
public static final RegistryObject<Item> ANNIHILATOR_BLUEPRINT = ITEMS.register("annihilator_blueprint", () -> new BlueprintItem(RarityTool.LEGENDARY));
public static final RegistryObject<Item> M_2_HB_BLUEPRINT = ITEMS.register("m2hb_blueprint", () -> new BlueprintItem(Rarity.RARE));
/**
* Block

View file

@ -59,6 +59,8 @@ public class ModVillagers {
new ItemStack(ModItems.SHOTGUN_AMMO.get(), 2), 16, 1, 0.05f));
trades.get(1).add(new BasicItemListing(new ItemStack(Items.EMERALD, 1),
new ItemStack(ModItems.HEAVY_AMMO.get(), 2), 32, 1, 0.05f));
trades.get(1).add(new BasicItemListing(new ItemStack(Items.EMERALD, 1),
new ItemStack(ModItems.SMALL_SHELL.get(), 1), 32, 1, 0.05f));
trades.get(1).add(new BasicItemListing(new ItemStack(ModItems.HANDGUN_AMMO.get(), 8),
new ItemStack(Items.EMERALD, 1), 32, 2, 0.05f));
@ -70,6 +72,8 @@ public class ModVillagers {
new ItemStack(Items.EMERALD, 1), 32, 2, 0.05f));
trades.get(1).add(new BasicItemListing(new ItemStack(ModItems.HEAVY_AMMO.get(), 4),
new ItemStack(Items.EMERALD, 1), 64, 2, 0.05f));
trades.get(1).add(new BasicItemListing(new ItemStack(ModItems.SMALL_SHELL.get(), 2),
new ItemStack(Items.EMERALD, 1), 64, 2, 0.05f));
// 等级 2 交易
trades.get(2).add(new BasicItemListing(new ItemStack(Items.EMERALD, 10),

View file

@ -2,8 +2,10 @@ package com.atsuishio.superbwarfare.network.message;
import com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.network.NetworkEvent;
import java.util.function.Supplier;
@ -34,6 +36,7 @@ public class VehicleMovementMessage {
Player player = context.getSender();
var vehicle = player.getVehicle();
ItemStack stack = player.getMainHandItem();
if (vehicle instanceof MobileVehicleEntity mobileVehicleEntity) {
switch (message.direction) {
case 0:
@ -58,16 +61,28 @@ public class VehicleMovementMessage {
mobileVehicleEntity.decoyInputDown = message.clicked;
break;
}
if (player.getMainHandItem().is(ModItems.MONITOR.get())) {
if (player.getMainHandItem().getOrCreateTag().getBoolean("Using") && player.getMainHandItem().getOrCreateTag().getBoolean("Linked")) {
mobileVehicleEntity.leftInputDown = false;
mobileVehicleEntity.rightInputDown = false;
mobileVehicleEntity.forwardInputDown = false;
mobileVehicleEntity.backInputDown = false;
mobileVehicleEntity.upInputDown = false;
mobileVehicleEntity.downInputDown = false;
mobileVehicleEntity.decoyInputDown = false;
} else if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
var drone = EntityFindUtil.findDrone(player.level(), stack.getOrCreateTag().getString("LinkedDrone"));
if (drone != null) {
switch (message.direction) {
case 0:
drone.leftInputDown = message.clicked;
break;
case 1:
drone.rightInputDown = message.clicked;
break;
case 2:
drone.forwardInputDown = message.clicked;
break;
case 3:
drone.backInputDown = message.clicked;
break;
case 4:
drone.upInputDown = message.clicked;
break;
case 5:
drone.downInputDown = message.clicked;
break;
}
}
}

View file

@ -155,6 +155,7 @@
"item.superbwarfare.heavy_ammo": "Heavy Ammo",
"item.superbwarfare.lunge_mine": "Lunge Mine",
"item.superbwarfare.rocket_70": "70mm Rocket",
"item.superbwarfare.small_shell": "Small Caliber Shells",
"block.superbwarfare.container": "Container",
"des.superbwarfare.container.empty": "空的",

View file

@ -155,6 +155,7 @@
"item.superbwarfare.heavy_ammo": "重型弹药",
"item.superbwarfare.lunge_mine": "突刺爆雷",
"item.superbwarfare.rocket_70": "70mm火箭弹",
"item.superbwarfare.small_shell": "小口径炮弹",
"block.superbwarfare.container": "集装箱",
"des.superbwarfare.container.empty": "空的",

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

View file

@ -270,6 +270,20 @@
}
]
},
{
"type": "minecraft:item",
"name": "superbwarfare:secondary_cataclysm_blueprint",
"weight": 15,
"functions": [
{
"function": "set_count",
"count": {
"min": 1,
"max": 1
}
}
]
},
{
"type": "minecraft:item",
"name": "superbwarfare:mk_42_blueprint",

View file

@ -424,6 +424,20 @@
}
]
},
{
"type": "minecraft:item",
"name": "superbwarfare:secondary_cataclysm_blueprint",
"weight": 5,
"functions": [
{
"function": "set_count",
"count": {
"min": 1,
"max": 1
}
}
]
},
{
"type": "minecraft:item",
"name": "superbwarfare:mk_42_blueprint",

View file

@ -0,0 +1,24 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"pattern": [
"aba",
"aca",
"aaa"
],
"key": {
"a": {
"item": "minecraft:diamond"
},
"b": {
"item": "superbwarfare:secondary_cataclysm_blueprint"
},
"c": {
"item": "minecraft:lapis_lazuli"
}
},
"result": {
"item": "superbwarfare:secondary_cataclysm_blueprint",
"count": 2
}
}

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:smithing_transform",
"template": {
"item": "superbwarfare:secondary_cataclysm_blueprint"
},
"base": {
"item": "superbwarfare:legendary_material_pack"
},
"addition": {
"item": "superbwarfare:knife"
},
"result": {
"item": "superbwarfare:secondary_cataclysm"
}
}

View file

@ -0,0 +1,30 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"pattern": [
"ea ",
"bcb",
" d "
],
"key": {
"a": {
"tag":"forge:ingots/steel"
},
"b": {
"tag": "forge:ingots/copper"
},
"c": {
"item": "minecraft:gunpowder"
},
"d": {
"item": "superbwarfare:primer"
},
"e": {
"item": "superbwarfare:high_energy_explosives"
}
},
"result": {
"item": "superbwarfare:small_shell",
"count": 4
}
}