调整1130配方,添加1130的能量系统
This commit is contained in:
parent
2ceef7636c
commit
2c320c25f4
4 changed files with 72 additions and 22 deletions
|
@ -108,9 +108,12 @@ public class VehicleConfig {
|
|||
public static ModConfigSpec.IntValue PRISM_TANK_SHOOT_COST_MODE_2;
|
||||
|
||||
public static ModConfigSpec.IntValue HPJ11_HP;
|
||||
public static ModConfigSpec.IntValue HPJ11_MAX_ENERGY;
|
||||
public static ModConfigSpec.DoubleValue HPJ11_DAMAGE;
|
||||
public static ModConfigSpec.DoubleValue HPJ11_EXPLOSION_DAMAGE;
|
||||
public static ModConfigSpec.DoubleValue HPJ11_EXPLOSION_RADIUS;
|
||||
public static ModConfigSpec.IntValue HPJ11_SHOOT_COST;
|
||||
public static ModConfigSpec.IntValue HPJ11_SEEK_COST;
|
||||
|
||||
public static void init(ModConfigSpec.Builder builder) {
|
||||
builder.push("vehicle");
|
||||
|
@ -427,6 +430,9 @@ public class VehicleConfig {
|
|||
builder.comment("The health of HPJ-11");
|
||||
HPJ11_HP = builder.defineInRange("hpj_11_hp", 350, 1, 10000000);
|
||||
|
||||
builder.comment("The max energy storage of HPJ-11");
|
||||
HPJ11_MAX_ENERGY = builder.defineInRange("hpj_11_max_energy", 5000000, 0, 2147483647);
|
||||
|
||||
builder.comment("The damage of HPJ-11");
|
||||
HPJ11_DAMAGE = builder.defineInRange("hpj_11_damage", 20d, 1, 10000000);
|
||||
|
||||
|
@ -436,6 +442,12 @@ public class VehicleConfig {
|
|||
builder.comment("The explosion radius of HPJ-11");
|
||||
HPJ11_EXPLOSION_RADIUS = builder.defineInRange("hpj_11_explosion_radius", 4d, 1, 50);
|
||||
|
||||
builder.comment("The energy cost of HPJ-11 per shoot");
|
||||
HPJ11_SHOOT_COST = builder.defineInRange("hpj_11_shoot_cost", 64, 0, 2147483647);
|
||||
|
||||
builder.comment("The energy cost of HPJ-11 find a new target");
|
||||
HPJ11_SEEK_COST = builder.defineInRange("hpj_11_seek_cost", 1024, 0, 2147483647);
|
||||
|
||||
builder.pop();
|
||||
|
||||
builder.pop();
|
||||
|
|
|
@ -256,6 +256,8 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.getEnergy() <= VehicleConfig.HPJ11_SEEK_COST.get()) return;
|
||||
|
||||
Matrix4f transform = getBarrelTransform(1);
|
||||
Vector4f worldPosition = transformPosition(transform, 0f, 0.4f, 0);
|
||||
Vec3 barrelRootPos = new Vec3(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||
|
@ -264,6 +266,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
Entity naerestEntity = seekNearLivingEntity(barrelRootPos, -32.5, 90, 3, 160, 0.3);
|
||||
if (naerestEntity != null) {
|
||||
entityData.set(TARGET_UUID, naerestEntity.getStringUUID());
|
||||
this.consumeEnergy(VehicleConfig.HPJ11_SEEK_COST.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -474,6 +477,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
@Override
|
||||
public void vehicleShoot(Player player, int type) {
|
||||
if (cannotFire) return;
|
||||
if (this.getEnergy() < VehicleConfig.HPJ11_SHOOT_COST.get()) return;
|
||||
|
||||
boolean hasCreativeAmmo = (getFirstPassenger() instanceof Player pPlayer && InventoryTool.hasCreativeAmmoBox(pPlayer)) || hasItem(ModItems.CREATIVE_AMMO_BOX.get());
|
||||
|
||||
|
@ -496,6 +500,8 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
this.entityData.set(HEAT, this.entityData.get(HEAT) + 2);
|
||||
this.entityData.set(ANIM_TIME, 1);
|
||||
|
||||
this.consumeEnergy(VehicleConfig.HPJ11_SHOOT_COST.get());
|
||||
|
||||
if (hasCreativeAmmo) return;
|
||||
|
||||
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.SMALL_SHELL.get())).findFirst().ifPresent(stack -> stack.shrink(1));
|
||||
|
@ -514,6 +520,8 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
|
||||
@Override
|
||||
public void travel() {
|
||||
if (this.getEnergy() <= 0) return;
|
||||
|
||||
Entity passenger = this.getFirstPassenger();
|
||||
if (passenger != null) {
|
||||
float diffY = Mth.wrapDegrees(passenger.getYHeadRot() - this.getYRot());
|
||||
|
@ -547,6 +555,11 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
return this.cache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergy() {
|
||||
return VehicleConfig.HPJ11_MAX_ENERGY.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxHealth() {
|
||||
return VehicleConfig.HPJ11_HP.get();
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "misc",
|
||||
"pattern": [
|
||||
"abc",
|
||||
"def",
|
||||
"ghg"
|
||||
],
|
||||
"key": {
|
||||
"a": {
|
||||
"item": "superbwarfare:hpj_11_blueprint"
|
||||
},
|
||||
"b": {
|
||||
"item": "minecraft:observer"
|
||||
},
|
||||
"c": {
|
||||
"item": "minecraft:comparator"
|
||||
},
|
||||
"d": {
|
||||
"tag": "superbwarfare:storage_blocks/steel"
|
||||
},
|
||||
"e": {
|
||||
"item": "superbwarfare:cannon_core"
|
||||
},
|
||||
"f": {
|
||||
"item": "superbwarfare:large_motor"
|
||||
},
|
||||
"g": {
|
||||
"item": "minecraft:iron_ingot"
|
||||
},
|
||||
"h": {
|
||||
"item": "superbwarfare:medium_battery_pack"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"id": "superbwarfare:container",
|
||||
"components": {
|
||||
"minecraft:block_entity_data": {
|
||||
"id": "superbwarfare:container",
|
||||
"EntityType": "superbwarfare:hpj_11"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"type": "minecraft:smithing_transform",
|
||||
"template": {
|
||||
"item": "superbwarfare:hpj_11_blueprint"
|
||||
},
|
||||
"base": {
|
||||
"item": "superbwarfare:cannon_core"
|
||||
},
|
||||
"addition": {
|
||||
"tag": "superbwarfare:storage_blocks/steel"
|
||||
},
|
||||
"result": {
|
||||
"id": "superbwarfare:container",
|
||||
"components": {
|
||||
"minecraft:block_entity_data": {
|
||||
"id": "superbwarfare:container",
|
||||
"EntityType": "superbwarfare:hpj_11"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue