Skip to content

Commit

Permalink
Modifier tweaks
Browse files Browse the repository at this point in the history
Tier upgrades:
* New modifier killager granting bonus damage agaisnt illgers, replaces emerald boostign that
* Emerald now boosts conditional bonuses like lightspeed or invariant
* Diamond now grants +2 mining speed and +0.5 attack
* Netherite now grants +20% attack and +25% mining speed

Flat stat boot changes:
* Sharpness now grants +0.75 damage per level
* Haste now grants +5 mining speed per level, netherite puts it up to vanilla numbers
* Smite, bane of sssss, and alike now grant +2 damage per level, emerald puts it up to vanilla numbers
* Cooling now grants +1.6 damage, +2 with emerald

Harvest modifiers now mostly grant bonus mining speed
* Dwarven now grants +6 mining speed at y=64, more below and less above. It also can go negative
* Maintained now grants +6 at full durability, and 0 below 50%
* Searing is reduced to +6
* Temperatue is now +7.5 mining speed in extreme temperatures
* Invariant now properly reduces in neutral instead of extreme (#4786)
  • Loading branch information
KnightMiner committed Mar 10, 2022
1 parent 422b905 commit 38a65e6
Show file tree
Hide file tree
Showing 47 changed files with 319 additions and 154 deletions.
10 changes: 10 additions & 0 deletions src/generated/resources/data/forge/tags/entity_types/illagers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"replace": false,
"values": [
"minecraft:evoker",
"minecraft:illusioner",
"minecraft:pillager",
"minecraft:vindicator",
"minecraft:witch"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"minecraft:villager",
"minecraft:wandering_trader",
"minecraft:zombie_villager"
]
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{
"type": "tconstruct:entity_melting",
"entity": {
"types": [
"minecraft:evoker",
"minecraft:illusioner",
"minecraft:pillager",
"minecraft:vindicator",
"minecraft:witch"
]
"tag": "forge:illagers"
},
"result": {
"fluid": "tconstruct:molten_emerald",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"type": "tconstruct:entity_melting",
"entity": {
"types": [
"minecraft:villager",
"minecraft:wandering_trader",
"minecraft:zombie_villager"
]
"tag": "forge:villagers"
},
"result": {
"fluid": "tconstruct:molten_emerald",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "tconstruct:incremental_modifier_salvage",
"tools": [
{
"tag": "tconstruct:modifiable/melee"
},
{
"tag": "tconstruct:modifiable/armor/chestplate"
}
],
"slots": {
"upgrades": 1
},
"modifier": "tconstruct:killager",
"min_level": 1,
"salvage": {
"item": "minecraft:lapis_lazuli",
"count": 15
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "tconstruct:incremental_modifier",
"input": {
"tag": "forge:storage_blocks/lapis"
},
"amount_per_item": 9,
"needed_per_level": 45,
"tools": {
"tag": "tconstruct:modifiable/melee"
},
"slots": {
"upgrades": 1
},
"result": {
"name": "tconstruct:killager",
"level": 1
},
"max_level": 5
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "tconstruct:incremental_modifier",
"input": {
"tag": "forge:storage_blocks/lapis"
},
"amount_per_item": 9,
"needed_per_level": 45,
"tools": {
"tag": "tconstruct:modifiable/armor/chestplate"
},
"slots": {
"upgrades": 1
},
"requirements": {
"name": "tconstruct:unarmed",
"level": 1,
"error": "recipe.tconstruct.modifier.unarmed"
},
"result": {
"name": "tconstruct:killager",
"level": 1
},
"max_level": 5
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "tconstruct:incremental_modifier",
"input": {
"tag": "forge:gems/lapis"
},
"amount_per_item": 1,
"needed_per_level": 45,
"tools": {
"tag": "tconstruct:modifiable/melee"
},
"slots": {
"upgrades": 1
},
"result": {
"name": "tconstruct:killager",
"level": 1
},
"max_level": 5
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "tconstruct:incremental_modifier",
"input": {
"tag": "forge:gems/lapis"
},
"amount_per_item": 1,
"needed_per_level": 45,
"tools": {
"tag": "tconstruct:modifiable/armor/chestplate"
},
"slots": {
"upgrades": 1
},
"requirements": {
"name": "tconstruct:unarmed",
"level": 1,
"error": "recipe.tconstruct.modifier.unarmed"
},
"result": {
"name": "tconstruct:killager",
"level": 1
},
"max_level": 5
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"#forge:villagers",
"#forge:illagers",
"minecraft:iron_golem",
"minecraft:ravager"
]
}
6 changes: 6 additions & 0 deletions src/main/java/slimeknights/tconstruct/TConstruct.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import slimeknights.tconstruct.gadgets.TinkerGadgets;
import slimeknights.tconstruct.library.TinkerBookIDs;
import slimeknights.tconstruct.library.materials.MaterialRegistry;
import slimeknights.tconstruct.library.modifiers.Modifier;
import slimeknights.tconstruct.library.tools.capability.TinkerDataCapability.ComputableDataKey;
import slimeknights.tconstruct.library.tools.capability.TinkerDataCapability.TinkerDataKey;
import slimeknights.tconstruct.library.tools.definition.ToolDefinitionLoader;
Expand Down Expand Up @@ -200,6 +201,11 @@ void missingFluid(final MissingMappings<Fluid> event) {
});
}

@SubscribeEvent
void missingModifier(final MissingMappings<Modifier> event) {
RegistrationHelper.handleMissingMappings(event, MOD_ID, name -> "maintained_2".equals(name) ? TinkerModifiers.maintained.get() : null);
}


/* Utils */

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/slimeknights/tconstruct/common/TinkerTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,12 @@ private static void init() {}
public static final IOptionalNamedTag<EntityType<?>> MELTING_HIDE = tag("melting/hide_in_default");
public static final IOptionalNamedTag<EntityType<?>> PIGGYBACKPACK_BLACKLIST = tag("piggybackpack_blacklist");

/** Entities in this tag take more damage from bane of sssss */
public static final IOptionalNamedTag<EntityType<?>> CREEPERS = forgeTag("creepers");
public static final IOptionalNamedTag<EntityType<?>> VILLAGERS = forgeTag("villagers");
public static final IOptionalNamedTag<EntityType<?>> ILLAGERS = forgeTag("illagers");
/** Entities in this tag take more damage from killager */
public static final IOptionalNamedTag<EntityType<?>> KILLAGERS = tag("killagers");
/** Mobs that rarely spawn, boosts drop rate of severing */
public static final IOptionalNamedTag<EntityType<?>> RARE_MOBS = tag("rare_mobs");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import slimeknights.tconstruct.common.TinkerTags;
import slimeknights.tconstruct.world.TinkerWorld;

@SuppressWarnings("unchecked")
public class EntityTypeTagProvider extends EntityTypeTagsProvider {

public EntityTypeTagProvider(DataGenerator generatorIn, ExistingFileHelper existingFileHelper) {
Expand All @@ -26,6 +27,9 @@ public void addTags() {

this.tag(TinkerTags.EntityTypes.CREEPERS).add(EntityType.CREEPER);
this.tag(TinkerTags.EntityTypes.RARE_MOBS).add(EntityType.WITHER, EntityType.ENDER_DRAGON, EntityType.ELDER_GUARDIAN, EntityType.EVOKER, EntityType.PLAYER);
this.tag(TinkerTags.EntityTypes.VILLAGERS).add(EntityType.VILLAGER, EntityType.WANDERING_TRADER, EntityType.ZOMBIE_VILLAGER);
this.tag(TinkerTags.EntityTypes.ILLAGERS).add(EntityType.EVOKER, EntityType.ILLUSIONER, EntityType.PILLAGER, EntityType.VINDICATOR, EntityType.WITCH);
this.tag(TinkerTags.EntityTypes.KILLAGERS).addTags(TinkerTags.EntityTypes.VILLAGERS, TinkerTags.EntityTypes.ILLAGERS).add(EntityType.IRON_GOLEM, EntityType.RAVAGER);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1714,11 +1714,11 @@ private void addEntityMeltingRecipes(Consumer<FinishedRecipe> consumer) {
.save(consumer, prefix(EntityType.SILVERFISH, folder));

// villagers melt into emerald, but they die quite quick
EntityMeltingRecipeBuilder.melting(EntityIngredient.of(EntityType.VILLAGER, EntityType.WANDERING_TRADER, EntityType.ZOMBIE_VILLAGER),
EntityMeltingRecipeBuilder.melting(EntityIngredient.of(TinkerTags.EntityTypes.VILLAGERS),
new FluidStack(TinkerFluids.moltenEmerald.get(), FluidValues.GEM_SHARD), 5)
.save(consumer, prefix(EntityType.VILLAGER, folder));
// illagers are more resistant, they resist the villager culture afterall
EntityMeltingRecipeBuilder.melting(EntityIngredient.of(EntityType.EVOKER, EntityType.ILLUSIONER, EntityType.PILLAGER, EntityType.VINDICATOR, EntityType.WITCH),
EntityMeltingRecipeBuilder.melting(EntityIngredient.of(TinkerTags.EntityTypes.ILLAGERS),
new FluidStack(TinkerFluids.moltenEmerald.get(), FluidValues.GEM_SHARD), 2)
.save(consumer, modResource(folder + "illager"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@
import slimeknights.tconstruct.tools.modifiers.traits.harvest.DwarvenModifier;
import slimeknights.tconstruct.tools.modifiers.traits.harvest.LustrousModifier;
import slimeknights.tconstruct.tools.modifiers.traits.harvest.MaintainedModifier;
import slimeknights.tconstruct.tools.modifiers.traits.harvest.MaintainedModifier2;
import slimeknights.tconstruct.tools.modifiers.traits.harvest.MomentumModifier;
import slimeknights.tconstruct.tools.modifiers.traits.harvest.SearingModifier;
import slimeknights.tconstruct.tools.modifiers.traits.harvest.SharpweightModifier;
Expand Down Expand Up @@ -200,6 +199,7 @@
import slimeknights.tconstruct.tools.modifiers.upgrades.melee.BaneOfSssssModifier;
import slimeknights.tconstruct.tools.modifiers.upgrades.melee.CoolingModifier;
import slimeknights.tconstruct.tools.modifiers.upgrades.melee.FieryModifier;
import slimeknights.tconstruct.tools.modifiers.upgrades.melee.KillagerModifier;
import slimeknights.tconstruct.tools.modifiers.upgrades.melee.KnockbackModifier;
import slimeknights.tconstruct.tools.modifiers.upgrades.melee.LootingModifier;
import slimeknights.tconstruct.tools.modifiers.upgrades.melee.PaddedModifier;
Expand Down Expand Up @@ -293,6 +293,7 @@ public final class TinkerModifiers extends TinkerModule {
public static final RegistryObject<ScaledTypeDamageModifier> smite = MODIFIERS.register("smite", () -> new ScaledTypeDamageModifier(MobType.UNDEAD));
public static final RegistryObject<BaneOfSssssModifier> baneOfSssss = MODIFIERS.register("bane_of_sssss", BaneOfSssssModifier::new);
public static final RegistryObject<ScaledTypeDamageModifier> antiaquatic = MODIFIERS.register("antiaquatic", () -> new ScaledTypeDamageModifier(MobType.WATER));
public static final RegistryObject<KillagerModifier> killager = MODIFIERS.register("killager", KillagerModifier::new);
public static final RegistryObject<CoolingModifier> cooling = MODIFIERS.register("cooling", CoolingModifier::new);
public static final RegistryObject<SharpnessModifier> sharpness = MODIFIERS.register("sharpness", SharpnessModifier::new);
public static final RegistryObject<SweepingEdgeModifier> sweeping = MODIFIERS.register("sweeping_edge", SweepingEdgeModifier::new);
Expand Down Expand Up @@ -434,7 +435,6 @@ public final class TinkerModifiers extends TinkerModule {
public static final RegistryObject<OvercastModifier> overcast = MODIFIERS.register("overcast", OvercastModifier::new);
public static final RegistryObject<CrumblingModifier> crumbling = MODIFIERS.register("crumbling", CrumblingModifier::new);
public static final RegistryObject<LaceratingModifier> lacerating = MODIFIERS.register("lacerating", LaceratingModifier::new);
public static final RegistryObject<MaintainedModifier> wellMaintained = MODIFIERS.register("maintained", MaintainedModifier::new);
public static final RegistryObject<ExtraModifier> enhanced = MODIFIERS.register("enhanced", () -> new ExtraModifier(SlotType.UPGRADE, ModifierSource.TRAIT));
public static final RegistryObject<TastyModifier> tasty = MODIFIERS.register("tasty", TastyModifier::new);
// traits - tier 3 nether
Expand All @@ -456,7 +456,7 @@ public final class TinkerModifiers extends TinkerModule {
// smite is also an upgrade
// traits - mod compat tier 3
public static final RegistryObject<DuctileModifier> ductile = MODIFIERS.register("ductile", DuctileModifier::new);
public static final RegistryObject<MaintainedModifier2> wellMaintained2 = MODIFIERS.register("maintained_2", MaintainedModifier2::new);
public static final RegistryObject<MaintainedModifier> maintained = MODIFIERS.register("maintained", MaintainedModifier::new);
public static final RegistryObject<TemperateModifier> temperate = MODIFIERS.register("temperate", TemperateModifier::new);
public static final RegistryObject<InvariantModifier> invariant = MODIFIERS.register("invariant", InvariantModifier::new);
public static final RegistryObject<DecayModifier> decay = MODIFIERS.register("decay", DecayModifier::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,23 @@ private void addModifierRecipes(Consumer<FinishedRecipe> consumer) {
.includeUnarmed()
.saveSalvage(consumer, prefix(TinkerModifiers.cooling, upgradeSalvage))
.save(consumer, prefix(TinkerModifiers.cooling, upgradeFolder));
// killager uses both types of lapis
IncrementalModifierRecipeBuilder.modifier(TinkerModifiers.killager.get())
.setTools(TinkerTags.Items.MELEE)
.setInput(Tags.Items.GEMS_LAPIS, 1, 45)
.setSalvage(Items.LAPIS_LAZULI, 15, false)
.setMaxLevel(5) // +12.5 illager damage
.setSlots(SlotType.UPGRADE, 1)
.includeUnarmed()
.saveSalvage(consumer, prefix(TinkerModifiers.killager, upgradeSalvage))
.save(consumer, wrap(TinkerModifiers.killager, upgradeFolder, "_from_dust"));
IncrementalModifierRecipeBuilder.modifier(TinkerModifiers.killager.get())
.setTools(TinkerTags.Items.MELEE)
.setInput(Tags.Items.STORAGE_BLOCKS_LAPIS, 9, 45)
.setMaxLevel(5) // +12.5 illager damage
.setSlots(SlotType.UPGRADE, 1)
.includeUnarmed()
.save(consumer, wrap(TinkerModifiers.killager, upgradeFolder, "_from_block"));
// sharpness can use shards or blocks
IncrementalModifierRecipeBuilder.modifier(TinkerModifiers.sharpness.get())
.setTools(TinkerTags.Items.MELEE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected void addMaterialTraits() {
addDefaultTraits(MaterialIds.whitestone, TinkerModifiers.stoneshield.get());
// tier 3 - mod compat
addDefaultTraits(MaterialIds.steel, TinkerModifiers.ductile.get());
addDefaultTraits(MaterialIds.bronze, TinkerModifiers.wellMaintained.get());
addDefaultTraits(MaterialIds.bronze, TinkerModifiers.maintained.get());
addDefaultTraits(MaterialIds.constantan, TinkerModifiers.temperate.get());
addDefaultTraits(MaterialIds.invar, TinkerModifiers.invariant.get());
addDefaultTraits(MaterialIds.necronium, TinkerModifiers.decay.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,56 @@

import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import slimeknights.tconstruct.TConstruct;
import slimeknights.tconstruct.common.TinkerTags;
import slimeknights.tconstruct.library.modifiers.Modifier;
import slimeknights.tconstruct.library.tools.nbt.IToolStackView;
import slimeknights.tconstruct.library.tools.stat.ToolStats;
import slimeknights.tconstruct.library.utils.TooltipKey;

import javax.annotation.Nullable;
import java.util.List;

public class DwarvenModifier extends Modifier {
private static final Component MINING_SPEED = TConstruct.makeTranslation("modifier", "dwarven.mining_speed");
/** Baseline height where boost is 1 */
private static final int SEA_LEVEL = 64;
/** Max percentage bonus per level when y = 0 */
private static final float BOOST_AT_0 = 0.1f;
/** Distance below sea level to get boost */
private static final float BOOST_DISTANCE = 64f;
/** Boost when at distance, gets larger when lower */
private static final float BONUS = 6;

/** Gets the boost for the given level and height */
private static float getBoost(int y, int level) {
return (SEA_LEVEL - y) * level * (BOOST_AT_0 / SEA_LEVEL);
/** Gets the boost for the given level and height, can go negative */
private static float getBoost(Level world, int y, int level) {
// prevent the modifier from getting too explosive in tall worlds, clamp between -6 and 12
float bonus = Mth.clamp((world.getSeaLevel() - y) / BOOST_DISTANCE, -1, 2);
// grants 0 bonus at sea level, -1x at BOOST_DISTANCE, 1x at -BOOST_DISTANCE, 2x at -2*BOOST_DISTANCE
return bonus * level * BONUS;
}

@Override
public void onBreakSpeed(IToolStackView tool, int level, BreakSpeed event, Direction sideHit, boolean isEffective, float miningSpeedModifier) {
if (!isEffective) {
return;
}
// essentially just the line slope formula from (0, level + 1) to (SEA_LEVEL, 1), with a scal
float factor = getBoost(event.getPos().getY(), level);
if (factor > 0) {
event.setNewSpeed(event.getNewSpeed() * (1 + factor));
}
float boost = getBoost(event.getPlayer().level, event.getPos().getY(), level);
event.setNewSpeed(event.getNewSpeed() + (boost * miningSpeedModifier * tool.getMultiplier(ToolStats.MINING_SPEED)));
}

@Override
public void addInformation(IToolStackView tool, int level, @Nullable Player player, List<Component> tooltip, TooltipKey key, TooltipFlag tooltipFlag) {
if (tool.hasTag(TinkerTags.Items.HARVEST)) {
double boost;
if (player != null && key == TooltipKey.SHIFT) {
boost = getBoost((int)player.getY(), level);
boost = getBoost(player.level, (int)player.getY(), level);
} else {
boost = BOOST_AT_0 * level;
boost = BONUS * level;
}
if (boost > 0) {
addPercentTooltip(MINING_SPEED, boost, tooltip);
if (boost != 0) {
addFlatBoost(MINING_SPEED, boost * tool.getMultiplier(ToolStats.MINING_SPEED), tooltip);
}
}
}
Expand Down

0 comments on commit 38a65e6

Please sign in to comment.