Skip to content

Commit

Permalink
Introduce shulking modifier, new defense modifier from shulker shells
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed Jun 7, 2022
1 parent 4a52a52 commit fd2e480
Show file tree
Hide file tree
Showing 15 changed files with 145 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"type": "tconstruct:incremental_modifier",
"input": {
"item": "minecraft:shulker_shell"
},
"amount_per_item": 1,
"needed_per_level": 5,
"tools": {
"tag": "tconstruct:modifiable/armor"
},
"slots": {
"defense": 1
},
"result": {
"name": "tconstruct:shulking",
"level": 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"type": "tconstruct:modifier_salvage",
"tools": {
"tag": "tconstruct:modifiable/armor"
},
"slots": {
"defense": 1
},
"modifier": "tconstruct:shulking",
"min_level": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"level": 1
},
{
"name": "tconstruct:protection",
"name": "tconstruct:shulking",
"level": 1
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
import slimeknights.tconstruct.tools.modifiers.defense.MagicProtectionModifier;
import slimeknights.tconstruct.tools.modifiers.defense.MeleeProtectionModifier;
import slimeknights.tconstruct.tools.modifiers.defense.ProjectileProtectionModifier;
import slimeknights.tconstruct.tools.modifiers.defense.ShulkingModifier;
import slimeknights.tconstruct.tools.modifiers.defense.TurtleShellModifier;
import slimeknights.tconstruct.tools.modifiers.effect.BleedingEffect;
import slimeknights.tconstruct.tools.modifiers.effect.MagneticEffect;
Expand Down Expand Up @@ -272,6 +273,7 @@ public TinkerModifiers() {
public static final StaticModifier<MagicProtectionModifier> magicProtection = MODIFIERS.register("magic_protection", MagicProtectionModifier::new);
public static final StaticModifier<ProjectileProtectionModifier> projectileProtection = MODIFIERS.register("projectile_protection", ProjectileProtectionModifier::new);
public static final StaticModifier<TurtleShellModifier> turtleShell = MODIFIERS.register("turtle_shell", TurtleShellModifier::new);
public static final StaticModifier<ShulkingModifier> shulking = MODIFIERS.register("shulking", ShulkingModifier::new);
public static final StaticModifier<DragonbornModifier> dragonborn = MODIFIERS.register("dragonborn", DragonbornModifier::new);
// general
public static final DynamicModifier<Modifier> golden = MODIFIERS.registerDynamic("golden", Modifier.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,12 @@ private void addModifierRecipes(Consumer<FinishedRecipe> consumer) {
.setTools(TinkerTags.Items.ARMOR)
.saveSalvage(consumer, prefix(TinkerModifiers.turtleShell, defenseSalvage))
.save(consumer, prefix(TinkerModifiers.turtleShell, defenseFolder));
IncrementalModifierRecipeBuilder.modifier(TinkerModifiers.shulking)
.setInput(Items.SHULKER_SHELL, 1, 5)
.setSlots(SlotType.DEFENSE, 1)
.setTools(TinkerTags.Items.ARMOR)
.saveSalvage(consumer, prefix(TinkerModifiers.shulking, defenseSalvage))
.save(consumer, prefix(TinkerModifiers.shulking, defenseFolder));
IncrementalModifierRecipeBuilder.modifier(TinkerModifiers.dragonborn)
.setInput(TinkerModifiers.dragonScale, 1, 10)
.setSlots(SlotType.DEFENSE, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ TinkerTags.Blocks.TREE_LOGS, new TreeAOEIterator(0, 0),
.part(ArmorSlotType.HELMET, SkullStats.ID, 1)
.trait(ArmorSlotType.CHESTPLATE, ModifierIds.wings)
.trait(ArmorSlotType.LEGGINGS, TinkerModifiers.pockets, 1)
.trait(ArmorSlotType.LEGGINGS, TinkerModifiers.protection, 1)
.trait(ArmorSlotType.LEGGINGS, TinkerModifiers.shulking, 1)
.trait(ArmorSlotType.BOOTS, TinkerModifiers.bouncy)
.trait(ArmorSlotType.BOOTS, TinkerModifiers.leaping, 1);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package slimeknights.tconstruct.tools.modifiers.defense;

import net.minecraft.network.chat.Component;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.TooltipFlag;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import slimeknights.tconstruct.TConstruct;
import slimeknights.tconstruct.library.tools.capability.TinkerDataCapability;
import slimeknights.tconstruct.library.tools.capability.TinkerDataCapability.TinkerDataKey;
import slimeknights.tconstruct.library.tools.context.EquipmentContext;
import slimeknights.tconstruct.library.tools.nbt.IToolStackView;
import slimeknights.tconstruct.library.utils.TooltipKey;
import slimeknights.tconstruct.tools.logic.ModifierMaxLevel;

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

public class ShulkingModifier extends AbstractProtectionModifier<ModifierMaxLevel> {
private static final TinkerDataKey<ModifierMaxLevel> KEY = TConstruct.createKey("shulking");
public ShulkingModifier() {
super(KEY);
MinecraftForge.EVENT_BUS.addListener(EventPriority.NORMAL, false, LivingHurtEvent.class, ShulkingModifier::onAttack);
}

@Override
protected ModifierMaxLevel createData() {
return new ModifierMaxLevel();
}

@Override
public float getProtectionModifier(IToolStackView tool, int level, EquipmentContext context, EquipmentSlot slotType, DamageSource source, float modifierValue) {
if (context.getEntity().isCrouching() && !source.isBypassMagic() && !source.isBypassInvul()) {
modifierValue += getScaledLevel(tool, level) * 1.5;
}
return modifierValue;
}

@Override
public void addInformation(IToolStackView tool, int level, @Nullable Player player, List<Component> tooltip, TooltipKey tooltipKey, TooltipFlag tooltipFlag) {
AbstractProtectionModifier.addResistanceTooltip(this, tool, level, 1.5f, tooltip);
}

private static void onAttack(LivingHurtEvent event) {
// if the attacker is crouching, deal less damage
Entity attacker = event.getSource().getEntity();
if (attacker != null && attacker.isCrouching()) {
attacker.getCapability(TinkerDataCapability.CAPABILITY).ifPresent(data -> {
ModifierMaxLevel max = data.get(KEY);
if (max != null) {
event.setAmount(event.getAmount() * (1 - (max.getMax() * 0.1f)));
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"5 Upgrade Slots",
"0 Defense Slots",
"1 Ability Slot",
"Protection I"
"Shulking I"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"modifier_id": "tconstruct:shulking",
"text": [
{
"text": "Grants +6% resistance while sneaking. Caps at 80% across the whole set, or 14 levels."
},
{
"text": "Decreases attack damage while sneaking by 10% per level of the highest level piece.", "paragraph": true
}
],
"more_text_space": true,
"effects": [
"Can apply levels incrementally",
"Requires 1 defense slot"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"type": "tconstruct:modifier",
"data": "defense/protection/turtle_shell.json"
},
{
"type": "tconstruct:modifier",
"data": "defense/protection/shulking.json"
},
{
"type": "tconstruct:modifier",
"data": "defense/protection/dragonborn.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"modifier_id": "tconstruct:shulking",
"text": [
{
"text": "Home is where the shell is."
}
],
"effects": [
"Reduces damage given and received while sneaking",
"Multiple levels, each level further increases effect",
"Can apply levels incrementally",
"Requires 1 defense slot"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"type": "tconstruct:modifier",
"data": "defense/protection/turtle_shell.json"
},
{
"type": "tconstruct:modifier",
"data": "defense/protection/shulking.json"
},
{
"type": "tconstruct:modifier",
"data": "defense/protection/dragonborn.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"No Armor or Defense Slots",
"5 Upgrade Slots",
"1 Ability Slot",
"Protection"
"Shulking"
]
}
6 changes: 5 additions & 1 deletion src/main/resources/assets/tconstruct/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1794,8 +1794,12 @@
"modifier.tconstruct.turtle_shell.resistance": "Underwater Resistance",
"modifier.tconstruct.dragonborn": "Dragonborn",
"modifier.tconstruct.dragonborn.flavor": "Become Strixiki",
"modifier.tconstruct.dragonborn.description": "Increases protection and attack when airborne ",
"modifier.tconstruct.dragonborn.description": "Increases protection and attack when airborne",
"modifier.tconstruct.dragonborn.resistance": "Airborne Resistance",
"modifier.tconstruct.shulking": "Shulking",
"modifier.tconstruct.shulking.flavor": "This shell is my home",
"modifier.tconstruct.shulking.description": "Increases resistance while sneaking, but also decreases damage",
"modifier.tconstruct.shulking.resistance": "Shell Resistance",

"_comment": "Armor - counterattack",
"modifier.tconstruct.thorns": "Thorns",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/tconstruct/mantle/colors.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"knockback_resistance": "#4A4A4A",
"revitalizing": "#8cf4e2",
"dragonborn": "#232323",
"shulking": "#976997",
"turtle_shell": "#47BF4A",


Expand Down

0 comments on commit fd2e480

Please sign in to comment.