From bc456a76cda8b782e4498f5da3c1b9dc26530fbe Mon Sep 17 00:00:00 2001 From: reidbhuntley Date: Fri, 9 Jul 2021 23:11:16 -0400 Subject: [PATCH] Tuber Tube Tidy-up - Set recovery chance for unenchanted Potato Cannons to 0 - Power enchantment on Potato Cannons now scales the damage of the projectile type instead of adding to it - Changed Potato Cannon crafting recipe to better fit the new model --- src/generated/resources/.cache/cache | 2 +- .../mechanical_crafting/potato_cannon.json | 10 +++++----- .../weapons/PotatoProjectileEntity.java | 15 ++++++++------- .../data/recipe/MechanicalCraftingRecipeGen.java | 12 +++++------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index e049ac862..6abf55f73 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -3383,7 +3383,7 @@ c2e15ac0c9109bad3face6d13efc32d7116b4c25 data/create/recipes/limestone_pillar_fr 14e322d4de8fae35d952274376497740bb3d5962 data/create/recipes/mechanical_crafting/extendo_grip.json de7fea84434753873dfa2b929d9b5f5f86ac6a5c data/create/recipes/mechanical_crafting/flywheel.json e491fd8a8873308270f9dc2a57ac8f2c70431dcc data/create/recipes/mechanical_crafting/furnace_engine.json -6ebd36ff54059038badefad239284ec1724fdf1d data/create/recipes/mechanical_crafting/potato_cannon.json +8e5224d22b228f69473ca48ca0d874b34660b573 data/create/recipes/mechanical_crafting/potato_cannon.json 98f877bf8f3f8a686fc6cf7479a0fba5744248ce data/create/recipes/milling/allium.json 8c7e1cbc87c7ca7df2bf949957e89422fef8ad94 data/create/recipes/milling/aluminum_ore.json bcff4d30ae09a0729bce8b2dbde4ddd6719a998b data/create/recipes/milling/andesite.json diff --git a/src/generated/resources/data/create/recipes/mechanical_crafting/potato_cannon.json b/src/generated/resources/data/create/recipes/mechanical_crafting/potato_cannon.json index 859513ed2..fffb05d24 100644 --- a/src/generated/resources/data/create/recipes/mechanical_crafting/potato_cannon.json +++ b/src/generated/resources/data/create/recipes/mechanical_crafting/potato_cannon.json @@ -1,11 +1,8 @@ { "type": "create:mechanical_crafting", "pattern": [ - "L", - "R", - "S", - "S", - "S" + "LRSSS", + "CC " ], "key": { "L": { @@ -15,6 +12,9 @@ "item": "create:precision_mechanism" }, "S": { + "item": "create:fluid_pipe" + }, + "C": { "tag": "forge:ingots/copper" } }, diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java index 9dd80bc7e..3fa2b56d5 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java @@ -30,6 +30,7 @@ import net.minecraft.util.IndirectEntityDamageSource; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.EntityRayTraceResult; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; @@ -46,9 +47,9 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements PotatoProjectileRenderMode stuckRenderer; double stuckFallSpeed; - float additionalDamage = 0; + float additionalDamageMult = 0; float additionalKnockback = 0; - float recoveryChance = .125f; + float recoveryChance = 0; public PotatoProjectileEntity(EntityType type, World world) { super(type, world); @@ -76,7 +77,7 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements int recovery = EnchantmentHelper.getEnchantmentLevel(AllEnchantments.POTATO_RECOVERY.get(), cannon); if (power > 0) - additionalDamage = power * 2; + additionalDamageMult = 1 + power * .2f; if (punch > 0) additionalKnockback = punch * .5f; if (flame > 0) @@ -88,7 +89,7 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements @Override public void readAdditional(CompoundNBT nbt) { stack = ItemStack.read(nbt.getCompound("Item")); - additionalDamage = nbt.getFloat("AdditionalDamage"); + additionalDamageMult = nbt.getFloat("AdditionalDamage"); additionalKnockback = nbt.getFloat("AdditionalKnockback"); recoveryChance = nbt.getFloat("Recovery"); super.readAdditional(nbt); @@ -97,7 +98,7 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements @Override public void writeAdditional(CompoundNBT nbt) { nbt.put("Item", stack.serializeNBT()); - nbt.putFloat("AdditionalDamage", additionalDamage); + nbt.putFloat("AdditionalDamage", additionalDamageMult); nbt.putFloat("AdditionalKnockback", additionalKnockback); nbt.putFloat("Recovery", recoveryChance); super.writeAdditional(nbt); @@ -174,7 +175,7 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements Vector3d hit = ray.getHitVec(); Entity target = ray.getEntity(); PotatoCannonProjectileTypes projectileType = getProjectileType(); - float damage = projectileType.getDamage() + additionalDamage; + float damage = MathHelper.floor(projectileType.getDamage() * additionalDamageMult); float knockback = projectileType.getKnockback() + additionalKnockback; Entity owner = this.getOwner(); @@ -193,7 +194,7 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements target.setFire(5); boolean onServer = !world.isRemote; - if (onServer && !target.attackEntityFrom(causePotatoDamage(), (float) damage)) { + if (onServer && !target.attackEntityFrom(causePotatoDamage(), damage)) { target.setFireTicks(k); remove(); return; diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/MechanicalCraftingRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/MechanicalCraftingRecipeGen.java index 887751cbb..ba98441ee 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/MechanicalCraftingRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/MechanicalCraftingRecipeGen.java @@ -39,16 +39,14 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider { .patternLine("SSS") .patternLine("SSS") .patternLine(" H ")), - + POTATO_CANNON = create(AllItems.POTATO_CANNON::get).returns(1) .recipe(b -> b.key('L', I.andesite()) .key('R', I.precisionMechanism()) - .key('S', Ingredient.fromTag(I.copper())) - .patternLine("L") - .patternLine("R") - .patternLine("S") - .patternLine("S") - .patternLine("S")), + .key('S', AllBlocks.FLUID_PIPE.get()) + .key('C', Ingredient.fromTag(I.copper())) + .patternLine("LRSSS") + .patternLine("CC ")), FURNACE_ENGINE = create(AllBlocks.FURNACE_ENGINE::get).returns(1) .recipe(b -> b.key('P', Ingredient.fromTag(I.brassSheet()))