Skip to content

Commit

Permalink
Merge pull request #1968 from VT-14/gilded
Browse files Browse the repository at this point in the history
Gilded Living Armour Upgrade (1.20.1)
  • Loading branch information
WayofTime committed Jan 22, 2024
2 parents e573e39 + b600ee0 commit 0efe7f2
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/generated/resources/assets/bloodmagic/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@
"living_upgrade.bloodmagic.experienced": "Experienced",
"living_upgrade.bloodmagic.fall_protect": "Soft Fall",
"living_upgrade.bloodmagic.fire_resist": "Gift of Ignis",
"living_upgrade.bloodmagic.gilded": "Gilded",
"living_upgrade.bloodmagic.grave_digger": "Grave Digger",
"living_upgrade.bloodmagic.grim_reaper": "Grim Reaper's Sprint",
"living_upgrade.bloodmagic.health": "Healthy",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ protected void addTranslations()
add("living_upgrade.bloodmagic.repair", "Repairing");
add("living_upgrade.bloodmagic.curios_socket", "Socketed");
add("living_upgrade.bloodmagic.diamond_protect", "Brilliance");
add("living_upgrade.bloodmagic.gilded", "Gilded");

add("living_upgrade.bloodmagic.slowness", "Limp Leg");
add("living_upgrade.bloodmagic.crippled_arm", "Crippled Arm");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;

import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.*;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -197,4 +193,12 @@ public boolean hasElytraUpgrade(ItemStack stack, LivingEntity entity)
else
return false;
}

public boolean makesPiglinsNeutral(ItemStack stack, LivingEntity wearer)
{
if (stack.getItem() instanceof ItemLivingArmor && wearer instanceof Player && LivingUtil.hasFullSet((Player) wearer)) {
return LivingStats.fromPlayer((Player) wearer, true).getLevel(LivingArmorRegistrar.UPGRADE_GILDED.get().getKey()) > 0;
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class LivingArmorRegistrar
def.put("curios_socket", BloodMagic.rl("curios_socket"));
def.put("diamond_protect", BloodMagic.rl("diamond_protect"));
def.put("repair", BloodMagic.rl("repair"));
def.put("gilded", BloodMagic.rl("gilded"));
def.put("downgrade/quenched", BloodMagic.rl("downgrade/quenched"));
def.put("downgrade/storm_trooper", BloodMagic.rl("downgrade/storm_trooper"));
def.put("downgrade/battle_hungry", BloodMagic.rl("downgrade/battle_hungry"));
Expand Down Expand Up @@ -145,7 +146,7 @@ public class LivingArmorRegistrar
attributeMap.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(uuid, "Damage Modifier 3", upgrade.getBonusValue("damage", level).doubleValue(), AttributeModifier.Operation.ADDITION));
}));
public static final LivingUpgradeRegistryObject<LivingUpgrade> UPGRADE_REPAIR = UPGRADES.register("repair", () -> parseDefinition("repair"));

public static final LivingUpgradeRegistryObject<LivingUpgrade> UPGRADE_GILDED = UPGRADES.register("gilded", () -> parseDefinition("gilded"));
public static final LivingUpgradeRegistryObject<LivingUpgrade> DOWNGRADE_QUENCHED = UPGRADES.register("downgrade/quenched", () -> parseDefinition("downgrade/quenched").asDowngrade());
public static final LivingUpgradeRegistryObject<LivingUpgrade> DOWNGRADE_STORM_TROOPER = UPGRADES.register("downgrade/storm_trooper", () -> parseDefinition("downgrade/storm_trooper").asDowngrade());
public static final LivingUpgradeRegistryObject<LivingUpgrade> DOWNGRADE_BATTLE_HUNGRY = UPGRADES.register("downgrade/battle_hungry", () -> parseDefinition("downgrade/battle_hungry").asDowngrade());
Expand Down Expand Up @@ -198,6 +199,7 @@ public static void register()
registerUpgrade(UPGRADE_DIAMOND.get());
registerUpgrade(UPGRADE_MELEE_DAMAGE.get());
registerUpgrade(UPGRADE_REPAIR.get());
registerUpgrade(UPGRADE_GILDED.get());
registerUpgrade(DOWNGRADE_QUENCHED.get());
registerUpgrade(DOWNGRADE_STORM_TROOPER.get());
registerUpgrade(DOWNGRADE_BATTLE_HUNGRY.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.target.TargetGoal;
import net.minecraft.world.entity.monster.piglin.Piglin;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.Arrow;
import net.minecraft.world.entity.projectile.ThrowableProjectile;
Expand Down Expand Up @@ -1191,4 +1192,16 @@ public static int getChargeTime(ItemStack stack)
int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.QUICK_CHARGE, stack);
return i == 0 ? 25 : 25 - 5 * i;
}

@SubscribeEvent
public void onEntityInteract(PlayerInteractEvent.EntityInteract event){
if (event.getTarget() instanceof Piglin && event.getItemStack().is(Items.GOLD_INGOT))
{
Player player = event.getEntity();
if (LivingUtil.hasFullSet(player))
{
LivingUtil.applyNewExperience(player, LivingArmorRegistrar.UPGRADE_GILDED.get(), 1);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Gilded",
"icon": "minecraft:golden_chestplate",
"category": "bloodmagic:alchemy_array/living_equipment/armor_upgrades",
"pages": [
{
"type": "patchouli:text",
"text": "Effect: Passivises Piglins as if you were wearing Golden Armor.$(br2)Trained by: Giving a Piglin a $(item)Gold Ingot$(). You must give it to them directly, it cannot be dropped on the ground.$(br2)Maximum level: 1"
},
{
"type": "bloodmagic:living_armour_upgrade_table",
"upgrade": "bloodmagic:gilded"
}
]
}
6 changes: 6 additions & 0 deletions src/main/resources/data/bloodmagic/living_armor/gilded.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "bloodmagic:gilded",
"levels": [
{ "xp": 1, "cost": 5 }
]
}

0 comments on commit 0efe7f2

Please sign in to comment.