From 9df34cfb1f12ea3cc3094b07448db61db02c5702 Mon Sep 17 00:00:00 2001 From: rbasamoyai Date: Sun, 29 Dec 2024 19:12:27 -0500 Subject: [PATCH] feature, bug: Added stored munition explosions for big cannon shells and big cannon propellant, many fixes - Affected blocks are launched, including inert projectiles - Propellant blocks can explode from fire, while projectiles must be exploded - Munitions can be blocked from exploding and/or catching fire by waterlogging - Waterlogged propellant will become damp - Damp propellant can be dried either by waiting (random tick) or placing the projectile in the Nether, similar to sponges - Damp propellant cannot be dried in furnaces - Damp propellant is indicated by an item tooltip as well as blocks emitting water particles - Damp behavior can be configured per propellant and toggled globally - Reverted breaking change in Wired Fuze commit by making ProjectileBlock#getProjectile methods not abstract - Update to BigCannonPropellantPropertiesComponent to account for propellant explosion power - Added documentation to MountedBigCannonsContraption#fireShot because my code is just confusing - Fixed pick-cloning Big Cartridge power value - Fixed Quick-Firing Breech smoke on assembled cannons not persisting - Fixed Quick-Firing Breech side lever not actually ejecting the contents - Fixed Quick-Firing Breech accepting input from the sides - Changed Powder Charge texture --- CHANGELOG.md | 17 +- Translators-Changes.md | 9 + .../blockstates/ap_shell.json | 38 +++- .../createbigcannons/blockstates/ap_shot.json | 38 +++- .../blockstates/bag_of_grapeshot.json | 38 +++- .../blockstates/big_cartridge.json | 76 +++++-- .../blockstates/drop_mortar_shell.json | 38 +++- .../blockstates/fluid_shell.json | 38 +++- .../blockstates/he_shell.json | 38 +++- .../blockstates/mortar_stone.json | 38 +++- .../blockstates/powder_charge.json | 19 +- .../blockstates/shrapnel_shell.json | 38 +++- .../blockstates/smoke_shell.json | 38 +++- .../blockstates/solid_shot.json | 38 +++- .../blockstates/traffic_cone.json | 38 +++- .../assets/createbigcannons/lang/en_ud.json | 9 + .../assets/createbigcannons/lang/en_us.json | 9 + .../loot_tables/blocks/big_cartridge.json | 51 +++++ .../loot_tables/blocks/powder_charge.json | 35 ++++ .../fabric/CBCBuilderTransformersImpl.java | 32 ++- .../fabric/CBCCommonFabricEvents.java | 6 + .../fabric/mixin/BigCartridgeBlockMixin.java | 44 ++++ .../fabric/mixin/ExplosionMixin.java | 26 +++ .../fabric/mixin/FireBlockMixin.java | 89 ++++++++ .../fabric/mixin/PowderChargeBlockMixin.java | 31 +++ .../CBCDynamicFlammableBlock.java | 12 ++ .../resources/createbigcannons.mixins.json | 4 + .../blockstates/ap_shell.json | 38 +++- .../createbigcannons/blockstates/ap_shot.json | 38 +++- .../blockstates/bag_of_grapeshot.json | 38 +++- .../blockstates/big_cartridge.json | 76 +++++-- .../blockstates/drop_mortar_shell.json | 38 +++- .../blockstates/fluid_shell.json | 38 +++- .../blockstates/he_shell.json | 38 +++- .../blockstates/mortar_stone.json | 38 +++- .../blockstates/powder_charge.json | 19 +- .../blockstates/shrapnel_shell.json | 38 +++- .../blockstates/smoke_shell.json | 38 +++- .../blockstates/solid_shot.json | 38 +++- .../blockstates/traffic_cone.json | 38 +++- .../assets/createbigcannons/lang/en_ud.json | 9 + .../assets/createbigcannons/lang/en_us.json | 9 + .../loot_tables/blocks/big_cartridge.json | 51 +++++ .../loot_tables/blocks/powder_charge.json | 35 ++++ .../forge/CBCBuilderTransformersImpl.java | 36 +++- .../forge/mixin/BigCartridgeBlockMixin.java | 42 ++++ .../forge/mixin/ExplosionMixin.java | 25 +++ .../forge/mixin/PowderChargeBlockMixin.java | 41 ++++ .../resources/createbigcannons.mixins.json | 3 + .../MountedBigCannonContraption.java | 24 ++- .../QuickfiringBreechBlock.java | 6 +- .../config/CBCCfgMunitions.java | 5 + .../datagen/assets/CBCLangGen.java | 1 + .../index/CBCEntityTypes.java | 11 + .../big_cannon/BigCannonMunitionBlock.java | 21 +- .../BigCannonProjectileRenderer.java | 1 + .../big_cannon/FuzedBigCannonProjectile.java | 12 +- .../big_cannon/FuzedProjectileBlock.java | 11 + .../munitions/big_cannon/ProjectileBlock.java | 53 ++++- .../big_cannon/grapeshot/GrapeshotBlock.java | 23 -- .../mortar_stone/MortarStoneBlock.java | 23 -- .../propellant/BigCartridgeBlock.java | 191 +++++++++++++++-- .../propellant/BigCartridgeBlockEntity.java | 5 +- .../propellant/BigCartridgeBlockItem.java | 6 + .../propellant/PowderChargeBlock.java | 197 +++++++++++++++++- .../propellant/PowderChargeItem.java | 13 +- .../propellant/PrimedPropellant.java | 116 +++++++++++ .../propellant/PrimedPropellantRenderer.java | 50 +++++ ...igCannonPropellantPropertiesComponent.java | 19 +- .../ponder/CBCPonderIndex.java | 8 +- .../ponder/CannonLoadingScenes.java | 81 +++++++ .../remix/CBCExplodableBlock.java | 12 ++ .../ponder/munitions/wet_ammo_storage.nbt | Bin 0 -> 323 bytes .../block_propellant/big_cartridge.json | 3 + .../block_propellant/powder_charge.json | 5 +- 75 files changed, 2269 insertions(+), 279 deletions(-) create mode 100644 fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/BigCartridgeBlockMixin.java create mode 100644 fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/ExplosionMixin.java create mode 100644 fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/FireBlockMixin.java create mode 100644 fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/PowderChargeBlockMixin.java create mode 100644 fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin_interface/CBCDynamicFlammableBlock.java create mode 100644 forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/BigCartridgeBlockMixin.java create mode 100644 forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/ExplosionMixin.java create mode 100644 forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/PowderChargeBlockMixin.java create mode 100644 src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/PrimedPropellant.java create mode 100644 src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/PrimedPropellantRenderer.java create mode 100644 src/main/java/rbasamoyai/createbigcannons/remix/CBCExplodableBlock.java create mode 100644 src/main/resources/assets/createbigcannons/ponder/munitions/wet_ammo_storage.nbt diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e33ea9c6..059b69f6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,18 @@ and freedom tastes of reality..."* \ - Only works with big cannon shells in base Create Big Cannons - On detonation, the detonation effect of the fuzed shell is spawned in world - Can be used for improvised explosives +- Added ability for big cannon shell blocks and propellant blocks to explode + - Propellant can catch fire and explode, shells cannot + - Explosion power can be configured per munition block + - Behavior can be toggled in server config +- Munitions can be blocked from exploding and/or catching fire by waterlogging +- Waterlogging propellant will make it damp + - Damp propellant that isn't waterlogged is vulnerable to ignition and explosion + - Damp propellant can be dried either by waiting (random tick) or placing the projectile in the Nether, similar to sponges + - Damp propellant cannot be dried in furnaces + - Damp propellant is indicated by an item tooltip as well as blocks emitting water particles + - Damp behavior can be configured per projectile + - Damp behavior can be toggled in server config ### Changed - Cannon Mount can now be turned around both axes without the Yaw Controller - Cannon Mount now disassembles on rotation with wrench @@ -33,12 +45,15 @@ and freedom tastes of reality..."* \ - Cannon Mounts can also be flipped by using the wrench - Changed Cannon Mount item model to be more consistent with in-world appearance - Reduced default Proximity Fuze arming delay to 5 gameticks -- [Addons, BREAKING] Added abstract method to get projectiles from in-world blocks ### Fixed - Fixed rendering of pitch shaft for down-facing cannons - Fixed display on some ponders - Fixed autocannon tracer lighting and non-tracer rendering - Fixed conductivity of certain cannon mount blocks +- Fixed pick-cloning Big Cartridge power value +- Fixed Quick-Firing Breech smoke on assembled cannons not persisting +- Fixed Quick-Firing Breech side lever not actually ejecting the contents +- Fixed Quick-Firing Breech accepting input from the sides ## [5.7.2] - 2024-12-18 diff --git a/Translators-Changes.md b/Translators-Changes.md index d68104078..699c90adc 100644 --- a/Translators-Changes.md +++ b/Translators-Changes.md @@ -10,6 +10,7 @@ Note: Changes to en_us.json before Create Big Cannons 0.5.3.b => 0.5.4 will not Additions: \ + `"block.createbigcannons.cannon_mount_extension": "Cannon Mount Extension"` \ + `"block.createbigcannons.fixed_cannon_mount": "Fixed Cannon Mount"` \ ++ `"block.createbigcannons.propellant.tooltip.damp": "Damp"` \ + `"createbigcannons.fixed_cannon_mount.angle_pitch": "Pitch Adjustment"` \ + `"createbigcannons.fixed_cannon_mount.angle_yaw": "Yaw Adjustment"` \ + `"createbigcannons.ponder.cannon_mount/upside_down_cannon_mounts.header": "Placing Cannon Mounts upside down"` \ @@ -26,6 +27,14 @@ Additions: \ + `"createbigcannons.ponder.cannon_mount/using_fixed_cannon_mounts.text_5": "Fire cannon"` \ + `"createbigcannons.ponder.cannon_mount/using_fixed_cannon_mounts.text_6": "The Fixed Cannon Mount cannot be extended."` \ + `"createbigcannons.ponder.cannon_mount/using_fixed_cannon_mounts.text_7": "Use a wrench to rotate the Fixed Cannon Mount."` \ ++ `"createbigcannons.ponder.munitions/wet_ammo_storage.header": "Protecting Munitions with Waterlogging, and its Side Effects"` \ ++ `"createbigcannons.ponder.munitions/wet_ammo_storage.text_1": "Propellant blocks, as well as projectiles, are vulnerable to exploding from fire and other explosions."` \ ++ `"createbigcannons.ponder.munitions/wet_ammo_storage.text_2": "Munition blocks can be protected from fire and explosions by waterlogging them."` \ ++ `"createbigcannons.ponder.munitions/wet_ammo_storage.text_3": "However, waterlogging causes propellant blocks to become damp."` \ ++ `"createbigcannons.ponder.munitions/wet_ammo_storage.text_4": "Damp propellant is weaker and also fails to ignite if it is placed as the first propellant block in a big cannon."` \ ++ `"createbigcannons.ponder.munitions/wet_ammo_storage.text_5": "To fix this, damp propellant must be left to dry, and cannot be dried in a furnace like wet sponges."` \ ++ `"createbigcannons.ponder.munitions/wet_ammo_storage.text_6": "However, propellant placed in hot places like the Nether will instantly dry, similar to wet sponges."` \ ++ `"entity.createbigcannons.primed_propellant": "Primed Propellant"` \ + `"item.createbigcannons.wired_fuze": "Wired Fuze"` \ + `"item.createbigcannons.wired_fuze.tooltip": "WIRED FUZE"` \ + `"item.createbigcannons.wired_fuze.tooltip.behaviour1": "The fuze detonates when powered by redstone."` \ diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/ap_shell.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/ap_shell.json index 5d1e97e33..e18702340 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/ap_shell.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/ap_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/ap_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/ap_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/ap_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/ap_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/ap_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/ap_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/ap_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/ap_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/ap_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/ap_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/ap_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/ap_shell", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/ap_shot.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/ap_shot.json index 8d8b7682f..f1dc60ffd 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/ap_shot.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/ap_shot.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/ap_shot", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/ap_shot", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/ap_shot", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/ap_shot", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/ap_shot", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/ap_shot", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/ap_shot", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/ap_shot", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/ap_shot" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/ap_shot" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/ap_shot", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/ap_shot", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/bag_of_grapeshot.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/bag_of_grapeshot.json index 653e4844a..0b38cb707 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/bag_of_grapeshot.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/bag_of_grapeshot.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/bag_of_grapeshot", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/bag_of_grapeshot", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/bag_of_grapeshot", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/bag_of_grapeshot", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/bag_of_grapeshot", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/bag_of_grapeshot", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/bag_of_grapeshot", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/bag_of_grapeshot", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/bag_of_grapeshot" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/bag_of_grapeshot" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/bag_of_grapeshot", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/bag_of_grapeshot", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/big_cartridge.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/big_cartridge.json index 516dca7bf..72287e4a6 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/big_cartridge.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/big_cartridge.json @@ -1,53 +1,105 @@ { "variants": { - "facing=down,filled=false": { + "damp=false,facing=down,filled=false": { "model": "createbigcannons:block/big_cartridge_empty", "x": 180 }, - "facing=down,filled=true": { + "damp=false,facing=down,filled=true": { "model": "createbigcannons:block/big_cartridge_filled", "x": 180 }, - "facing=east,filled=false": { + "damp=false,facing=east,filled=false": { "model": "createbigcannons:block/big_cartridge_empty", "x": 90, "y": 90 }, - "facing=east,filled=true": { + "damp=false,facing=east,filled=true": { "model": "createbigcannons:block/big_cartridge_filled", "x": 90, "y": 90 }, - "facing=north,filled=false": { + "damp=false,facing=north,filled=false": { "model": "createbigcannons:block/big_cartridge_empty", "x": 90 }, - "facing=north,filled=true": { + "damp=false,facing=north,filled=true": { "model": "createbigcannons:block/big_cartridge_filled", "x": 90 }, - "facing=south,filled=false": { + "damp=false,facing=south,filled=false": { "model": "createbigcannons:block/big_cartridge_empty", "x": 90, "y": 180 }, - "facing=south,filled=true": { + "damp=false,facing=south,filled=true": { "model": "createbigcannons:block/big_cartridge_filled", "x": 90, "y": 180 }, - "facing=up,filled=false": { + "damp=false,facing=up,filled=false": { "model": "createbigcannons:block/big_cartridge_empty" }, - "facing=up,filled=true": { + "damp=false,facing=up,filled=true": { "model": "createbigcannons:block/big_cartridge_filled" }, - "facing=west,filled=false": { + "damp=false,facing=west,filled=false": { "model": "createbigcannons:block/big_cartridge_empty", "x": 90, "y": 270 }, - "facing=west,filled=true": { + "damp=false,facing=west,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled", + "x": 90, + "y": 270 + }, + "damp=true,facing=down,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty", + "x": 180 + }, + "damp=true,facing=down,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled", + "x": 180 + }, + "damp=true,facing=east,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty", + "x": 90, + "y": 90 + }, + "damp=true,facing=east,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled", + "x": 90, + "y": 90 + }, + "damp=true,facing=north,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty", + "x": 90 + }, + "damp=true,facing=north,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled", + "x": 90 + }, + "damp=true,facing=south,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty", + "x": 90, + "y": 180 + }, + "damp=true,facing=south,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled", + "x": 90, + "y": 180 + }, + "damp=true,facing=up,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty" + }, + "damp=true,facing=up,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled" + }, + "damp=true,facing=west,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty", + "x": 90, + "y": 270 + }, + "damp=true,facing=west,filled=true": { "model": "createbigcannons:block/big_cartridge_filled", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/drop_mortar_shell.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/drop_mortar_shell.json index 068fbe95b..87ccf6bff 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/drop_mortar_shell.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/drop_mortar_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/drop_mortar_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/drop_mortar_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/drop_mortar_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/drop_mortar_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/drop_mortar_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/drop_mortar_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/drop_mortar_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/drop_mortar_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/drop_mortar_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/drop_mortar_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/drop_mortar_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/drop_mortar_shell", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/fluid_shell.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/fluid_shell.json index 703b534a7..7d3dcbc1c 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/fluid_shell.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/fluid_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/fluid_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/fluid_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/fluid_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/fluid_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/fluid_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/fluid_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/fluid_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/fluid_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/fluid_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/fluid_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/fluid_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/fluid_shell", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/he_shell.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/he_shell.json index ef4e214d5..d47b015f0 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/he_shell.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/he_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/he_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/he_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/he_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/he_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/he_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/he_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/he_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/he_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/he_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/he_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/he_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/he_shell", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/mortar_stone.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/mortar_stone.json index 637619bef..ffd31d57e 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/mortar_stone.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/mortar_stone.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/mortar_stone", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/mortar_stone", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/mortar_stone", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/mortar_stone", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/mortar_stone", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/mortar_stone", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/mortar_stone", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/mortar_stone", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/mortar_stone" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/mortar_stone" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/mortar_stone", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/mortar_stone", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/powder_charge.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/powder_charge.json index 2a8a88913..140e429d6 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/powder_charge.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/powder_charge.json @@ -1,14 +1,27 @@ { "variants": { - "axis=x": { + "axis=x,damp=false": { "model": "createbigcannons:block/powder_charge", "x": 90, "y": 90 }, - "axis=y": { + "axis=x,damp=true": { + "model": "createbigcannons:block/powder_charge", + "x": 90, + "y": 90 + }, + "axis=y,damp=false": { + "model": "createbigcannons:block/powder_charge" + }, + "axis=y,damp=true": { "model": "createbigcannons:block/powder_charge" }, - "axis=z": { + "axis=z,damp=false": { + "model": "createbigcannons:block/powder_charge", + "x": 90, + "y": 180 + }, + "axis=z,damp=true": { "model": "createbigcannons:block/powder_charge", "x": 90, "y": 180 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/shrapnel_shell.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/shrapnel_shell.json index 7cb5b93eb..72d4a5569 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/shrapnel_shell.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/shrapnel_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/shrapnel_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/shrapnel_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/shrapnel_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/shrapnel_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/shrapnel_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/shrapnel_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/shrapnel_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/shrapnel_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/shrapnel_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/shrapnel_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/shrapnel_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/shrapnel_shell", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/smoke_shell.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/smoke_shell.json index bb1bf73ac..03b360870 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/smoke_shell.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/smoke_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/smoke_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/smoke_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/smoke_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/smoke_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/smoke_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/smoke_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/smoke_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/smoke_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/smoke_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/smoke_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/smoke_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/smoke_shell", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/solid_shot.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/solid_shot.json index bf89b197d..5d530a0ca 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/solid_shot.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/solid_shot.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/solid_shot", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/solid_shot", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/solid_shot", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/solid_shot", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/solid_shot", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/solid_shot", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/solid_shot", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/solid_shot", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/solid_shot" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/solid_shot" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/solid_shot", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/solid_shot", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/blockstates/traffic_cone.json b/fabric/src/generated/resources/assets/createbigcannons/blockstates/traffic_cone.json index 60a016826..3eee9869a 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/blockstates/traffic_cone.json +++ b/fabric/src/generated/resources/assets/createbigcannons/blockstates/traffic_cone.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/traffic_cone", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/traffic_cone", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/traffic_cone", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/traffic_cone", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/traffic_cone", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/traffic_cone", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/traffic_cone", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/traffic_cone", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/traffic_cone" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/traffic_cone" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/traffic_cone", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/traffic_cone", "x": 90, "y": 270 diff --git a/fabric/src/generated/resources/assets/createbigcannons/lang/en_ud.json b/fabric/src/generated/resources/assets/createbigcannons/lang/en_ud.json index 74171daeb..d1cf6930e 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/lang/en_ud.json +++ b/fabric/src/generated/resources/assets/createbigcannons/lang/en_ud.json @@ -149,6 +149,7 @@ "block.createbigcannons.propellant.tooltip.added_muzzle_velocity.value": "s/ɯ ‾%s‾", "block.createbigcannons.propellant.tooltip.added_stress": "ssǝɹʇS pǝppⱯ", "block.createbigcannons.propellant.tooltip.added_stress.value": "‾%s‾", + "block.createbigcannons.propellant.tooltip.damp": "dɯɐᗡ", "block.createbigcannons.propellant.tooltip.power": "ɹǝʍoԀ", "block.createbigcannons.propellant.tooltip.power.value": "‾%s‾ / ‾%s‾", "block.createbigcannons.ram_head": "pɐǝH ɯɐᴚ", @@ -432,6 +433,13 @@ "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_4": "˙ɹǝuıɐʇuoɔ ɹǝɥʇouɐ ɥʇıʍ ɥɔǝǝɹq ǝɥʇ buıʞɔıןɔ-ʇɥbıɹ ʎq ɹǝuıɐʇuoɔ ǝɥʇ ʇno dɐʍs osןɐ uɐɔ noʎ", "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_5": "˙ɹǝuıɐʇuoɔ ɐ ɥʇıʍ uouuɐɔoʇnɐ pǝןqɯǝssɐ uɐ pɐoן osןɐ uɐɔ noʎ", "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_6": "˙ʇı buıʞɔıןɔ-ʇɥbıɹ ʇɟıɥs ɹo buıddɐʍs ʎq ɹo 'ʎʇdɯǝ sı ʇı ɟı uouuɐɔoʇnɐ pǝןqɯǝssɐ uɐ uo ɹǝuıɐʇuoɔ ʇuǝsǝɹd ɐ ǝʌoɯǝɹ ʎןuo uɐɔ noʎ 'ɹǝʌǝʍoH", + "createbigcannons.ponder.munitions/wet_ammo_storage.header": "sʇɔǝɟɟƎ ǝpıS sʇı puɐ 'buıbboןɹǝʇɐM ɥʇıʍ suoıʇıunW buıʇɔǝʇoɹԀ", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_1": "˙suoısoןdxǝ ɹǝɥʇo puɐ ǝɹıɟ ɯoɹɟ buıpoןdxǝ oʇ ǝןqɐɹǝuןnʌ ǝɹɐ 'sǝןıʇɔǝظoɹd sɐ ןןǝʍ sɐ 'sʞɔoןq ʇuɐןןǝdoɹԀ", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_2": "˙ɯǝɥʇ buıbboןɹǝʇɐʍ ʎq suoısoןdxǝ puɐ ǝɹıɟ ɯoɹɟ pǝʇɔǝʇoɹd ǝq uɐɔ sʞɔoןq uoıʇıunW", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_3": "˙dɯɐp ǝɯoɔǝq oʇ sʞɔoןq ʇuɐןןǝdoɹd sǝsnɐɔ buıbboןɹǝʇɐʍ 'ɹǝʌǝʍoH", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_4": "˙uouuɐɔ bıq ɐ uı ʞɔoןq ʇuɐןןǝdoɹd ʇsɹıɟ ǝɥʇ sɐ pǝɔɐןd sı ʇı ɟı ǝʇıubı oʇ sןıɐɟ osןɐ puɐ ɹǝʞɐǝʍ sı ʇuɐןןǝdoɹd dɯɐᗡ", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_5": "˙sǝbuods ʇǝʍ ǝʞıן ǝɔɐuɹnɟ ɐ uı pǝıɹp ǝq ʇouuɐɔ puɐ 'ʎɹp oʇ ʇɟǝן ǝq ʇsnɯ ʇuɐןןǝdoɹd dɯɐp 'sıɥʇ xıɟ o⟘", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_6": "˙sǝbuods ʇǝʍ oʇ ɹɐןıɯıs 'ʎɹp ʎןʇuɐʇsuı ןןıʍ ɹǝɥʇǝN ǝɥʇ ǝʞıן sǝɔɐןd ʇoɥ uı pǝɔɐןd ʇuɐןןǝdoɹd 'ɹǝʌǝʍoH", "createbigcannons.ponder.tag.cannon_crafting": "buıʇɟɐɹƆ uouuɐƆ", "createbigcannons.ponder.tag.cannon_crafting.description": "sɹǝqıןɐɔ puɐ sǝzıs ʇuǝɹǝɟɟıp ɟo suouuɐɔ ǝɹnʇɔɐɟnuɐɯ oʇ ʍoH", "createbigcannons.ponder.tag.munitions": "suoıʇıunW", @@ -488,6 +496,7 @@ "entity.createbigcannons.machine_gun_bullet": "ʇǝןןnᗺ un⅁ ǝuıɥɔɐW", "entity.createbigcannons.mortar_stone": "ǝuoʇS ɹɐʇɹoW", "entity.createbigcannons.pitch_contraption": "uoıʇdɐɹʇuoƆ ɥɔʇıԀ", + "entity.createbigcannons.primed_propellant": "ʇuɐןןǝdoɹԀ pǝɯıɹԀ", "entity.createbigcannons.shot": "ʇoɥS", "entity.createbigcannons.shrapnel_burst": "ʇsɹnᗺ ןǝudɐɹɥS", "entity.createbigcannons.shrapnel_shell": "ןןǝɥS ןǝudɐɹɥS", diff --git a/fabric/src/generated/resources/assets/createbigcannons/lang/en_us.json b/fabric/src/generated/resources/assets/createbigcannons/lang/en_us.json index 8d5d5b73c..cf99106d2 100644 --- a/fabric/src/generated/resources/assets/createbigcannons/lang/en_us.json +++ b/fabric/src/generated/resources/assets/createbigcannons/lang/en_us.json @@ -149,6 +149,7 @@ "block.createbigcannons.propellant.tooltip.added_muzzle_velocity.value": "_%s_ m/s", "block.createbigcannons.propellant.tooltip.added_stress": "Added Stress", "block.createbigcannons.propellant.tooltip.added_stress.value": "_%s_", + "block.createbigcannons.propellant.tooltip.damp": "Damp", "block.createbigcannons.propellant.tooltip.power": "Power", "block.createbigcannons.propellant.tooltip.power.value": "_%s_ / _%s_", "block.createbigcannons.ram_head": "Ram Head", @@ -432,6 +433,13 @@ "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_4": "You can also swap out the container by right-clicking the breech with another container.", "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_5": "You can also load an assembled autocannon with a container.", "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_6": "However, you can only remove a present container on an assembled autocannon if it is empty, or by swapping or shift right-clicking it.", + "createbigcannons.ponder.munitions/wet_ammo_storage.header": "Protecting Munitions with Waterlogging, and its Side Effects", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_1": "Propellant blocks, as well as projectiles, are vulnerable to exploding from fire and other explosions.", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_2": "Munition blocks can be protected from fire and explosions by waterlogging them.", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_3": "However, waterlogging causes propellant blocks to become damp.", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_4": "Damp propellant is weaker and also fails to ignite if it is placed as the first propellant block in a big cannon.", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_5": "To fix this, damp propellant must be left to dry, and cannot be dried in a furnace like wet sponges.", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_6": "However, propellant placed in hot places like the Nether will instantly dry, similar to wet sponges.", "createbigcannons.ponder.tag.cannon_crafting": "Cannon Crafting", "createbigcannons.ponder.tag.cannon_crafting.description": "How to manufacture cannons of different sizes and calibers", "createbigcannons.ponder.tag.munitions": "Munitions", @@ -488,6 +496,7 @@ "entity.createbigcannons.machine_gun_bullet": "Machine Gun Bullet", "entity.createbigcannons.mortar_stone": "Mortar Stone", "entity.createbigcannons.pitch_contraption": "Pitch Contraption", + "entity.createbigcannons.primed_propellant": "Primed Propellant", "entity.createbigcannons.shot": "Shot", "entity.createbigcannons.shrapnel_burst": "Shrapnel Burst", "entity.createbigcannons.shrapnel_shell": "Shrapnel Shell", diff --git a/fabric/src/generated/resources/data/createbigcannons/loot_tables/blocks/big_cartridge.json b/fabric/src/generated/resources/data/createbigcannons/loot_tables/blocks/big_cartridge.json index cbaac0161..51644a782 100644 --- a/fabric/src/generated/resources/data/createbigcannons/loot_tables/blocks/big_cartridge.json +++ b/fabric/src/generated/resources/data/createbigcannons/loot_tables/blocks/big_cartridge.json @@ -6,6 +6,57 @@ "conditions": [ { "condition": "minecraft:survives_explosion" + }, + { + "block": "createbigcannons:big_cartridge", + "condition": "minecraft:block_state_property", + "properties": { + "damp": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "createbigcannons:big_cartridge" + } + ], + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:copy_nbt", + "ops": [ + { + "op": "replace", + "source": "Power", + "target": "Power" + } + ], + "source": "block_entity" + }, + { + "function": "minecraft:set_nbt", + "tag": "{Damp:1b}" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "block": "createbigcannons:big_cartridge", + "condition": "minecraft:block_state_property", + "properties": { + "damp": "false" + } } ], "entries": [ diff --git a/fabric/src/generated/resources/data/createbigcannons/loot_tables/blocks/powder_charge.json b/fabric/src/generated/resources/data/createbigcannons/loot_tables/blocks/powder_charge.json index cb0c3876c..832ab1952 100644 --- a/fabric/src/generated/resources/data/createbigcannons/loot_tables/blocks/powder_charge.json +++ b/fabric/src/generated/resources/data/createbigcannons/loot_tables/blocks/powder_charge.json @@ -6,6 +6,41 @@ "conditions": [ { "condition": "minecraft:survives_explosion" + }, + { + "block": "createbigcannons:powder_charge", + "condition": "minecraft:block_state_property", + "properties": { + "damp": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "createbigcannons:powder_charge" + } + ], + "functions": [ + { + "function": "minecraft:set_nbt", + "tag": "{Damp:1b}" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "block": "createbigcannons:powder_charge", + "condition": "minecraft:block_state_property", + "properties": { + "damp": "false" + } } ], "entries": [ diff --git a/fabric/src/main/java/rbasamoyai/createbigcannons/datagen/assets/fabric/CBCBuilderTransformersImpl.java b/fabric/src/main/java/rbasamoyai/createbigcannons/datagen/assets/fabric/CBCBuilderTransformersImpl.java index a31293c91..4450a536b 100644 --- a/fabric/src/main/java/rbasamoyai/createbigcannons/datagen/assets/fabric/CBCBuilderTransformersImpl.java +++ b/fabric/src/main/java/rbasamoyai/createbigcannons/datagen/assets/fabric/CBCBuilderTransformersImpl.java @@ -17,6 +17,7 @@ import net.minecraft.advancements.critereon.StatePropertiesPredicate; import net.minecraft.client.renderer.RenderType; import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.world.item.Item; @@ -32,6 +33,7 @@ import net.minecraft.world.level.storage.loot.functions.CopyNameFunction; import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction; import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction; +import net.minecraft.world.level.storage.loot.functions.SetNbtFunction; import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition; import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; @@ -58,6 +60,7 @@ import rbasamoyai.createbigcannons.index.CBCItems; import rbasamoyai.createbigcannons.munitions.autocannon.ammo_container.AutocannonAmmoContainerBlock; import rbasamoyai.createbigcannons.munitions.autocannon.ammo_container.AutocannonAmmoContainerItem; +import rbasamoyai.createbigcannons.munitions.big_cannon.BigCannonMunitionBlock; import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.BigCannonPropellantBlock; import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.BigCartridgeBlock; import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.BigCartridgeBlockItem; @@ -473,7 +476,21 @@ public static NonNullUnaryOperator> powd ResourceLocation baseLoc = CreateBigCannons.resource("block/powder_charge"); return b -> b.properties(p -> p.noOcclusion()) .addLayer(() -> RenderType::solid) - .blockstate((c, p) -> BlockStateGen.axisBlock(c, p, $ -> p.models().getExistingFile(baseLoc))); + .blockstate((c, p) -> BlockStateGen.axisBlock(c, p, $ -> p.models().getExistingFile(baseLoc))) + .loot((t, c) -> { + CompoundTag dampTag = new CompoundTag(); + dampTag.putBoolean("Damp", true); + t.add(c, LootTable.lootTable() + .withPool(t.applyExplosionCondition(c, LootPool.lootPool()) + .add(LootItem.lootTableItem(c)) + .apply(SetNbtFunction.setTag(dampTag)) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(c) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BigCannonMunitionBlock.DAMP, true)))) + .withPool(t.applyExplosionCondition(c, LootPool.lootPool()) + .add(LootItem.lootTableItem(c)) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(c) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BigCannonMunitionBlock.DAMP, false))))); + }); } public static NonNullUnaryOperator> bigCartridge() { @@ -486,11 +503,22 @@ public static NonNul })) .tag(AllTags.AllBlockTags.SAFE_NBT.tag) .loot((t, c) -> { + CompoundTag dampTag = new CompoundTag(); + dampTag.putBoolean("Damp", true); t.add(c, LootTable.lootTable() .withPool(t.applyExplosionCondition(c, LootPool.lootPool() .add(LootItem.lootTableItem(c)) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1))) - .apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("Power", "Power"))))); + .apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("Power", "Power"))) + .apply(SetNbtFunction.setTag(dampTag)) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(c) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BigCannonMunitionBlock.DAMP, true)))) + .withPool(t.applyExplosionCondition(c, LootPool.lootPool() + .add(LootItem.lootTableItem(c)) + .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1))) + .apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("Power", "Power"))) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(c) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BigCannonMunitionBlock.DAMP, false))))); }) .item(BigCartridgeBlockItem::new) .tag(CBCTags.CBCItemTags.BIG_CANNON_CARTRIDGES) diff --git a/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/CBCCommonFabricEvents.java b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/CBCCommonFabricEvents.java index 5c9695975..ce06d54fb 100644 --- a/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/CBCCommonFabricEvents.java +++ b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/CBCCommonFabricEvents.java @@ -16,6 +16,7 @@ import net.fabricmc.fabric.api.event.player.UseBlockCallback; import net.fabricmc.fabric.api.networking.v1.PacketSender; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; +import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener; import net.fabricmc.fabric.api.resource.ResourceManagerHelper; import net.minecraft.core.BlockPos; @@ -43,6 +44,7 @@ import rbasamoyai.createbigcannons.compat.create.DefaultCreateCompat; import rbasamoyai.createbigcannons.compat.trinkets.CBCTrinketsIntegration; import rbasamoyai.createbigcannons.equipment.gas_mask.GasMaskItem; +import rbasamoyai.createbigcannons.index.CBCBlocks; public class CBCCommonFabricEvents { @@ -59,6 +61,10 @@ public static void register() { ModsLoadedCallback.EVENT.register(CBCCommonFabricEvents::onModsLoaded); CBCCommonEvents.onAddReloadListeners(CBCCommonFabricEvents::wrapAndRegisterReloadListener); + + FlammableBlockRegistry FLAMMABLE_REGISTRY = FlammableBlockRegistry.getDefaultInstance(); + FLAMMABLE_REGISTRY.add(CBCBlocks.POWDER_CHARGE.get(), 100, 30); + //FLAMMABLE_REGISTRY.add(CBCBlocks.BIG_CARTRIDGE.get(), 100, 8); TODO: if flammable block registry or some other thing for dynamic spread... } public static void onModsLoaded(EnvType type) { diff --git a/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/BigCartridgeBlockMixin.java b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/BigCartridgeBlockMixin.java new file mode 100644 index 000000000..e7478a451 --- /dev/null +++ b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/BigCartridgeBlockMixin.java @@ -0,0 +1,44 @@ +package rbasamoyai.createbigcannons.fabric.mixin; + +import javax.annotation.Nullable; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import io.github.fabricators_of_create.porting_lib.block.CaughtFireBlock; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.DirectionalBlock; +import net.minecraft.world.level.block.state.BlockState; +import rbasamoyai.createbigcannons.fabric.mixin_interface.CBCDynamicFlammableBlock; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.BigCartridgeBlock; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.BigCartridgeBlockEntity; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.PrimedPropellant; + +@Mixin(BigCartridgeBlock.class) +public abstract class BigCartridgeBlockMixin extends DirectionalBlock implements CaughtFireBlock, CBCDynamicFlammableBlock { + + BigCartridgeBlockMixin(Properties properties) { super(properties); } + + @Shadow public abstract PrimedPropellant spawnPrimedPropellant(Level level, BlockPos pos, BlockState state); + + @Override + public void onCaughtFire(BlockState state, Level level, BlockPos pos, @Nullable Direction direction, @Nullable LivingEntity igniter) { + this.spawnPrimedPropellant(level, pos, state); + level.removeBlock(pos, false); + } + + @Override + public int getFlammability(BlockState state, BlockGetter level, BlockPos pos) { + return level.getBlockEntity(pos) instanceof BigCartridgeBlockEntity cartridge && cartridge.getPower() > 0 ? 30 : 0; + } + + @Override + public int getFireSpreadSpeed(BlockState state, BlockGetter level, BlockPos pos) { + return level.getBlockEntity(pos) instanceof BigCartridgeBlockEntity cartridge && cartridge.getPower() > 0 ? 8 : 0; + } + +} diff --git a/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/ExplosionMixin.java b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/ExplosionMixin.java new file mode 100644 index 000000000..41e5e2ffc --- /dev/null +++ b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/ExplosionMixin.java @@ -0,0 +1,26 @@ +package rbasamoyai.createbigcannons.fabric.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; +import rbasamoyai.createbigcannons.remix.CBCExplodableBlock; + +@Mixin(Explosion.class) +public class ExplosionMixin { + + @WrapOperation(method = "finalizeExplosion", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;I)Z")) + private boolean createbigcannons$finalizeExplosion(Level level, BlockPos pos, BlockState newState, int flags, Operation original) { + BlockState oldState = level.getBlockState(pos); + if (oldState.getBlock() instanceof CBCExplodableBlock cbcExplodable) + cbcExplodable.createbigcannons$onBlockExplode(level, pos, oldState, (Explosion) (Object) this); + return original.call(level, pos, newState, flags); + } + +} diff --git a/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/FireBlockMixin.java b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/FireBlockMixin.java new file mode 100644 index 000000000..0e3dafc84 --- /dev/null +++ b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/FireBlockMixin.java @@ -0,0 +1,89 @@ +package rbasamoyai.createbigcannons.fabric.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.llamalad7.mixinextras.sugar.Local; + +import io.github.fabricators_of_create.porting_lib.block.CaughtFireBlock; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.FireBlock; +import net.minecraft.world.level.block.state.BlockState; +import rbasamoyai.createbigcannons.fabric.mixin_interface.CBCDynamicFlammableBlock; + +/** + * TODO: remove once fixed in Porting Lib + */ +@Mixin(FireBlock.class) +public class FireBlockMixin { + + @ModifyExpressionValue(method = "checkBurnOut", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getBlockState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;", ordinal = 1)) + private BlockState createbigcannons$checkBurnOut$catchFire(BlockState original, @Local(argsOnly = true) Level level, + @Local(argsOnly = true) BlockPos pos) { + if (original.getBlock() instanceof CaughtFireBlock caughtFire) + caughtFire.onCaughtFire(original, level, pos, null, null); + return original; + } + + @WrapOperation(method = "checkBurnOut", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/FireBlock;getBurnOdds(Lnet/minecraft/world/level/block/state/BlockState;)I")) + private int createbigcannons$checkBurnOut$getBurnOdds(FireBlock instance, BlockState state, Operation original, + @Local(argsOnly = true) Level level, @Local(argsOnly = true) BlockPos pos) { + if (state.getBlock() instanceof CBCDynamicFlammableBlock cbcFlammable) + return cbcFlammable.getFlammability(state, level, pos); + return original.call(instance, state); + } + + @WrapOperation(method = "getIgniteOdds(Lnet/minecraft/world/level/LevelReader;Lnet/minecraft/core/BlockPos;)I", + at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/FireBlock;getIgniteOdds(Lnet/minecraft/world/level/block/state/BlockState;)I")) + private int createbigcannons$getIgniteOdds(FireBlock instance, BlockState state, Operation original, + @Local(argsOnly = true) LevelReader level, @Local(argsOnly = true) BlockPos pos) { + if (state.getBlock() instanceof CBCDynamicFlammableBlock cbcFlammable) + return cbcFlammable.getFireSpreadSpeed(state, level, pos); + return original.call(instance, state); + } + + @WrapOperation(method = "getStateForPlacement(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;", + at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/FireBlock;canBurn(Lnet/minecraft/world/level/block/state/BlockState;)Z", ordinal = 0)) + private boolean createbigcannons$getStateForPlacement$0(FireBlock instance, BlockState state, Operation original, + @Local(argsOnly = true) BlockGetter level, @Local(ordinal = 1) BlockPos pos) { + if (state.getBlock() instanceof CBCDynamicFlammableBlock cbcFlammable) + return cbcFlammable.getFireSpreadSpeed(state, level, pos) > 0; + return original.call(instance, state); + } + + @WrapOperation(method = "getStateForPlacement(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;", + at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/FireBlock;canBurn(Lnet/minecraft/world/level/block/state/BlockState;)Z", ordinal = 1)) + private boolean createbigcannons$getStateForPlacement$1(FireBlock instance, BlockState state, Operation original, + @Local(argsOnly = true) BlockGetter level, @Local(ordinal = 1) BlockPos pos, + @Local Direction dir) { + if (state.getBlock() instanceof CBCDynamicFlammableBlock cbcFlammable) + return cbcFlammable.getFireSpreadSpeed(state, level, pos.relative(dir)) > 0; + return original.call(instance, state); + } + + @WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/FireBlock;canBurn(Lnet/minecraft/world/level/block/state/BlockState;)Z")) + private boolean createbigcannons$tick(FireBlock instance, BlockState state, Operation original, + @Local(argsOnly = true) ServerLevel level, @Local(argsOnly = true) BlockPos pos) { + if (state.getBlock() instanceof CBCDynamicFlammableBlock cbcFlammable) + return cbcFlammable.getFireSpreadSpeed(state, level, pos.below()) > 0; + return original.call(instance, state); + } + + @WrapOperation(method = "isValidFireLocation", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/FireBlock;canBurn(Lnet/minecraft/world/level/block/state/BlockState;)Z")) + private boolean createbigcannons$isValidFireLocation(FireBlock instance, BlockState state, Operation original, + @Local(argsOnly = true) BlockGetter level, @Local(argsOnly = true) BlockPos pos, + @Local Direction dir) { + if (state.getBlock() instanceof CBCDynamicFlammableBlock cbcFlammable) + return cbcFlammable.getFireSpreadSpeed(state, level, pos.relative(dir)) > 0; + return original.call(instance, state); + } + +} diff --git a/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/PowderChargeBlockMixin.java b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/PowderChargeBlockMixin.java new file mode 100644 index 000000000..88791100d --- /dev/null +++ b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin/PowderChargeBlockMixin.java @@ -0,0 +1,31 @@ +package rbasamoyai.createbigcannons.fabric.mixin; + +import javax.annotation.Nullable; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import io.github.fabricators_of_create.porting_lib.block.CaughtFireBlock; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.RotatedPillarBlock; +import net.minecraft.world.level.block.state.BlockState; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.PowderChargeBlock; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.PrimedPropellant; + +@Mixin(PowderChargeBlock.class) +public abstract class PowderChargeBlockMixin extends RotatedPillarBlock implements CaughtFireBlock { + + PowderChargeBlockMixin(Properties properties) { super(properties); } + + @Shadow public abstract PrimedPropellant spawnPrimedPropellant(Level level, BlockPos pos, BlockState state); + + @Override + public void onCaughtFire(BlockState state, Level level, BlockPos pos, @Nullable Direction direction, @Nullable LivingEntity igniter) { + this.spawnPrimedPropellant(level, pos, state); + level.removeBlock(pos, false); + } + +} diff --git a/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin_interface/CBCDynamicFlammableBlock.java b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin_interface/CBCDynamicFlammableBlock.java new file mode 100644 index 000000000..58ba765d5 --- /dev/null +++ b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/mixin_interface/CBCDynamicFlammableBlock.java @@ -0,0 +1,12 @@ +package rbasamoyai.createbigcannons.fabric.mixin_interface; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.state.BlockState; + +public interface CBCDynamicFlammableBlock { + + int getFlammability(BlockState state, BlockGetter level, BlockPos pos); + int getFireSpreadSpeed(BlockState state, BlockGetter level, BlockPos pos); + +} diff --git a/fabric/src/main/resources/createbigcannons.mixins.json b/fabric/src/main/resources/createbigcannons.mixins.json index ae9d8b3c6..4afbbc55a 100644 --- a/fabric/src/main/resources/createbigcannons.mixins.json +++ b/fabric/src/main/resources/createbigcannons.mixins.json @@ -17,12 +17,16 @@ "AbstractCannonProjectileMixin", "ArmTileEntityMixin", "AutocannonAmmoContainerBlockEntityMixin", + "BigCartridgeBlockMixin", "CannonMountMixin", "CannonMountPointMixin", "CreateInitMixin", + "ExplosionMixin", + "FireBlockMixin", "GasMaskItemMixin", "MountedAutocannonContraptionMixin", "PitchOrientedContraptionEntityMixin", + "PowderChargeBlockMixin", "compat.fabric_api.ItemStorageMixin" ], "injectors": { diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/ap_shell.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/ap_shell.json index 5d1e97e33..e18702340 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/ap_shell.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/ap_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/ap_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/ap_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/ap_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/ap_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/ap_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/ap_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/ap_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/ap_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/ap_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/ap_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/ap_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/ap_shell", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/ap_shot.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/ap_shot.json index 8d8b7682f..f1dc60ffd 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/ap_shot.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/ap_shot.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/ap_shot", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/ap_shot", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/ap_shot", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/ap_shot", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/ap_shot", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/ap_shot", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/ap_shot", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/ap_shot", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/ap_shot" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/ap_shot" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/ap_shot", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/ap_shot", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/bag_of_grapeshot.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/bag_of_grapeshot.json index 653e4844a..0b38cb707 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/bag_of_grapeshot.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/bag_of_grapeshot.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/bag_of_grapeshot", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/bag_of_grapeshot", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/bag_of_grapeshot", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/bag_of_grapeshot", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/bag_of_grapeshot", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/bag_of_grapeshot", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/bag_of_grapeshot", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/bag_of_grapeshot", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/bag_of_grapeshot" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/bag_of_grapeshot" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/bag_of_grapeshot", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/bag_of_grapeshot", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/big_cartridge.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/big_cartridge.json index 516dca7bf..72287e4a6 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/big_cartridge.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/big_cartridge.json @@ -1,53 +1,105 @@ { "variants": { - "facing=down,filled=false": { + "damp=false,facing=down,filled=false": { "model": "createbigcannons:block/big_cartridge_empty", "x": 180 }, - "facing=down,filled=true": { + "damp=false,facing=down,filled=true": { "model": "createbigcannons:block/big_cartridge_filled", "x": 180 }, - "facing=east,filled=false": { + "damp=false,facing=east,filled=false": { "model": "createbigcannons:block/big_cartridge_empty", "x": 90, "y": 90 }, - "facing=east,filled=true": { + "damp=false,facing=east,filled=true": { "model": "createbigcannons:block/big_cartridge_filled", "x": 90, "y": 90 }, - "facing=north,filled=false": { + "damp=false,facing=north,filled=false": { "model": "createbigcannons:block/big_cartridge_empty", "x": 90 }, - "facing=north,filled=true": { + "damp=false,facing=north,filled=true": { "model": "createbigcannons:block/big_cartridge_filled", "x": 90 }, - "facing=south,filled=false": { + "damp=false,facing=south,filled=false": { "model": "createbigcannons:block/big_cartridge_empty", "x": 90, "y": 180 }, - "facing=south,filled=true": { + "damp=false,facing=south,filled=true": { "model": "createbigcannons:block/big_cartridge_filled", "x": 90, "y": 180 }, - "facing=up,filled=false": { + "damp=false,facing=up,filled=false": { "model": "createbigcannons:block/big_cartridge_empty" }, - "facing=up,filled=true": { + "damp=false,facing=up,filled=true": { "model": "createbigcannons:block/big_cartridge_filled" }, - "facing=west,filled=false": { + "damp=false,facing=west,filled=false": { "model": "createbigcannons:block/big_cartridge_empty", "x": 90, "y": 270 }, - "facing=west,filled=true": { + "damp=false,facing=west,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled", + "x": 90, + "y": 270 + }, + "damp=true,facing=down,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty", + "x": 180 + }, + "damp=true,facing=down,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled", + "x": 180 + }, + "damp=true,facing=east,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty", + "x": 90, + "y": 90 + }, + "damp=true,facing=east,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled", + "x": 90, + "y": 90 + }, + "damp=true,facing=north,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty", + "x": 90 + }, + "damp=true,facing=north,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled", + "x": 90 + }, + "damp=true,facing=south,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty", + "x": 90, + "y": 180 + }, + "damp=true,facing=south,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled", + "x": 90, + "y": 180 + }, + "damp=true,facing=up,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty" + }, + "damp=true,facing=up,filled=true": { + "model": "createbigcannons:block/big_cartridge_filled" + }, + "damp=true,facing=west,filled=false": { + "model": "createbigcannons:block/big_cartridge_empty", + "x": 90, + "y": 270 + }, + "damp=true,facing=west,filled=true": { "model": "createbigcannons:block/big_cartridge_filled", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/drop_mortar_shell.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/drop_mortar_shell.json index 068fbe95b..87ccf6bff 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/drop_mortar_shell.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/drop_mortar_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/drop_mortar_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/drop_mortar_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/drop_mortar_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/drop_mortar_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/drop_mortar_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/drop_mortar_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/drop_mortar_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/drop_mortar_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/drop_mortar_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/drop_mortar_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/drop_mortar_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/drop_mortar_shell", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/fluid_shell.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/fluid_shell.json index 703b534a7..7d3dcbc1c 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/fluid_shell.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/fluid_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/fluid_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/fluid_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/fluid_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/fluid_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/fluid_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/fluid_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/fluid_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/fluid_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/fluid_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/fluid_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/fluid_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/fluid_shell", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/he_shell.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/he_shell.json index ef4e214d5..d47b015f0 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/he_shell.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/he_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/he_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/he_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/he_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/he_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/he_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/he_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/he_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/he_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/he_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/he_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/he_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/he_shell", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/mortar_stone.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/mortar_stone.json index 637619bef..ffd31d57e 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/mortar_stone.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/mortar_stone.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/mortar_stone", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/mortar_stone", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/mortar_stone", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/mortar_stone", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/mortar_stone", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/mortar_stone", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/mortar_stone", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/mortar_stone", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/mortar_stone" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/mortar_stone" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/mortar_stone", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/mortar_stone", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/powder_charge.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/powder_charge.json index 2a8a88913..140e429d6 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/powder_charge.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/powder_charge.json @@ -1,14 +1,27 @@ { "variants": { - "axis=x": { + "axis=x,damp=false": { "model": "createbigcannons:block/powder_charge", "x": 90, "y": 90 }, - "axis=y": { + "axis=x,damp=true": { + "model": "createbigcannons:block/powder_charge", + "x": 90, + "y": 90 + }, + "axis=y,damp=false": { + "model": "createbigcannons:block/powder_charge" + }, + "axis=y,damp=true": { "model": "createbigcannons:block/powder_charge" }, - "axis=z": { + "axis=z,damp=false": { + "model": "createbigcannons:block/powder_charge", + "x": 90, + "y": 180 + }, + "axis=z,damp=true": { "model": "createbigcannons:block/powder_charge", "x": 90, "y": 180 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/shrapnel_shell.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/shrapnel_shell.json index 7cb5b93eb..72d4a5569 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/shrapnel_shell.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/shrapnel_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/shrapnel_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/shrapnel_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/shrapnel_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/shrapnel_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/shrapnel_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/shrapnel_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/shrapnel_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/shrapnel_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/shrapnel_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/shrapnel_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/shrapnel_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/shrapnel_shell", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/smoke_shell.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/smoke_shell.json index bb1bf73ac..03b360870 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/smoke_shell.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/smoke_shell.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/smoke_shell", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/smoke_shell", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/smoke_shell", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/smoke_shell", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/smoke_shell", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/smoke_shell", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/smoke_shell", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/smoke_shell", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/smoke_shell" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/smoke_shell" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/smoke_shell", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/smoke_shell", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/solid_shot.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/solid_shot.json index bf89b197d..5d530a0ca 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/solid_shot.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/solid_shot.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/solid_shot", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/solid_shot", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/solid_shot", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/solid_shot", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/solid_shot", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/solid_shot", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/solid_shot", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/solid_shot", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/solid_shot" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/solid_shot" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/solid_shot", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/solid_shot", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/blockstates/traffic_cone.json b/forge/src/generated/resources/assets/createbigcannons/blockstates/traffic_cone.json index 60a016826..3eee9869a 100644 --- a/forge/src/generated/resources/assets/createbigcannons/blockstates/traffic_cone.json +++ b/forge/src/generated/resources/assets/createbigcannons/blockstates/traffic_cone.json @@ -1,27 +1,53 @@ { "variants": { - "facing=down": { + "facing=down,waterlogged=false": { "model": "createbigcannons:block/traffic_cone", "x": 180 }, - "facing=east": { + "facing=down,waterlogged=true": { + "model": "createbigcannons:block/traffic_cone", + "x": 180 + }, + "facing=east,waterlogged=false": { + "model": "createbigcannons:block/traffic_cone", + "x": 90, + "y": 90 + }, + "facing=east,waterlogged=true": { "model": "createbigcannons:block/traffic_cone", "x": 90, "y": 90 }, - "facing=north": { + "facing=north,waterlogged=false": { + "model": "createbigcannons:block/traffic_cone", + "x": 90 + }, + "facing=north,waterlogged=true": { "model": "createbigcannons:block/traffic_cone", "x": 90 }, - "facing=south": { + "facing=south,waterlogged=false": { "model": "createbigcannons:block/traffic_cone", "x": 90, "y": 180 }, - "facing=up": { + "facing=south,waterlogged=true": { + "model": "createbigcannons:block/traffic_cone", + "x": 90, + "y": 180 + }, + "facing=up,waterlogged=false": { + "model": "createbigcannons:block/traffic_cone" + }, + "facing=up,waterlogged=true": { "model": "createbigcannons:block/traffic_cone" }, - "facing=west": { + "facing=west,waterlogged=false": { + "model": "createbigcannons:block/traffic_cone", + "x": 90, + "y": 270 + }, + "facing=west,waterlogged=true": { "model": "createbigcannons:block/traffic_cone", "x": 90, "y": 270 diff --git a/forge/src/generated/resources/assets/createbigcannons/lang/en_ud.json b/forge/src/generated/resources/assets/createbigcannons/lang/en_ud.json index 74171daeb..d1cf6930e 100644 --- a/forge/src/generated/resources/assets/createbigcannons/lang/en_ud.json +++ b/forge/src/generated/resources/assets/createbigcannons/lang/en_ud.json @@ -149,6 +149,7 @@ "block.createbigcannons.propellant.tooltip.added_muzzle_velocity.value": "s/ɯ ‾%s‾", "block.createbigcannons.propellant.tooltip.added_stress": "ssǝɹʇS pǝppⱯ", "block.createbigcannons.propellant.tooltip.added_stress.value": "‾%s‾", + "block.createbigcannons.propellant.tooltip.damp": "dɯɐᗡ", "block.createbigcannons.propellant.tooltip.power": "ɹǝʍoԀ", "block.createbigcannons.propellant.tooltip.power.value": "‾%s‾ / ‾%s‾", "block.createbigcannons.ram_head": "pɐǝH ɯɐᴚ", @@ -432,6 +433,13 @@ "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_4": "˙ɹǝuıɐʇuoɔ ɹǝɥʇouɐ ɥʇıʍ ɥɔǝǝɹq ǝɥʇ buıʞɔıןɔ-ʇɥbıɹ ʎq ɹǝuıɐʇuoɔ ǝɥʇ ʇno dɐʍs osןɐ uɐɔ noʎ", "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_5": "˙ɹǝuıɐʇuoɔ ɐ ɥʇıʍ uouuɐɔoʇnɐ pǝןqɯǝssɐ uɐ pɐoן osןɐ uɐɔ noʎ", "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_6": "˙ʇı buıʞɔıןɔ-ʇɥbıɹ ʇɟıɥs ɹo buıddɐʍs ʎq ɹo 'ʎʇdɯǝ sı ʇı ɟı uouuɐɔoʇnɐ pǝןqɯǝssɐ uɐ uo ɹǝuıɐʇuoɔ ʇuǝsǝɹd ɐ ǝʌoɯǝɹ ʎןuo uɐɔ noʎ 'ɹǝʌǝʍoH", + "createbigcannons.ponder.munitions/wet_ammo_storage.header": "sʇɔǝɟɟƎ ǝpıS sʇı puɐ 'buıbboןɹǝʇɐM ɥʇıʍ suoıʇıunW buıʇɔǝʇoɹԀ", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_1": "˙suoısoןdxǝ ɹǝɥʇo puɐ ǝɹıɟ ɯoɹɟ buıpoןdxǝ oʇ ǝןqɐɹǝuןnʌ ǝɹɐ 'sǝןıʇɔǝظoɹd sɐ ןןǝʍ sɐ 'sʞɔoןq ʇuɐןןǝdoɹԀ", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_2": "˙ɯǝɥʇ buıbboןɹǝʇɐʍ ʎq suoısoןdxǝ puɐ ǝɹıɟ ɯoɹɟ pǝʇɔǝʇoɹd ǝq uɐɔ sʞɔoןq uoıʇıunW", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_3": "˙dɯɐp ǝɯoɔǝq oʇ sʞɔoןq ʇuɐןןǝdoɹd sǝsnɐɔ buıbboןɹǝʇɐʍ 'ɹǝʌǝʍoH", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_4": "˙uouuɐɔ bıq ɐ uı ʞɔoןq ʇuɐןןǝdoɹd ʇsɹıɟ ǝɥʇ sɐ pǝɔɐןd sı ʇı ɟı ǝʇıubı oʇ sןıɐɟ osןɐ puɐ ɹǝʞɐǝʍ sı ʇuɐןןǝdoɹd dɯɐᗡ", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_5": "˙sǝbuods ʇǝʍ ǝʞıן ǝɔɐuɹnɟ ɐ uı pǝıɹp ǝq ʇouuɐɔ puɐ 'ʎɹp oʇ ʇɟǝן ǝq ʇsnɯ ʇuɐןןǝdoɹd dɯɐp 'sıɥʇ xıɟ o⟘", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_6": "˙sǝbuods ʇǝʍ oʇ ɹɐןıɯıs 'ʎɹp ʎןʇuɐʇsuı ןןıʍ ɹǝɥʇǝN ǝɥʇ ǝʞıן sǝɔɐןd ʇoɥ uı pǝɔɐןd ʇuɐןןǝdoɹd 'ɹǝʌǝʍoH", "createbigcannons.ponder.tag.cannon_crafting": "buıʇɟɐɹƆ uouuɐƆ", "createbigcannons.ponder.tag.cannon_crafting.description": "sɹǝqıןɐɔ puɐ sǝzıs ʇuǝɹǝɟɟıp ɟo suouuɐɔ ǝɹnʇɔɐɟnuɐɯ oʇ ʍoH", "createbigcannons.ponder.tag.munitions": "suoıʇıunW", @@ -488,6 +496,7 @@ "entity.createbigcannons.machine_gun_bullet": "ʇǝןןnᗺ un⅁ ǝuıɥɔɐW", "entity.createbigcannons.mortar_stone": "ǝuoʇS ɹɐʇɹoW", "entity.createbigcannons.pitch_contraption": "uoıʇdɐɹʇuoƆ ɥɔʇıԀ", + "entity.createbigcannons.primed_propellant": "ʇuɐןןǝdoɹԀ pǝɯıɹԀ", "entity.createbigcannons.shot": "ʇoɥS", "entity.createbigcannons.shrapnel_burst": "ʇsɹnᗺ ןǝudɐɹɥS", "entity.createbigcannons.shrapnel_shell": "ןןǝɥS ןǝudɐɹɥS", diff --git a/forge/src/generated/resources/assets/createbigcannons/lang/en_us.json b/forge/src/generated/resources/assets/createbigcannons/lang/en_us.json index 8d5d5b73c..cf99106d2 100644 --- a/forge/src/generated/resources/assets/createbigcannons/lang/en_us.json +++ b/forge/src/generated/resources/assets/createbigcannons/lang/en_us.json @@ -149,6 +149,7 @@ "block.createbigcannons.propellant.tooltip.added_muzzle_velocity.value": "_%s_ m/s", "block.createbigcannons.propellant.tooltip.added_stress": "Added Stress", "block.createbigcannons.propellant.tooltip.added_stress.value": "_%s_", + "block.createbigcannons.propellant.tooltip.damp": "Damp", "block.createbigcannons.propellant.tooltip.power": "Power", "block.createbigcannons.propellant.tooltip.power.value": "_%s_ / _%s_", "block.createbigcannons.ram_head": "Ram Head", @@ -432,6 +433,13 @@ "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_4": "You can also swap out the container by right-clicking the breech with another container.", "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_5": "You can also load an assembled autocannon with a container.", "createbigcannons.ponder.munitions/using_autocannon_ammo_container.text_6": "However, you can only remove a present container on an assembled autocannon if it is empty, or by swapping or shift right-clicking it.", + "createbigcannons.ponder.munitions/wet_ammo_storage.header": "Protecting Munitions with Waterlogging, and its Side Effects", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_1": "Propellant blocks, as well as projectiles, are vulnerable to exploding from fire and other explosions.", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_2": "Munition blocks can be protected from fire and explosions by waterlogging them.", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_3": "However, waterlogging causes propellant blocks to become damp.", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_4": "Damp propellant is weaker and also fails to ignite if it is placed as the first propellant block in a big cannon.", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_5": "To fix this, damp propellant must be left to dry, and cannot be dried in a furnace like wet sponges.", + "createbigcannons.ponder.munitions/wet_ammo_storage.text_6": "However, propellant placed in hot places like the Nether will instantly dry, similar to wet sponges.", "createbigcannons.ponder.tag.cannon_crafting": "Cannon Crafting", "createbigcannons.ponder.tag.cannon_crafting.description": "How to manufacture cannons of different sizes and calibers", "createbigcannons.ponder.tag.munitions": "Munitions", @@ -488,6 +496,7 @@ "entity.createbigcannons.machine_gun_bullet": "Machine Gun Bullet", "entity.createbigcannons.mortar_stone": "Mortar Stone", "entity.createbigcannons.pitch_contraption": "Pitch Contraption", + "entity.createbigcannons.primed_propellant": "Primed Propellant", "entity.createbigcannons.shot": "Shot", "entity.createbigcannons.shrapnel_burst": "Shrapnel Burst", "entity.createbigcannons.shrapnel_shell": "Shrapnel Shell", diff --git a/forge/src/generated/resources/data/createbigcannons/loot_tables/blocks/big_cartridge.json b/forge/src/generated/resources/data/createbigcannons/loot_tables/blocks/big_cartridge.json index cbaac0161..51644a782 100644 --- a/forge/src/generated/resources/data/createbigcannons/loot_tables/blocks/big_cartridge.json +++ b/forge/src/generated/resources/data/createbigcannons/loot_tables/blocks/big_cartridge.json @@ -6,6 +6,57 @@ "conditions": [ { "condition": "minecraft:survives_explosion" + }, + { + "block": "createbigcannons:big_cartridge", + "condition": "minecraft:block_state_property", + "properties": { + "damp": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "createbigcannons:big_cartridge" + } + ], + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:copy_nbt", + "ops": [ + { + "op": "replace", + "source": "Power", + "target": "Power" + } + ], + "source": "block_entity" + }, + { + "function": "minecraft:set_nbt", + "tag": "{Damp:1b}" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "block": "createbigcannons:big_cartridge", + "condition": "minecraft:block_state_property", + "properties": { + "damp": "false" + } } ], "entries": [ diff --git a/forge/src/generated/resources/data/createbigcannons/loot_tables/blocks/powder_charge.json b/forge/src/generated/resources/data/createbigcannons/loot_tables/blocks/powder_charge.json index cb0c3876c..832ab1952 100644 --- a/forge/src/generated/resources/data/createbigcannons/loot_tables/blocks/powder_charge.json +++ b/forge/src/generated/resources/data/createbigcannons/loot_tables/blocks/powder_charge.json @@ -6,6 +6,41 @@ "conditions": [ { "condition": "minecraft:survives_explosion" + }, + { + "block": "createbigcannons:powder_charge", + "condition": "minecraft:block_state_property", + "properties": { + "damp": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "createbigcannons:powder_charge" + } + ], + "functions": [ + { + "function": "minecraft:set_nbt", + "tag": "{Damp:1b}" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "block": "createbigcannons:powder_charge", + "condition": "minecraft:block_state_property", + "properties": { + "damp": "false" + } } ], "entries": [ diff --git a/forge/src/main/java/rbasamoyai/createbigcannons/datagen/assets/forge/CBCBuilderTransformersImpl.java b/forge/src/main/java/rbasamoyai/createbigcannons/datagen/assets/forge/CBCBuilderTransformersImpl.java index c136805df..9638c9dd2 100644 --- a/forge/src/main/java/rbasamoyai/createbigcannons/datagen/assets/forge/CBCBuilderTransformersImpl.java +++ b/forge/src/main/java/rbasamoyai/createbigcannons/datagen/assets/forge/CBCBuilderTransformersImpl.java @@ -16,6 +16,7 @@ import net.minecraft.advancements.critereon.StatePropertiesPredicate; import net.minecraft.client.renderer.RenderType; import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.world.item.Item; @@ -31,6 +32,7 @@ import net.minecraft.world.level.storage.loot.functions.CopyNameFunction; import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction; import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction; +import net.minecraft.world.level.storage.loot.functions.SetNbtFunction; import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition; import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; @@ -59,6 +61,7 @@ import rbasamoyai.createbigcannons.index.CBCItems; import rbasamoyai.createbigcannons.munitions.autocannon.ammo_container.AutocannonAmmoContainerBlock; import rbasamoyai.createbigcannons.munitions.autocannon.ammo_container.AutocannonAmmoContainerItem; +import rbasamoyai.createbigcannons.munitions.big_cannon.BigCannonMunitionBlock; import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.BigCannonPropellantBlock; import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.BigCartridgeBlock; import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.BigCartridgeBlockItem; @@ -474,7 +477,21 @@ public static NonNullUnaryOperator> powd ResourceLocation baseLoc = CreateBigCannons.resource("block/powder_charge"); return b -> b.properties(p -> p.noOcclusion()) .addLayer(() -> RenderType::solid) - .blockstate((c, p) -> BlockStateGen.axisBlock(c, p, $ -> p.models().getExistingFile(baseLoc))); + .blockstate((c, p) -> BlockStateGen.axisBlock(c, p, $ -> p.models().getExistingFile(baseLoc))) + .loot((t, c) -> { + CompoundTag dampTag = new CompoundTag(); + dampTag.putBoolean("Damp", true); + t.add(c, LootTable.lootTable() + .withPool(t.applyExplosionCondition(c, LootPool.lootPool()) + .add(LootItem.lootTableItem(c)) + .apply(SetNbtFunction.setTag(dampTag)) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(c) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BigCannonMunitionBlock.DAMP, true)))) + .withPool(t.applyExplosionCondition(c, LootPool.lootPool()) + .add(LootItem.lootTableItem(c)) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(c) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BigCannonMunitionBlock.DAMP, false))))); + }); } public static NonNullUnaryOperator> bigCartridge() { @@ -487,11 +504,22 @@ public static NonNul })) .tag(AllBlockTags.SAFE_NBT.tag) .loot((t, c) -> { + CompoundTag dampTag = new CompoundTag(); + dampTag.putBoolean("Damp", true); t.add(c, LootTable.lootTable() .withPool(t.applyExplosionCondition(c, LootPool.lootPool() - .add(LootItem.lootTableItem(c)) - .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1))) - .apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("Power", "Power"))))); + .add(LootItem.lootTableItem(c)) + .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1))) + .apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("Power", "Power"))) + .apply(SetNbtFunction.setTag(dampTag)) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(c) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BigCannonMunitionBlock.DAMP, true)))) + .withPool(t.applyExplosionCondition(c, LootPool.lootPool() + .add(LootItem.lootTableItem(c)) + .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1))) + .apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("Power", "Power"))) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(c) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BigCannonMunitionBlock.DAMP, false))))); }) .item(BigCartridgeBlockItem::new) .tag(CBCTags.CBCItemTags.BIG_CANNON_CARTRIDGES) diff --git a/forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/BigCartridgeBlockMixin.java b/forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/BigCartridgeBlockMixin.java new file mode 100644 index 000000000..f0f5f86d3 --- /dev/null +++ b/forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/BigCartridgeBlockMixin.java @@ -0,0 +1,42 @@ +package rbasamoyai.createbigcannons.forge.mixin; + +import javax.annotation.Nullable; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.DirectionalBlock; +import net.minecraft.world.level.block.state.BlockState; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.BigCartridgeBlock; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.BigCartridgeBlockEntity; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.PrimedPropellant; + +@Mixin(BigCartridgeBlock.class) +public abstract class BigCartridgeBlockMixin extends DirectionalBlock { + + BigCartridgeBlockMixin(Properties properties) { super(properties); } + + @Shadow public abstract PrimedPropellant spawnPrimedPropellant(Level level, BlockPos pos, BlockState state); + + @Override + public void onCaughtFire(BlockState state, Level level, BlockPos pos, @Nullable Direction direction, @Nullable LivingEntity igniter) { + this.spawnPrimedPropellant(level, pos, state); + level.removeBlock(pos, false); + } + + @Override + public int getFlammability(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { + return level.getBlockEntity(pos) instanceof BigCartridgeBlockEntity cartridge && cartridge.getPower() > 0 ? 30 : 0; + } + + @Override + public int getFireSpreadSpeed(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { + return level.getBlockEntity(pos) instanceof BigCartridgeBlockEntity cartridge && cartridge.getPower() > 0 ? 8 : 0; + } + +} diff --git a/forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/ExplosionMixin.java b/forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/ExplosionMixin.java new file mode 100644 index 000000000..0c3d45fc1 --- /dev/null +++ b/forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/ExplosionMixin.java @@ -0,0 +1,25 @@ +package rbasamoyai.createbigcannons.forge.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; +import rbasamoyai.createbigcannons.remix.CBCExplodableBlock; + +@Mixin(Explosion.class) +public class ExplosionMixin { + + @WrapOperation(method = "finalizeExplosion", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;onBlockExploded(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/Explosion;)V")) + public void onBlockExploded(BlockState instance, Level level, BlockPos pos, Explosion explosion, Operation original) { + if (instance.getBlock() instanceof CBCExplodableBlock cbcExplodable) + cbcExplodable.createbigcannons$onBlockExplode(level, pos, instance, explosion); + original.call(instance, level, pos, explosion); + } + +} diff --git a/forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/PowderChargeBlockMixin.java b/forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/PowderChargeBlockMixin.java new file mode 100644 index 000000000..d6bedcb2b --- /dev/null +++ b/forge/src/main/java/rbasamoyai/createbigcannons/forge/mixin/PowderChargeBlockMixin.java @@ -0,0 +1,41 @@ +package rbasamoyai.createbigcannons.forge.mixin; + +import javax.annotation.Nullable; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.RotatedPillarBlock; +import net.minecraft.world.level.block.state.BlockState; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.PowderChargeBlock; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.PrimedPropellant; + +@Mixin(PowderChargeBlock.class) +public abstract class PowderChargeBlockMixin extends RotatedPillarBlock { + + PowderChargeBlockMixin(Properties properties) { super(properties); } + + @Shadow public abstract PrimedPropellant spawnPrimedPropellant(Level level, BlockPos pos, BlockState state); + + @Override + public void onCaughtFire(BlockState state, Level level, BlockPos pos, @Nullable Direction direction, @Nullable LivingEntity igniter) { + this.spawnPrimedPropellant(level, pos, state); + level.removeBlock(pos, false); + } + + @Override + public int getFlammability(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { + return 100; + } + + @Override + public int getFireSpreadSpeed(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { + return 30; + } + +} diff --git a/forge/src/main/resources/createbigcannons.mixins.json b/forge/src/main/resources/createbigcannons.mixins.json index 6ad30f66f..6060fe33c 100644 --- a/forge/src/main/resources/createbigcannons.mixins.json +++ b/forge/src/main/resources/createbigcannons.mixins.json @@ -11,13 +11,16 @@ "mixins": [ "AbstractCannonProjectileMixin", "AutocannonAmmoContainerBlockEntityMixin", + "BigCartridgeBlockMixin", "CannonMountMixin", "CannonMountPointMixin", "CBCFlowingFluidMixin", "CBCLiquidBlockMixin", + "ExplosionMixin", "GasMaskItemMixin", "MountedAutocannonContraptionMixin", "PitchOrientedContraptionEntityMixin", + "PowderChargeBlockMixin", "compat.FramedAdjustableDoubleBlockEntityAccessor" ], "injectors": { diff --git a/src/main/java/rbasamoyai/createbigcannons/cannon_control/contraption/MountedBigCannonContraption.java b/src/main/java/rbasamoyai/createbigcannons/cannon_control/contraption/MountedBigCannonContraption.java index 444a168bb..9816cfee1 100644 --- a/src/main/java/rbasamoyai/createbigcannons/cannon_control/contraption/MountedBigCannonContraption.java +++ b/src/main/java/rbasamoyai/createbigcannons/cannon_control/contraption/MountedBigCannonContraption.java @@ -268,7 +268,7 @@ public void fireShot(ServerLevel level, PitchOrientedContraptionEntity entity) { int maxSafeCharges = this.getMaxSafeCharges(); boolean canFail = !CBCConfigs.SERVER.failure.disableAllFailure.get(); float spreadSub = this.cannonMaterial.properties().spreadReductionPerBarrel(); - boolean emptyNoProjectile = false; + boolean airGapPresent = false; PropellantContext propelCtx = new PropellantContext(); @@ -287,12 +287,13 @@ public void fireShot(ServerLevel level, PitchOrientedContraptionEntity entity) { Block block = containedBlockInfo.state().getBlock(); if (containedBlockInfo.state().isAir()) { - if (count == 0) return; + if (count == 0) + return; if (projectile == null) { if (projectileBlocks.isEmpty()) { - emptyNoProjectile = true; + airGapPresent = true; propelCtx.chargesUsed = Math.max(propelCtx.chargesUsed - 1, 0); - } else if (canFail) { + } else if (canFail) { // Incomplete projectile this.fail(currentPos, level, entity, behavior.blockEntity, (int) propelCtx.chargesUsed); return; } @@ -309,7 +310,10 @@ public void fireShot(ServerLevel level, PitchOrientedContraptionEntity entity) { } } } else if (block instanceof BigCannonPropellantBlock cpropel && !(block instanceof ProjectileBlock)) { - if (!cpropel.canBeIgnited(containedBlockInfo, this.initialOrientation)) return; + // Initial ignition + if (count == 0 && !cpropel.canBeIgnited(containedBlockInfo, this.initialOrientation)) + return; + // Incompatible propellant if (!propelCtx.addPropellant(cpropel, containedBlockInfo, this.initialOrientation) && canFail) { this.fail(currentPos, level, entity, behavior.blockEntity, (int) propelCtx.chargesUsed); return; @@ -320,14 +324,14 @@ public void fireShot(ServerLevel level, PitchOrientedContraptionEntity entity) { this.fail(currentPos, level, entity, behavior.blockEntity, (int) propelCtx.chargesUsed); return; } - if (emptyNoProjectile && canFail && rollFailToIgnite(rand)) { + if (airGapPresent && canFail && rollFailToIgnite(rand)) { Vec3 failIgnitePos = entity.toGlobalVector(Vec3.atCenterOf(currentPos.relative(this.initialOrientation)), 0); level.playSound(null, failIgnitePos.x, failIgnitePos.y, failIgnitePos.z, cannonInfo.state().getSoundType().getBreakSound(), SoundSource.BLOCKS, 5.0f, 0.0f); return; } - emptyNoProjectile = false; + airGapPresent = false; } else if (block instanceof ProjectileBlock projBlock && projectile == null) { - if (canFail && emptyNoProjectile && rollFailToIgnite(rand)) { + if (canFail && airGapPresent && rollFailToIgnite(rand)) { Vec3 failIgnitePos = entity.toGlobalVector(Vec3.atCenterOf(currentPos.relative(this.initialOrientation)), 0); level.playSound(null, failIgnitePos.x, failIgnitePos.y, failIgnitePos.z, cannonInfo.state().getSoundType().getBreakSound(), SoundSource.BLOCKS, 5.0f, 0.0f); return; @@ -355,7 +359,7 @@ public void fireShot(ServerLevel level, PitchOrientedContraptionEntity entity) { return; } } - emptyNoProjectile = false; + airGapPresent = false; } else { if (canFail) { this.fail(currentPos, level, entity, behavior.blockEntity, (int) propelCtx.chargesUsed); @@ -600,6 +604,7 @@ public CompoundTag writeNBT(boolean clientData) { if (this.hasWeldedPenalty) tag.putBoolean("WeldedCannon", true); if (this.mortarDelay > 0) tag.putInt("MortarDelay", this.mortarDelay); if (this.cachedMortarRound != null && !this.cachedMortarRound.isEmpty()) tag.put("CachedMortarRound", this.cachedMortarRound.save(new CompoundTag())); + if (this.hasFired) tag.putBoolean("HasFired", true); return tag; } @@ -611,6 +616,7 @@ public void readNBT(Level level, CompoundTag tag, boolean clientData) { if (this.cannonMaterial == null) this.cannonMaterial = CBCBigCannonMaterials.CAST_IRON; this.mortarDelay = Math.max(0, tag.getInt("MortarDelay")); this.cachedMortarRound = tag.contains("CachedMortarRound", Tag.TAG_COMPOUND) ? ItemStack.of(tag.getCompound("CachedMortarRound")) : ItemStack.EMPTY; + this.hasFired = tag.contains("HasFired"); } @Override diff --git a/src/main/java/rbasamoyai/createbigcannons/cannons/big_cannons/breeches/quickfiring_breech/QuickfiringBreechBlock.java b/src/main/java/rbasamoyai/createbigcannons/cannons/big_cannons/breeches/quickfiring_breech/QuickfiringBreechBlock.java index 84669356f..dbe531996 100644 --- a/src/main/java/rbasamoyai/createbigcannons/cannons/big_cannons/breeches/quickfiring_breech/QuickfiringBreechBlock.java +++ b/src/main/java/rbasamoyai/createbigcannons/cannons/big_cannons/breeches/quickfiring_breech/QuickfiringBreechBlock.java @@ -118,7 +118,7 @@ public boolean onInteractWhileAssembled(Player player, BlockPos localPos, Direct } ItemStack stack = player.getItemInHand(interactionHand); - Direction pushDirection = side.getOpposite(); + Direction pushDirection = entity.getInitialOrientation(); BlockPos nextPos = localPos.relative(pushDirection); if (stack.isEmpty()) { @@ -136,7 +136,7 @@ public boolean onInteractWhileAssembled(Player player, BlockPos localPos, Direct if (be1 instanceof IBigCannonBlockEntity cbe1) { StructureBlockInfo info1 = cbe1.cannonBehavior().block(); ItemStack extract = info1.state().getBlock() instanceof BigCannonMunitionBlock munition ? munition.getExtractedItem(info1) : ItemStack.EMPTY; - Vec3 normal = new Vec3(side.step()); + Vec3 normal = new Vec3(pushDirection.getOpposite().step()); Vec3 dir = contraption.entity.applyRotation(normal, 0); if (!extract.isEmpty()) { Vec3 ejectPos = Vec3.atCenterOf(localPos).add(normal.scale(1.1)); @@ -173,7 +173,7 @@ public boolean onInteractWhileAssembled(Player player, BlockPos localPos, Direct } if (!breech.isOpen() || breech.onInteractionCooldown()) return false; - if (Block.byItem(stack.getItem()) instanceof BigCannonMunitionBlock munition) { + if (Block.byItem(stack.getItem()) instanceof BigCannonMunitionBlock munition && breechFacing.getAxis() == side.getAxis()) { BlockEntity be1 = contraption.presentBlockEntities.get(nextPos); if (!(be1 instanceof IBigCannonBlockEntity cbe1)) return false; diff --git a/src/main/java/rbasamoyai/createbigcannons/config/CBCCfgMunitions.java b/src/main/java/rbasamoyai/createbigcannons/config/CBCCfgMunitions.java index 051caa414..4b798264b 100644 --- a/src/main/java/rbasamoyai/createbigcannons/config/CBCCfgMunitions.java +++ b/src/main/java/rbasamoyai/createbigcannons/config/CBCCfgMunitions.java @@ -16,6 +16,11 @@ public class CBCCfgMunitions extends ConfigBase { public final ConfigEnum damageRestriction = e(GriefState.ALL_DAMAGE, "damageRestriction", Comments.damageRestriction); public final ConfigBool projectilesChangeSurroundings = b(true, "projectilesChangeSurroundings"); + public final ConfigBool munitionBlocksCanExplode = b(true, "munitionBlocksCanExplode"); + + public final ConfigGroup dampBigCannonPropellant = group(0, "dampBigCannonPropellant", "Damp Big Cannon Propellant"); + public final ConfigBool dampPropellantBlocksStartingIgnition = b(true, "dampPropellantBlocksStartingIgnition"); + public final ConfigBool dampPropellantWeakensPropellant = b(true, "dampPropellantWeakensPropellant"); public final ConfigGroup chunkloading = group(0, "chunkloading", "Chunkloading"); public final ConfigBool projectilesCanChunkload = b(true, "projectilesCanChunkload"); diff --git a/src/main/java/rbasamoyai/createbigcannons/datagen/assets/CBCLangGen.java b/src/main/java/rbasamoyai/createbigcannons/datagen/assets/CBCLangGen.java index de85f0621..4578e6fe9 100644 --- a/src/main/java/rbasamoyai/createbigcannons/datagen/assets/CBCLangGen.java +++ b/src/main/java/rbasamoyai/createbigcannons/datagen/assets/CBCLangGen.java @@ -274,6 +274,7 @@ public static void prepare() { REGISTRATE.addLang("block", CreateBigCannons.resource("propellant"), "tooltip.added_stress.value", "_%s_"); REGISTRATE.addLang("block", CreateBigCannons.resource("propellant"), "tooltip.power", "Power"); REGISTRATE.addLang("block", CreateBigCannons.resource("propellant"), "tooltip.power.value", "_%s_ / _%s_"); + REGISTRATE.addLang("block", CreateBigCannons.resource("propellant"), "tooltip.damp", "Damp"); for (Iterator iter = CBCRegistries.cannonCastShapes().iterator(); iter.hasNext(); ) { ResourceLocation loc = CBCRegistries.cannonCastShapes().getKey(iter.next()); diff --git a/src/main/java/rbasamoyai/createbigcannons/index/CBCEntityTypes.java b/src/main/java/rbasamoyai/createbigcannons/index/CBCEntityTypes.java index 92dee405f..968a70f23 100644 --- a/src/main/java/rbasamoyai/createbigcannons/index/CBCEntityTypes.java +++ b/src/main/java/rbasamoyai/createbigcannons/index/CBCEntityTypes.java @@ -36,6 +36,8 @@ import rbasamoyai.createbigcannons.munitions.big_cannon.grapeshot.GrapeshotBurstRenderer; import rbasamoyai.createbigcannons.munitions.big_cannon.he_shell.HEShellProjectile; import rbasamoyai.createbigcannons.munitions.big_cannon.mortar_stone.MortarStoneProjectile; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.PrimedPropellant; +import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.PrimedPropellantRenderer; import rbasamoyai.createbigcannons.munitions.big_cannon.shrapnel.ShrapnelBurst; import rbasamoyai.createbigcannons.munitions.big_cannon.shrapnel.ShrapnelBurstRenderer; import rbasamoyai.createbigcannons.munitions.big_cannon.shrapnel.ShrapnelShellProjectile; @@ -134,6 +136,15 @@ public class CBCEntityTypes { public static final EntityEntry FLAK_AUTOCANNON = autocannonProjectile("flak_autocannon", FlakAutocannonProjectile::new, "Flak Autocannon Round", CBCMunitionPropertiesHandlers.FLAK_AUTOCANNON); public static final EntityEntry MACHINE_GUN_BULLET = autocannonProjectile("machine_gun_bullet", MachineGunProjectile::new, CBCMunitionPropertiesHandlers.INERT_AUTOCANNON_PROJECTILE); + public static final EntityEntry PRIMED_PROPELLANT = REGISTRATE + .entity("primed_propellant", PrimedPropellant::new, MobCategory.MISC) + .properties(configure(c -> c.fireImmune() + .size(0.98F, 0.98F) + .trackingRange(10) + .updateInterval(10))) + .renderer(() -> PrimedPropellantRenderer::new) + .register(); + private static EntityEntry cannonProjectile(String id, EntityFactory factory, PropertiesTypeHandler, ?> handler) { diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/BigCannonMunitionBlock.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/BigCannonMunitionBlock.java index aad81e227..a1338bde3 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/BigCannonMunitionBlock.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/BigCannonMunitionBlock.java @@ -5,9 +5,16 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; +import rbasamoyai.createbigcannons.config.CBCConfigs; +import rbasamoyai.createbigcannons.remix.CBCExplodableBlock; -public interface BigCannonMunitionBlock { +public interface BigCannonMunitionBlock extends CBCExplodableBlock { + + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + public static final BooleanProperty DAMP = BooleanProperty.create("damp"); BlockState onCannonRotate(BlockState oldState, Direction.Axis rotationAxis, Rotation rotation); Direction.Axis getAxis(BlockState state); @@ -15,4 +22,16 @@ public interface BigCannonMunitionBlock { StructureBlockInfo getHandloadingInfo(ItemStack stack, BlockPos localPos, Direction cannonOrientation); ItemStack getExtractedItem(StructureBlockInfo info); + /** + * Only use for blocks that have the waterlogged and damp properties + */ + static boolean canDry(BlockState state) { return !state.getValue(WATERLOGGED) && state.getValue(DAMP); } + + /** + * Only use for blocks that have the waterlogged and damp properties + */ + static boolean doesntIgnite(BlockState state) { + return state.getValue(WATERLOGGED) || state.getValue(DAMP) || !CBCConfigs.SERVER.munitions.munitionBlocksCanExplode.get(); + } + } diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/BigCannonProjectileRenderer.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/BigCannonProjectileRenderer.java index 9dc574f72..3a7924db6 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/BigCannonProjectileRenderer.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/BigCannonProjectileRenderer.java @@ -25,6 +25,7 @@ public class BigCannonProjectileRenderer public BigCannonProjectileRenderer(EntityRendererProvider.Context context) { super(context); + this.shadowRadius = 0.5f; } @Override diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/FuzedBigCannonProjectile.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/FuzedBigCannonProjectile.java index eec90612f..92d672e95 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/FuzedBigCannonProjectile.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/FuzedBigCannonProjectile.java @@ -6,6 +6,7 @@ import net.minecraft.core.Position; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -18,6 +19,7 @@ public abstract class FuzedBigCannonProjectile extends AbstractBigCannonProjectile { private ItemStack fuze = ItemStack.EMPTY; + private int explosionCountdown = -1; protected FuzedBigCannonProjectile(EntityType type, Level level) { super(type, level); @@ -28,7 +30,9 @@ protected FuzedBigCannonProjectile(EntityType fz.onProjectileTick(this.fuze, this))) { + if (!this.level().isClientSide && this.explosionCountdown > 0) + --this.explosionCountdown; + if (this.canDetonate(fz -> fz.onProjectileTick(this.fuze, this)) || !this.level().isClientSide && this.explosionCountdown == 0) { this.detonate(this.position()); this.removeNextTick = true; } @@ -63,12 +67,15 @@ protected boolean onImpact(HitResult hitResult, ImpactResult impactResult, Proje public void addAdditionalSaveData(CompoundTag tag) { super.addAdditionalSaveData(tag); tag.put("Fuze", this.fuze.save(new CompoundTag())); + if (this.explosionCountdown >= 0) + tag.putInt("ExplosionCountdown", this.explosionCountdown); } @Override public void readAdditionalSaveData(CompoundTag tag) { super.readAdditionalSaveData(tag); this.fuze = ItemStack.of(tag.getCompound("Fuze")); + this.explosionCountdown = tag.contains("ExplosionCountdown", Tag.TAG_INT) ? tag.getInt("ExplosionCountdown") : -1; } protected final boolean canDetonate(Predicate cons) { @@ -89,4 +96,7 @@ public boolean canLingerInGround() { return !this.level().isClientSide && this.level().hasChunkAt(this.blockPosition()) && this.fuze.getItem() instanceof FuzeItem fuzeItem && fuzeItem.canLingerInGround(this.fuze, this); } + public void setExplosionCountdown(int value) { this.explosionCountdown = Math.max(value, -1); } + public int getExplosionCountdown() { return this.explosionCountdown; } + } diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/FuzedProjectileBlock.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/FuzedProjectileBlock.java index aafb180fc..340b1b8fc 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/FuzedProjectileBlock.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/FuzedProjectileBlock.java @@ -16,6 +16,7 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -62,6 +63,15 @@ public AbstractBigCannonProjectile getProjectile(Level level, BlockPos pos, Bloc return projectile; } + @Override + protected AbstractBigCannonProjectile spawnFromExplosion(Level level, BlockPos pos, BlockState state, Explosion explosion) { + AbstractBigCannonProjectile projectile = super.spawnFromExplosion(level, pos, state, explosion); + if (projectile instanceof FuzedBigCannonProjectile fuzedProjectile) { + fuzedProjectile.setExplosionCountdown(level.random.nextInt(10) + 5); + } + return projectile; + } + protected static ItemStack getFuzeFromBlocks(List blocks) { if (blocks.isEmpty()) return ItemStack.EMPTY; StructureBlockInfo info = blocks.get(0); @@ -172,6 +182,7 @@ public void detonateProjectileOnTheSpot(Level level, BlockPos pos, BlockState st Vec3 orientation = new Vec3(dir.step()); projectile.setOrientation(orientation); projectile.setPos(Vec3.atCenterOf(pos)); + projectile.setDeltaMovement(orientation.scale(0.5)); // Velocity boost for burst shells fuzedProjectile.detonate(projectile.position()); } diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/ProjectileBlock.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/ProjectileBlock.java index 2fc484759..4fcf5e512 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/ProjectileBlock.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/ProjectileBlock.java @@ -14,28 +14,35 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.DirectionalBlock; import net.minecraft.world.level.block.Mirror; import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition.Builder; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.PushReaction; +import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import rbasamoyai.createbigcannons.cannons.big_cannons.BigCannonBlock; +import rbasamoyai.createbigcannons.config.CBCConfigs; -public abstract class ProjectileBlock extends DirectionalBlock implements IWrenchable, BigCannonMunitionBlock { +public abstract class ProjectileBlock extends DirectionalBlock + implements IWrenchable, BigCannonMunitionBlock, SimpleWaterloggedBlock { private final VoxelShaper shapes; public ProjectileBlock(Properties properties) { super(properties.pushReaction(PushReaction.NORMAL)); - this.registerDefaultState(this.getStateDefinition().any().setValue(FACING, Direction.UP)); + this.registerDefaultState(this.getStateDefinition().any().setValue(FACING, Direction.UP).setValue(WATERLOGGED, false)); this.shapes = this.makeShapes(); } @@ -47,6 +54,7 @@ public static ItemStack getTracerFromItemStack(ItemStack stack) { protected void createBlockStateDefinition(Builder builder) { super.createBlockStateDefinition(builder); builder.add(FACING); + builder.add(WATERLOGGED); } protected VoxelShaper makeShapes() { @@ -66,7 +74,13 @@ public BlockState getStateForPlacement(BlockPlaceContext context) { && !flag) { facing = facing.getOpposite(); } - return this.defaultBlockState().setValue(FACING, facing); + boolean waterlogged = context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER; + return this.defaultBlockState().setValue(FACING, facing).setValue(WATERLOGGED, waterlogged); + } + + @Override + public FluidState getFluidState(BlockState state) { + return state.getValue(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getSource(false) : Fluids.EMPTY.defaultFluidState(); } @Override @@ -84,9 +98,21 @@ public BlockState mirror(BlockState state, Mirror mirror) { return state.setValue(FACING, mirror.mirror(state.getValue(FACING))); } - public abstract AbstractBigCannonProjectile getProjectile(Level level, List projectileBlocks); - public abstract AbstractBigCannonProjectile getProjectile(Level level, ItemStack itemStack); - public abstract AbstractBigCannonProjectile getProjectile(Level level, BlockPos pos, BlockState state); + public AbstractBigCannonProjectile getProjectile(Level level, List projectileBlocks) { + return this.getAssociatedEntityType().create(level); + } + + public AbstractBigCannonProjectile getProjectile(Level level, ItemStack itemStack) { + return this.getAssociatedEntityType().create(level); + } + + public AbstractBigCannonProjectile getProjectile(Level level, BlockPos pos, BlockState state) { + return this.getAssociatedEntityType().create(level); + } + + protected AbstractBigCannonProjectile spawnFromExplosion(Level level, BlockPos pos, BlockState state, Explosion explosion) { + return this.getProjectile(level, pos, state); + } @Override public boolean canBeLoaded(BlockState state, Direction.Axis facing) { @@ -153,4 +179,19 @@ public static ItemStack getTracerFromBlock(Level level, BlockPos pos, BlockState return level.getBlockEntity(pos) instanceof BigCannonProjectileBlockEntity projectile ? projectile.getTracer() : ItemStack.EMPTY; } + @Override + public void createbigcannons$onBlockExplode(Level level, BlockPos pos, BlockState state, Explosion explosion) { + if (level.isClientSide || !CBCConfigs.SERVER.munitions.munitionBlocksCanExplode.get()) + return; + Vec3 entityPos = Vec3.atCenterOf(pos); + AbstractBigCannonProjectile projectile = this.spawnFromExplosion(level, pos, state, explosion); + projectile.setPos(entityPos); + // Taken from PrimedTnt# + double d = level.random.nextDouble() * (float) (Math.PI * 2); + projectile.setDeltaMovement(-Math.sin(d) * 0.02, 0.2F, -Math.cos(d) * 0.02); + level.addFreshEntity(projectile); + } + + @Override public boolean dropFromExplosion(Explosion explosion) { return false; } + } diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/grapeshot/GrapeshotBlock.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/grapeshot/GrapeshotBlock.java index fd4fd9399..12627aebd 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/grapeshot/GrapeshotBlock.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/grapeshot/GrapeshotBlock.java @@ -1,15 +1,7 @@ package rbasamoyai.createbigcannons.munitions.big_cannon.grapeshot; -import java.util.List; - -import net.minecraft.core.BlockPos; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import rbasamoyai.createbigcannons.index.CBCEntityTypes; -import rbasamoyai.createbigcannons.munitions.big_cannon.AbstractBigCannonProjectile; import rbasamoyai.createbigcannons.munitions.big_cannon.ProjectileBlock; public class GrapeshotBlock extends ProjectileBlock { @@ -18,21 +10,6 @@ public GrapeshotBlock(Properties properties) { super(properties); } - @Override - public AbstractBigCannonProjectile getProjectile(Level level, List projectileBlocks) { - return CBCEntityTypes.BAG_OF_GRAPESHOT.create(level); - } - - @Override - public AbstractBigCannonProjectile getProjectile(Level level, ItemStack itemStack) { - return CBCEntityTypes.BAG_OF_GRAPESHOT.create(level); - } - - @Override - public AbstractBigCannonProjectile getProjectile(Level level, BlockPos pos, BlockState state) { - return CBCEntityTypes.BAG_OF_GRAPESHOT.create(level); - } - @Override public EntityType getAssociatedEntityType() { return CBCEntityTypes.BAG_OF_GRAPESHOT.get(); diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/mortar_stone/MortarStoneBlock.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/mortar_stone/MortarStoneBlock.java index 18881fd06..a8e423509 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/mortar_stone/MortarStoneBlock.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/mortar_stone/MortarStoneBlock.java @@ -1,15 +1,7 @@ package rbasamoyai.createbigcannons.munitions.big_cannon.mortar_stone; -import java.util.List; - -import net.minecraft.core.BlockPos; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import rbasamoyai.createbigcannons.index.CBCEntityTypes; -import rbasamoyai.createbigcannons.munitions.big_cannon.AbstractBigCannonProjectile; import rbasamoyai.createbigcannons.munitions.big_cannon.ProjectileBlock; public class MortarStoneBlock extends ProjectileBlock { @@ -18,21 +10,6 @@ public MortarStoneBlock(Properties properties) { super(properties); } - @Override - public AbstractBigCannonProjectile getProjectile(Level level, List projectileBlocks) { - return CBCEntityTypes.MORTAR_STONE.create(level); - } - - @Override - public AbstractBigCannonProjectile getProjectile(Level level, ItemStack itemStack) { - return CBCEntityTypes.MORTAR_STONE.create(level); - } - - @Override - public AbstractBigCannonProjectile getProjectile(Level level, BlockPos pos, BlockState state) { - return CBCEntityTypes.MORTAR_STONE.create(level); - } - @Override public EntityType getAssociatedEntityType() { return CBCEntityTypes.MORTAR_STONE.get(); diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlock.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlock.java index b5ebd6c49..758e4134a 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlock.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlock.java @@ -9,31 +9,52 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.stats.Stats; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.DirectionalBlock; import net.minecraft.world.level.block.Mirror; import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import rbasamoyai.createbigcannons.cannons.big_cannons.BigCannonBehavior; import rbasamoyai.createbigcannons.cannons.big_cannons.BigCannonBlock; +import rbasamoyai.createbigcannons.config.CBCConfigs; import rbasamoyai.createbigcannons.index.CBCBlockEntities; import rbasamoyai.createbigcannons.index.CBCMunitionPropertiesHandlers; +import rbasamoyai.createbigcannons.munitions.big_cannon.BigCannonMunitionBlock; import rbasamoyai.createbigcannons.munitions.big_cannon.ProjectileBlock; import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.config.BigCartridgeProperties; -public class BigCartridgeBlock extends DirectionalBlock implements IWrenchable, BigCannonPropellantBlock, IBE { +public class BigCartridgeBlock extends DirectionalBlock implements IWrenchable, BigCannonPropellantBlock, IBE, + SimpleWaterloggedBlock { public static final BooleanProperty FILLED = BooleanProperty.create("filled"); @@ -41,7 +62,9 @@ public class BigCartridgeBlock extends DirectionalBlock implements IWrenchable, public BigCartridgeBlock(Properties properties) { super(properties); - this.registerDefaultState(this.getStateDefinition().any().setValue(FILLED, false)); + this.registerDefaultState(this.getStateDefinition().any().setValue(FILLED, false) + .setValue(WATERLOGGED, false) + .setValue(DAMP, false)); this.shapes = this.makeShapes(); } @@ -60,6 +83,29 @@ protected void createBlockStateDefinition(StateDefinition.Builder 0).setValue(FACING, facing); + ItemStack itemStack = context.getItemInHand(); + boolean waterlogged = context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER; + boolean damp = (itemStack.getOrCreateTag().getBoolean("Damp") || waterlogged) && !context.getLevel().dimensionType().ultraWarm(); + return this.defaultBlockState() + .setValue(FILLED, BigCartridgeBlockItem.getPower(itemStack) > 0) + .setValue(DAMP, damp) + .setValue(FACING, facing) + .setValue(WATERLOGGED, waterlogged); + } + + @Override + public boolean canBeIgnited(StructureBlockInfo data, Direction dir) { + if (data.state().getValue(DAMP) + && CBCConfigs.SERVER.munitions.dampPropellantBlocksStartingIgnition.get() + && this.getProperties().propellantProperties().dampAmmoDoesntIgniteAsStarter()) + return false; + return data.state().getValue(FACING) == dir && getPowerFromData(data) > 0; + } + + public static float getPowerFromData(StructureBlockInfo data) { + return data.nbt() == null ? 0 : data.nbt().getInt("Power"); + } + + public float getPowerMultiplier(StructureBlockInfo data) { + return CBCConfigs.SERVER.munitions.dampPropellantWeakensPropellant.get() && data.state().getValue(DAMP) + ? this.getProperties().propellantProperties().dampAmmoStrengthDebuff() + : 1; + } + + public float getPowerMultiplier(ItemStack stack) { + return CBCConfigs.SERVER.munitions.dampPropellantWeakensPropellant.get() && stack.getOrCreateTag().getBoolean("Damp") + ? this.getProperties().propellantProperties().dampAmmoStrengthDebuff() + : 1; } @Override public float getChargePower(StructureBlockInfo data) { - return getPowerFromData(data) * this.getProperties().propellantProperties().strength(); + return this.getPowerMultiplier(data) * getPowerFromData(data) * this.getProperties().propellantProperties().strength(); } @Override public float getChargePower(ItemStack stack) { - return BigCartridgeBlockItem.getPower(stack) * this.getProperties().propellantProperties().strength(); + return this.getPowerMultiplier(stack) * BigCartridgeBlockItem.getPower(stack) * this.getProperties().propellantProperties().strength(); } @Override public float getStressOnCannon(StructureBlockInfo data) { - return getPowerFromData(data) * this.getProperties().propellantProperties().addedStress(); + return this.getPowerMultiplier(data) * getPowerFromData(data) * this.getProperties().propellantProperties().addedStress(); } @Override public float getStressOnCannon(ItemStack stack) { - return BigCartridgeBlockItem.getPower(stack) * this.getProperties().propellantProperties().addedStress(); + return this.getPowerMultiplier(stack) * BigCartridgeBlockItem.getPower(stack) * this.getProperties().propellantProperties().addedStress(); } @Override public float getSpread(StructureBlockInfo data) { - return getPowerFromData(data) * this.getProperties().propellantProperties().addedSpread(); + return this.getPowerMultiplier(data) * getPowerFromData(data) * this.getProperties().propellantProperties().addedSpread(); } @Override public float getRecoil(StructureBlockInfo data) { - return getPowerFromData(data) * this.getProperties().propellantProperties().addedRecoil(); + return this.getPowerMultiplier(data) * getPowerFromData(data) * this.getProperties().propellantProperties().addedRecoil(); } @Override @@ -138,15 +216,6 @@ public boolean isValidAddition(StructureBlockInfo self, int index, Direction dir return this.canBeIgnited(self, dir) && index == 0; } - @Override - public boolean canBeIgnited(StructureBlockInfo data, Direction dir) { - return data.state().getValue(FACING) == dir && getPowerFromData(data) > 0; - } - - public static float getPowerFromData(StructureBlockInfo data) { - return data.nbt() == null ? 0 : data.nbt().getInt("Power"); - } - @Override public Class getBlockEntityClass() { return BigCartridgeBlockEntity.class; @@ -171,9 +240,12 @@ public BlockState onCannonRotate(BlockState oldState, Direction.Axis rotationAxi @Override public StructureBlockInfo getHandloadingInfo(ItemStack stack, BlockPos localPos, Direction cannonOrientation) { BlockState state = this.defaultBlockState().setValue(FACING, cannonOrientation); - CompoundTag tag = new CompoundTag(); - tag.putInt("Power", stack.getOrCreateTag().getInt("Power")); - return new StructureBlockInfo(localPos, state, tag); + CompoundTag blockTag = new CompoundTag(); + CompoundTag stackTag = stack.getOrCreateTag(); + blockTag.putInt("Power", stackTag.getInt("Power")); + if (stackTag.getBoolean("Damp")) + state = state.setValue(DAMP, true); + return new StructureBlockInfo(localPos, state, blockTag); } @Override @@ -182,6 +254,8 @@ public ItemStack getExtractedItem(StructureBlockInfo info) { if (info.nbt() != null) { stack.getOrCreateTag().putInt("Power", info.nbt().getInt("Power")); } + if (info.state().getValue(DAMP)) + stack.getOrCreateTag().putBoolean("Damp", true); return stack; } @@ -193,4 +267,79 @@ public int getMaximumPowerLevels() { return CBCMunitionPropertiesHandlers.BIG_CARTRIDGE.getPropertiesOf(this).maxPowerLevels(); } + @Override + public void createbigcannons$onBlockExplode(Level level, BlockPos pos, BlockState state, Explosion explosion) { + if (!level.isClientSide && !BigCannonMunitionBlock.doesntIgnite(state)) + this.spawnPrimedPropellant(level, pos, state); + } + + public PrimedPropellant spawnPrimedPropellant(Level level, BlockPos pos, BlockState state) { + Vec3 entityPos = Vec3.atCenterOf(pos); + PrimedPropellant propellant = PrimedPropellant.create(level, entityPos.x(), entityPos.y(), entityPos.z(), state); + int i = level.getBlockEntity(pos) instanceof BigCartridgeBlockEntity cartridge ? cartridge.getPower() : 0; + propellant.setExplosionPower(this.getProperties().propellantProperties().explosionPower() * (float) i); + level.addFreshEntity(propellant); + return propellant; + } + + // Adapted from TntBlock#use + @Override + public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + ItemStack itemStack = player.getItemInHand(hand); + if (!PowderChargeBlock.isPropellantIgniter(itemStack, player) || BigCannonMunitionBlock.doesntIgnite(state)) + return super.use(state, level, pos, player, hand, hit); + if (!(level.getBlockEntity(pos) instanceof BigCartridgeBlockEntity cartridge) || cartridge.getPower() < 1) + return super.use(state, level, pos, player, hand, hit); + PrimedPropellant propellant = this.spawnPrimedPropellant(level, pos, state); + propellant.setFuse(10); + level.setBlock(pos, Blocks.AIR.defaultBlockState(), 11); + Item item = itemStack.getItem(); + if (!player.isCreative()) { + if (itemStack.is(Items.FLINT_AND_STEEL)) { + itemStack.hurtAndBreak(1, player, playerx -> playerx.broadcastBreakEvent(hand)); + } else { + itemStack.shrink(1); + } + } + player.awardStat(Stats.ITEM_USED.get(item)); + return InteractionResult.sidedSuccess(level.isClientSide); + } + + // Adapted from TntBlock#onProjectileHit + @Override + public void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { + if (level.isClientSide) + return; + BlockPos blockPos = hit.getBlockPos(); + if (!projectile.isOnFire() || !projectile.mayInteract(level, blockPos) || BigCannonMunitionBlock.doesntIgnite(state)) + return; + this.spawnPrimedPropellant(level, blockPos, state); + level.removeBlock(blockPos, false); + } + + @Override + public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState state) { + ItemStack result = super.getCloneItemStack(level, pos, state); + CompoundTag tag = result.getOrCreateTag(); + if (state.getValue(DAMP)) + tag.putBoolean("Damp", true); + tag.putInt("Power", level.getBlockEntity(pos) instanceof BigCartridgeBlockEntity cartridge ? cartridge.getPower() : 0); + return result; + } + + @Override + public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) { + // Adapted from FireBlock#animateTick + if (state.getValue(DAMP) && random.nextInt(5) < 2) { + Direction.Axis axis = this.getAxis(state); + for (int i = 0; i < random.nextInt(1) + 1; i++) { + level.addParticle(ParticleTypes.DRIPPING_WATER, + (double) pos.getX() + (axis == Direction.Axis.X ? random.nextFloat() : 0.5 + (random.nextBoolean() ? -1 : 1) * random.nextFloat() * 0.42f), + (double) pos.getY() + (axis == Direction.Axis.Y ? random.nextFloat() : 0.5 + (random.nextBoolean() ? -1 : 1) * random.nextFloat() * 0.42f), + (double) pos.getZ() + (axis == Direction.Axis.Z ? random.nextFloat() : 0.5 + (random.nextBoolean() ? -1 : 1) * random.nextFloat() * 0.42f), + random.nextFloat() * 0.02f, 5.0E-5, random.nextFloat() * 0.02f); + } + } + } + } diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlockEntity.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlockEntity.java index 11e09c2d1..3651f6638 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlockEntity.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlockEntity.java @@ -27,8 +27,7 @@ public void load(CompoundTag tag) { this.storedPower = tag.getInt("Power"); } - public void setPower(int power) { - this.storedPower = power; - } + public void setPower(int power) { this.storedPower = power; } + public int getPower() { return this.storedPower; } } diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlockItem.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlockItem.java index a6815109c..b143cd51c 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlockItem.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/BigCartridgeBlockItem.java @@ -4,6 +4,9 @@ import javax.annotation.Nullable; +import com.simibubi.create.foundation.utility.Components; + +import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.BlockItem; @@ -11,6 +14,7 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.Level; +import rbasamoyai.createbigcannons.CreateBigCannons; import rbasamoyai.createbigcannons.base.CBCTooltip; import rbasamoyai.createbigcannons.index.CBCBlocks; import rbasamoyai.createbigcannons.index.CBCMunitionPropertiesHandlers; @@ -30,6 +34,8 @@ public void appendHoverText(ItemStack stack, @Nullable Level level, List AXIS = RotatedPillarBlock.AXIS; @@ -30,6 +53,9 @@ public class PowderChargeBlock extends RotatedPillarBlock implements IWrenchable public PowderChargeBlock(Properties properties) { super(properties); + this.registerDefaultState(this.getStateDefinition().any() + .setValue(WATERLOGGED, false) + .setValue(DAMP, false)); this.shapes = this.makeShapes(); } @@ -38,6 +64,42 @@ private VoxelShaper makeShapes() { return new AllShapes.Builder(base).forAxis(); } + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + super.createBlockStateDefinition(builder); + builder.add(WATERLOGGED); + builder.add(DAMP); + } + + @Override public boolean isRandomlyTicking(BlockState state) { return BigCannonMunitionBlock.canDry(state); } + + @Override + public boolean placeLiquid(LevelAccessor level, BlockPos pos, BlockState state, FluidState fluidState) { + boolean result = SimpleWaterloggedBlock.super.placeLiquid(level, pos, state, fluidState); + if (result && !level.isClientSide()) + level.setBlock(pos, level.getBlockState(pos).setValue(DAMP, true), 3); + return result; + } + + @Override + public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { + if (BigCannonMunitionBlock.canDry(state)) + level.setBlock(pos, state.setValue(DAMP, false), 3); + } + + @Override + public FluidState getFluidState(BlockState state) { + return state.getValue(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getSource(false) : Fluids.EMPTY.defaultFluidState(); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + ItemStack itemStack = context.getItemInHand(); + boolean waterlogged = context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER; + boolean damp = (itemStack.getOrCreateTag().getBoolean("Damp") || waterlogged) && !context.getLevel().dimensionType().ultraWarm(); + return super.getStateForPlacement(context).setValue(DAMP, damp).setValue(WATERLOGGED, waterlogged); + } + @Override public VoxelShape getShape(BlockState state, BlockGetter blockGetter, BlockPos pos, CollisionContext context) { return this.shapes.get(state.getValue(AXIS)); @@ -48,15 +110,54 @@ public boolean canBeLoaded(BlockState state, Direction.Axis axis) { return axis == state.getValue(AXIS); } - @Override public float getChargePower(StructureBlockInfo data) { return this.getProperties().propellantProperties().strength(); } - @Override public float getChargePower(ItemStack stack) { return this.getProperties().propellantProperties().strength(); } + @Override + public boolean canBeIgnited(StructureBlockInfo data, Direction dir) { + return !data.state().getValue(DAMP) + || !CBCConfigs.SERVER.munitions.dampPropellantBlocksStartingIgnition.get() + || !this.getProperties().propellantProperties().dampAmmoDoesntIgniteAsStarter(); + } + + public float getPowerMultiplier(StructureBlockInfo data) { + return CBCConfigs.SERVER.munitions.dampPropellantWeakensPropellant.get() && data.state().getValue(DAMP) + ? this.getProperties().propellantProperties().dampAmmoStrengthDebuff() + : 1; + } + + public float getPowerMultiplier(ItemStack stack) { + return CBCConfigs.SERVER.munitions.dampPropellantWeakensPropellant.get() && stack.getOrCreateTag().getBoolean("Damp") + ? this.getProperties().propellantProperties().dampAmmoStrengthDebuff() + : 1; + } + + @Override + public float getChargePower(StructureBlockInfo data) { + return this.getPowerMultiplier(data) * this.getProperties().propellantProperties().strength(); + } + + @Override + public float getChargePower(ItemStack stack) { + return this.getPowerMultiplier(stack) * this.getProperties().propellantProperties().strength(); + } + + @Override + public float getStressOnCannon(StructureBlockInfo data) { + return this.getPowerMultiplier(data) * this.getProperties().propellantProperties().addedStress(); + } - @Override public float getStressOnCannon(StructureBlockInfo data) { return this.getProperties().propellantProperties().addedStress(); } - @Override public float getStressOnCannon(ItemStack stack) { return this.getProperties().propellantProperties().addedStress(); } + @Override + public float getStressOnCannon(ItemStack stack) { + return this.getPowerMultiplier(stack) * this.getProperties().propellantProperties().addedStress(); + } - @Override public float getSpread(StructureBlockInfo data) { return this.getProperties().propellantProperties().addedSpread(); } + @Override + public float getSpread(StructureBlockInfo data) { + return this.getPowerMultiplier(data) * this.getProperties().propellantProperties().addedSpread(); + } - @Override public float getRecoil(StructureBlockInfo data) { return this.getProperties().propellantProperties().addedRecoil(); } + @Override + public float getRecoil(StructureBlockInfo data) { + return this.getPowerMultiplier(data) * this.getProperties().propellantProperties().addedRecoil(); + } @Override public void consumePropellant(BigCannonBehavior behavior) { @@ -84,17 +185,95 @@ public BlockState onCannonRotate(BlockState oldState, Direction.Axis rotationAxi @Override public StructureBlockInfo getHandloadingInfo(ItemStack stack, BlockPos localPos, Direction cannonOrientation) { - BlockState state = this.defaultBlockState().setValue(AXIS, cannonOrientation.getAxis()); + BlockState state = this.defaultBlockState().setValue(AXIS, cannonOrientation.getAxis()) + .setValue(DAMP, stack.getOrCreateTag().getBoolean("Damp")); return new StructureBlockInfo(localPos, state, null); } @Override public ItemStack getExtractedItem(StructureBlockInfo info) { - return new ItemStack(this); + ItemStack result = new ItemStack(this); + if (info.state().getValue(DAMP)) + result.getOrCreateTag().putBoolean("Damp", true); + return result; } protected PowderChargeProperties getProperties() { return CBCMunitionPropertiesHandlers.POWDER_CHARGE.getPropertiesOf(this); } + @Override + public void createbigcannons$onBlockExplode(Level level, BlockPos pos, BlockState state, Explosion explosion) { + if (!level.isClientSide && !BigCannonMunitionBlock.doesntIgnite(state)) + this.spawnPrimedPropellant(level, pos, state); + } + + public PrimedPropellant spawnPrimedPropellant(Level level, BlockPos pos, BlockState state) { + Vec3 entityPos = Vec3.atCenterOf(pos); + PrimedPropellant propellant = PrimedPropellant.create(level, entityPos.x(), entityPos.y(), entityPos.z(), state); + propellant.setExplosionPower(this.getProperties().propellantProperties().explosionPower()); + level.addFreshEntity(propellant); + return propellant; + } + + // Adapted from TntBlock#use + @Override + public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + ItemStack itemStack = player.getItemInHand(hand); + if (!isPropellantIgniter(itemStack, player) || BigCannonMunitionBlock.doesntIgnite(state)) + return super.use(state, level, pos, player, hand, hit); + PrimedPropellant propellant = this.spawnPrimedPropellant(level, pos, state); + propellant.setFuse(10); + level.setBlock(pos, Blocks.AIR.defaultBlockState(), 11); + Item item = itemStack.getItem(); + if (!player.isCreative()) { + if (itemStack.is(Items.FLINT_AND_STEEL)) { + itemStack.hurtAndBreak(1, player, playerx -> playerx.broadcastBreakEvent(hand)); + } else { + itemStack.shrink(1); + } + } + player.awardStat(Stats.ITEM_USED.get(item)); + return InteractionResult.sidedSuccess(level.isClientSide); + } + + // Adapted from TntBlock#onProjectileHit + @Override + public void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { + if (level.isClientSide) + return; + BlockPos blockPos = hit.getBlockPos(); + if (!projectile.isOnFire() || !projectile.mayInteract(level, blockPos) || BigCannonMunitionBlock.doesntIgnite(state)) + return; + this.spawnPrimedPropellant(level, blockPos, state); + level.removeBlock(blockPos, false); + } + + public static boolean isPropellantIgniter(ItemStack itemStack, Player player) { + return itemStack.is(Items.FLINT_AND_STEEL) || itemStack.is(Items.FIRE_CHARGE); + } + + @Override + public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState state) { + ItemStack result = super.getCloneItemStack(level, pos, state); + if (state.getValue(DAMP)) + result.getOrCreateTag().putBoolean("Damp", true); + return result; + } + + @Override + public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) { + // Adapted from FireBlock#animateTick + if (state.getValue(DAMP) && random.nextInt(5) < 2) { + Direction.Axis axis = this.getAxis(state); + for (int i = 0; i < random.nextInt(1) + 1; i++) { + level.addParticle(ParticleTypes.DRIPPING_WATER, + (double) pos.getX() + (axis == Direction.Axis.X ? random.nextFloat() : 0.5 + (random.nextBoolean() ? -1 : 1) * random.nextFloat() * 0.42f), + (double) pos.getY() + (axis == Direction.Axis.Y ? random.nextFloat() : 0.5 + (random.nextBoolean() ? -1 : 1) * random.nextFloat() * 0.42f), + (double) pos.getZ() + (axis == Direction.Axis.Z ? random.nextFloat() : 0.5 + (random.nextBoolean() ? -1 : 1) * random.nextFloat() * 0.42f), + random.nextFloat() * 0.02f, 5.0E-5, random.nextFloat() * 0.02f); + } + } + } + } diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/PowderChargeItem.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/PowderChargeItem.java index c99cf8280..5b497d927 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/PowderChargeItem.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/PowderChargeItem.java @@ -1,17 +1,22 @@ package rbasamoyai.createbigcannons.munitions.big_cannon.propellant; +import java.util.List; + +import javax.annotation.Nullable; + +import com.simibubi.create.foundation.utility.Components; + +import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; -import javax.annotation.Nullable; +import rbasamoyai.createbigcannons.CreateBigCannons; import rbasamoyai.createbigcannons.base.CBCTooltip; import rbasamoyai.createbigcannons.index.CBCBlocks; -import java.util.List; - public class PowderChargeItem extends BlockItem { public PowderChargeItem(Block block, Properties properties) { @@ -23,6 +28,8 @@ public void appendHoverText(ItemStack stack, @Nullable Level level, List DATA_FUSE_ID = SynchedEntityData.defineId(PrimedPropellant.class, EntityDataSerializers.INT); + private static final EntityDataAccessor DATA_APPEARANCE = SynchedEntityData.defineId(PrimedPropellant.class, EntityDataSerializers.BLOCK_STATE); + + protected float explosionPower = 4; + protected float fuze; + + public PrimedPropellant(EntityType entityType, Level level) { + super(entityType, level); + this.blocksBuilding = true; + } + + public static PrimedPropellant create(Level level, double x, double y, double z, BlockState blockState) { + PrimedPropellant propellant = new PrimedPropellant(CBCEntityTypes.PRIMED_PROPELLANT.get(), level); + propellant.setPos(x, y, z); + double d = level.random.nextDouble() * (float) (Math.PI * 2); + propellant.setDeltaMovement(-Math.sin(d) * 0.02, 0.2F, -Math.cos(d) * 0.02); + propellant.setFuse(level.random.nextInt(10) + 5); + propellant.setAppearance(blockState); + propellant.xo = x; + propellant.yo = y; + propellant.zo = z; + return propellant; + } + + @Override + protected void defineSynchedData() { + this.entityData.define(DATA_FUSE_ID, 20); + this.entityData.define(DATA_APPEARANCE, CBCBlocks.POWDER_CHARGE.getDefaultState()); + } + + @Override protected Entity.MovementEmission getMovementEmission() { return Entity.MovementEmission.NONE; } + + @Override public boolean isPickable() { return !this.isRemoved(); } + + @Override + public void tick() { + if (!this.isNoGravity()) { + this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.04, 0.0)); + } + + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.98)); + if (this.onGround()) { + this.setDeltaMovement(this.getDeltaMovement().multiply(0.7, -0.5, 0.7)); + } + + int i = this.getFuse() - 1; + this.setFuse(i); + if (i <= 0) { + this.discard(); + if (!this.level().isClientSide) { + this.explode(); + } + } else { + this.updateInWaterStateAndDoFluidPushing(); + if (this.level().isClientSide) { + this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5, this.getZ(), 0.0, 0.0, 0.0); + } + } + } + + private void explode() { + this.level().explode(this, this.getX(), this.getY(0.0625), this.getZ(), this.explosionPower, + CBCConfigs.SERVER.munitions.damageRestriction.get().explosiveInteraction()); + } + + @Override + protected void addAdditionalSaveData(CompoundTag tag) { + tag.putShort("Fuse", (short) this.getFuse()); + tag.put("Appearance", NbtUtils.writeBlockState(this.getAppearance())); + tag.putFloat("ExplosionPower", this.explosionPower); + } + + @Override + protected void readAdditionalSaveData(CompoundTag tag) { + this.setFuse(tag.getShort("Fuse")); + this.setAppearance(NbtUtils.readBlockState(this.level().holderLookup(CBCRegistryUtils.getBlockRegistryKey()), tag.getCompound("Appearance"))); + this.explosionPower = tag.getFloat("ExplosionPower"); + } + + @Override protected float getEyeHeight(Pose pose, EntityDimensions dimensions) { return 0.15F; } + + public void setFuse(int life) { this.entityData.set(DATA_FUSE_ID, life); } + public int getFuse() { return this.entityData.get(DATA_FUSE_ID); } + + public void setAppearance(BlockState state) { this.entityData.set(DATA_APPEARANCE, state); } + public BlockState getAppearance() { return this.entityData.get(DATA_APPEARANCE); } + + public void setExplosionPower(float explosionPower) { this.explosionPower = explosionPower; } + +} diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/PrimedPropellantRenderer.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/PrimedPropellantRenderer.java new file mode 100644 index 000000000..3fe0cb747 --- /dev/null +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/PrimedPropellantRenderer.java @@ -0,0 +1,50 @@ +package rbasamoyai.createbigcannons.munitions.big_cannon.propellant; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; + +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.TntMinecartRenderer; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; + +/** + * Copy of {@link net.minecraft.client.renderer.entity.TntRenderer}. Use only for single-block propellant. + */ +public class PrimedPropellantRenderer extends EntityRenderer { + private final BlockRenderDispatcher blockRenderer; + + public PrimedPropellantRenderer(EntityRendererProvider.Context context) { + super(context); + this.shadowRadius = 0.5f; + this.blockRenderer = context.getBlockRenderDispatcher(); + } + + public void render(PrimedPropellant entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { + poseStack.pushPose(); + poseStack.translate(0f, 0.5f, 0f); + int fuze = entity.getFuse(); + if ((float) fuze - partialTicks + 1f < 10f) { + float f = 1f - ((float) fuze - partialTicks + 1f) / 10f; + f = Mth.clamp(f, 0f, 1f); + f *= f; + f *= f; + float g = 1f + f * 0.3f; + poseStack.scale(g, g, g); + } + + poseStack.mulPose(Axis.YP.rotationDegrees(-90f)); + poseStack.translate(-0.5f, -0.5f, 0.5f); + poseStack.mulPose(Axis.YP.rotationDegrees(90f)); + TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, entity.getAppearance(), poseStack, buffer, packedLight, fuze / 5 % 2 == 0); + poseStack.popPose(); + super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); + } + + @Override public ResourceLocation getTextureLocation(PrimedPropellant entity) { return TextureAtlas.LOCATION_BLOCKS; } + +} diff --git a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/config/BigCannonPropellantPropertiesComponent.java b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/config/BigCannonPropellantPropertiesComponent.java index a50650359..d4a91db09 100644 --- a/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/config/BigCannonPropellantPropertiesComponent.java +++ b/src/main/java/rbasamoyai/createbigcannons/munitions/big_cannon/propellant/config/BigCannonPropellantPropertiesComponent.java @@ -5,27 +5,36 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.util.GsonHelper; -public record BigCannonPropellantPropertiesComponent(float strength, float addedStress, float addedRecoil, float addedSpread) { +public record BigCannonPropellantPropertiesComponent(float strength, float addedStress, float addedRecoil, float addedSpread, + float explosionPower, float dampAmmoStrengthDebuff, boolean dampAmmoDoesntIgniteAsStarter) { - public static final BigCannonPropellantPropertiesComponent DEFAULT = new BigCannonPropellantPropertiesComponent(0, 0, 0, 0); + public static final BigCannonPropellantPropertiesComponent DEFAULT = new BigCannonPropellantPropertiesComponent(0, 0, 0, 0, 0, 0, false); public static BigCannonPropellantPropertiesComponent fromJson(String id, JsonObject obj) { float strength = Math.max(0, GsonHelper.getAsFloat(obj, "strength", 2)); float addedStress = Math.max(0, GsonHelper.getAsFloat(obj, "added_stress", 1)); float addedRecoil = Math.max(0, GsonHelper.getAsFloat(obj, "added_recoil", 2)); float addedSpread = Math.max(0, GsonHelper.getAsFloat(obj, "added_spread", 1)); - return new BigCannonPropellantPropertiesComponent(strength, addedStress, addedRecoil, addedSpread); + float explosionPower = Math.max(0, GsonHelper.getAsFloat(obj, "explosion_power", 4)); + float dampAmmoPowerDebuff = Math.max(0, GsonHelper.getAsFloat(obj, "damp_ammo_strength_debuff", 0.5f)); + boolean dampAmmoDoesntIgniteAsStarter = GsonHelper.getAsBoolean(obj, "damp_ammo_doesnt_ignite_as_starter", true); + return new BigCannonPropellantPropertiesComponent(strength, addedStress, addedRecoil, addedSpread, explosionPower, + dampAmmoPowerDebuff, dampAmmoDoesntIgniteAsStarter); } public static BigCannonPropellantPropertiesComponent fromNetwork(FriendlyByteBuf buf) { - return new BigCannonPropellantPropertiesComponent(buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readFloat()); + return new BigCannonPropellantPropertiesComponent(buf.readFloat(), buf.readFloat(), buf.readFloat(), + buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readBoolean()); } public void toNetwork(FriendlyByteBuf buf) { buf.writeFloat(this.strength) .writeFloat(this.addedStress) .writeFloat(this.addedRecoil) - .writeFloat(this.addedSpread); + .writeFloat(this.addedSpread) + .writeFloat(this.explosionPower) + .writeFloat(this.dampAmmoStrengthDebuff) + .writeBoolean(this.dampAmmoDoesntIgniteAsStarter); } } diff --git a/src/main/java/rbasamoyai/createbigcannons/ponder/CBCPonderIndex.java b/src/main/java/rbasamoyai/createbigcannons/ponder/CBCPonderIndex.java index 7a5f05711..4e8c466ae 100644 --- a/src/main/java/rbasamoyai/createbigcannons/ponder/CBCPonderIndex.java +++ b/src/main/java/rbasamoyai/createbigcannons/ponder/CBCPonderIndex.java @@ -30,11 +30,13 @@ public static void register() { HELPER.forComponents(CBCBlocks.CANNON_LOADER, CBCBlocks.POWDER_CHARGE, CBCBlocks.BIG_CARTRIDGE) .addStoryBoard("munitions/cannon_loads", CannonLoadingScenes::cannonLoads, CBCPonderTags.MUNITIONS); + HELPER.forComponents(CBCBlocks.POWDER_CHARGE, CBCBlocks.BIG_CARTRIDGE) + .addStoryBoard("munitions/wet_ammo_storage", CannonLoadingScenes::wetAmmoStorage, CBCPonderTags.MUNITIONS); - HELPER.forComponents(CBCItems.IMPACT_FUZE, CBCItems.TIMED_FUZE, CBCItems.PROXIMITY_FUZE, CBCItems.DELAYED_IMPACT_FUZE, + HELPER.forComponents(CBCItems.IMPACT_FUZE, CBCItems.TIMED_FUZE, CBCItems.PROXIMITY_FUZE, CBCItems.DELAYED_IMPACT_FUZE, CBCItems.WIRED_FUZE, CBCBlocks.HE_SHELL, CBCBlocks.SHRAPNEL_SHELL, CBCBlocks.AP_SHELL, CBCBlocks.FLUID_SHELL, CBCBlocks.SMOKE_SHELL, CBCBlocks.DROP_MORTAR_SHELL, CBCItems.FLAK_AUTOCANNON_ROUND) - .addStoryBoard("munitions/fuzing_munitions", CannonLoadingScenes::fuzingMunitions, CBCPonderTags.MUNITIONS); + .addStoryBoard("munitions/fuzing_munitions", CannonLoadingScenes::fuzingMunitions); HELPER.forComponents(CBCBlocks.CAST_IRON_SLIDING_BREECH, CBCBlocks.BRONZE_SLIDING_BREECH, CBCBlocks.STEEL_SLIDING_BREECH) .addStoryBoard("cannon_kinetics/sliding_breech", CannonKineticsScenes::slidingBreech); @@ -140,7 +142,9 @@ public static void registerTags() { .add(CBCItems.TIMED_FUZE) .add(CBCItems.PROXIMITY_FUZE) .add(CBCItems.DELAYED_IMPACT_FUZE) + .add(CBCItems.WIRED_FUZE) .add(CBCItems.TRACER_TIP) + .add(CBCItems.FLAK_AUTOCANNON_ROUND) .add(CBCBlocks.AUTOCANNON_AMMO_CONTAINER) .add(CBCBlocks.CREATIVE_AUTOCANNON_AMMO_CONTAINER); diff --git a/src/main/java/rbasamoyai/createbigcannons/ponder/CannonLoadingScenes.java b/src/main/java/rbasamoyai/createbigcannons/ponder/CannonLoadingScenes.java index cf14d75fa..4c50a9e07 100644 --- a/src/main/java/rbasamoyai/createbigcannons/ponder/CannonLoadingScenes.java +++ b/src/main/java/rbasamoyai/createbigcannons/ponder/CannonLoadingScenes.java @@ -31,6 +31,7 @@ import rbasamoyai.createbigcannons.effects.particles.plumes.BigCannonPlumeParticleData; import rbasamoyai.createbigcannons.index.CBCBlocks; import rbasamoyai.createbigcannons.index.CBCItems; +import rbasamoyai.createbigcannons.munitions.big_cannon.BigCannonMunitionBlock; import rbasamoyai.createbigcannons.munitions.big_cannon.BigCannonProjectileBlockEntity; import rbasamoyai.createbigcannons.munitions.big_cannon.FuzedBlockEntity; import rbasamoyai.createbigcannons.munitions.big_cannon.propellant.BigCartridgeBlockItem; @@ -369,6 +370,86 @@ public static void cannonLoads(SceneBuilder scene, SceneBuildingUtil util) { scene.markAsFinished(); } + public static void wetAmmoStorage(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("munitions/wet_ammo_storage", "Protecting Munitions with Waterlogging, and its Side Effects"); + scene.configureBasePlate(0, 0, 5); + scene.showBasePlate(); + + Selection sel = util.select.fromTo(1, 1, 2, 3, 1, 2); + scene.idle(15); + scene.world.showSection(sel, Direction.DOWN); + scene.idle(30); + scene.overlay.showText(50) + .text("Propellant blocks, as well as projectiles, are vulnerable to exploding from fire and other explosions."); + scene.idle(65); + scene.overlay.showText(70) + .text("Munition blocks can be protected from fire and explosions by waterlogging them.") + .pointAt(util.vector.centerOf(2, 1, 2)); + scene.idle(30); + scene.world.modifyBlocks(sel, state -> state.setValue(BigCannonMunitionBlock.WATERLOGGED, true) + .setValue(BigCannonMunitionBlock.DAMP, true), false); + Emitter splashEmitter = Emitter.simple(ParticleTypes.SPLASH, util.vector.of(0, 0.05, 0)); + Vec3 blockSurface1 = util.vector.centerOf(util.grid.at(1, 1, 2)); + Vec3 blockSurface2 = util.vector.centerOf(util.grid.at(2, 1, 2)); + Vec3 blockSurface3 = util.vector.centerOf(util.grid.at(3, 1, 2)); + scene.effects.emitParticles(blockSurface1.add(0, 0.5, 0), splashEmitter, 5, 2); + scene.effects.emitParticles(blockSurface2.add(0, 0.5, 0), splashEmitter, 5, 2); + scene.effects.emitParticles(blockSurface3.add(0, 0.5, 0), splashEmitter, 5, 2); + scene.idle(55); + + scene.overlay.showOutline(PonderPalette.RED, new Object(), sel, 80); + scene.overlay.showText(80) + .attachKeyFrame() + .text("However, waterlogging causes propellant blocks to become damp.") + .colored(PonderPalette.RED) + .pointAt(util.vector.centerOf(2, 1, 2)); + + Emitter moisture = Emitter.withinBlockSpace(ParticleTypes.DRIPPING_WATER, util.vector.of(0, 1e-5, 0)); + for (int i = 0; i < 3; ++i) { + scene.idle(30); + if (i == 0) + scene.world.modifyBlocks(sel, state -> state.setValue(BigCannonMunitionBlock.WATERLOGGED, false), false); + scene.effects.emitParticles(blockSurface1, moisture, 3, 2); + scene.effects.emitParticles(blockSurface2, moisture, 3, 2); + scene.effects.emitParticles(blockSurface3, moisture, 3, 2); + } + + scene.idle(5); + scene.overlay.showText(50) + .attachKeyFrame() + .text("Damp propellant is weaker and also fails to ignite if it is placed as the first propellant block in a big cannon.") + .colored(PonderPalette.RED); + scene.idle(30); + scene.effects.emitParticles(blockSurface1, moisture, 3, 2); + scene.effects.emitParticles(blockSurface2, moisture, 3, 2); + scene.effects.emitParticles(blockSurface3, moisture, 3, 2); + scene.idle(35); + scene.overlay.showText(50) + .text("To fix this, damp propellant must be left to dry, and cannot be dried in a furnace like wet sponges.") + .colored(PonderPalette.BLUE); + scene.idle(30); + scene.effects.emitParticles(blockSurface1, moisture, 3, 2); + scene.effects.emitParticles(blockSurface2, moisture, 3, 2); + scene.effects.emitParticles(blockSurface3, moisture, 3, 2); + scene.idle(35); + + scene.world.modifyBlocks(util.select.fromTo(0, 0, 0, 4, 0, 4), state -> { + if (state.getBlock() == Blocks.SNOW_BLOCK) + return Blocks.NETHERRACK.defaultBlockState(); + if (state.getBlock() == Blocks.WHITE_CONCRETE) + return Blocks.BLACKSTONE.defaultBlockState(); + return state; + }, true); + scene.idle(30); + scene.overlay.showText(50) + .attachKeyFrame() + .text("However, propellant placed in hot places like the Nether will instantly dry, similar to wet sponges.") + .colored(PonderPalette.GREEN); + scene.idle(65); + + scene.markAsFinished(); + } + public static void fuzingMunitions(SceneBuilder scene, SceneBuildingUtil util) { scene.title("munitions/fuzing_munitions", "Fuzing Munitions"); scene.configureBasePlate(0, 0, 5); diff --git a/src/main/java/rbasamoyai/createbigcannons/remix/CBCExplodableBlock.java b/src/main/java/rbasamoyai/createbigcannons/remix/CBCExplodableBlock.java new file mode 100644 index 000000000..dcf28e536 --- /dev/null +++ b/src/main/java/rbasamoyai/createbigcannons/remix/CBCExplodableBlock.java @@ -0,0 +1,12 @@ +package rbasamoyai.createbigcannons.remix; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; + +public interface CBCExplodableBlock { + + default void createbigcannons$onBlockExplode(Level level, BlockPos pos, BlockState state, Explosion explosion) {} + +} diff --git a/src/main/resources/assets/createbigcannons/ponder/munitions/wet_ammo_storage.nbt b/src/main/resources/assets/createbigcannons/ponder/munitions/wet_ammo_storage.nbt new file mode 100644 index 0000000000000000000000000000000000000000..d5872a5e4b0c9e2510aef5257a5719f4c8f4968a GIT binary patch literal 323 zcmV-J0lfYniwFP!00000|BaMQZi6roM#q@6K-66qT~s|t)?HU!b&DLB5UXG#+Y(W4 z&|BA38CpeTVoMf3e)9~U!4*IWxz}GP0buT%*t7XqLV+gepwYwJO1Rtiw)yl`ym&4_ zj@DDr(j;trPyx>sYmE5Eh$~E%;E@TQobia2XTJ0hBN9AWf=4EJa>kP-bFo=Z&4}-yH&I^yzPOI_iLRV@=~QDl4eoogLB5+e-o4 zDbC}1+jZE&=Ae3y(V