Skip to content

Commit

Permalink
Abilities (Beta)
Browse files Browse the repository at this point in the history
  • Loading branch information
MC-datapack committed Feb 5, 2025
1 parent b9659dd commit dda110e
Show file tree
Hide file tree
Showing 18 changed files with 255 additions and 25 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.21.1+build.3
loader_version=0.16.7

# Mod Properties
mod_version=7.4
mod_version=8.0
maven_group=github.mcdatapack.more_tools_and_armor
archives_base_name=more_tools_and_armor

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2025-01-19T19:56:47.7636235 More Tools and Armor/Model Definitions
// 1.21.1 2025-02-03T17:14:03.8824931 More Tools and Armor/Model Definitions
bfadc3cbf1da8708fce07c45325e927983065a2c assets\more_tools_and_armor\models\item\copper_paxel.json
55d0901fb474b34e53b47fd858dfec2208eb7beb assets\more_tools_and_armor\models\item\deepslate_emerald_leggings.json
d5b73932607cd6421fab7ddd52bdbd8561660400 assets\more_tools_and_armor\models\item\golden_paxel.json
Expand Down Expand Up @@ -30,8 +30,8 @@ cfd0ee310d1106235ff1bcb07cdd16fb807c9522 assets\more_tools_and_armor\models\bloc
2c818a39a0858406580de95293cd31f7893ce2a5 assets\more_tools_and_armor\models\item\deepslate_emerald.json
61f3ff1fe1ed7ae224b5ecb27807ccb734773662 assets\more_tools_and_armor\models\item\budding_amethyst_leggings.json
c8308fe18117e844979cc92c40222f07d2a57ad8 assets\more_tools_and_armor\blockstates\end_diamond_block.json
2a07c628715d58524da2df8843a0d0684d2dc1cb assets\more_tools_and_armor\blockstates\end_gold_ore.json
99a688badefb2154a8752b44d51a22c7fd39bfd3 assets\more_tools_and_armor\models\item\netherite_paxel.json
2a07c628715d58524da2df8843a0d0684d2dc1cb assets\more_tools_and_armor\blockstates\end_gold_ore.json
598eadc34858ef157c2f2ca1b073e86050697cb6 assets\more_tools_and_armor\models\item\void_boots.json
4f278db7939dd3f43375ea3e881a4036a7429b29 assets\more_tools_and_armor\models\item\oled_helmet.json
a1fa5500142cd98202a031417cf8d3383d89a3fa assets\more_tools_and_armor\models\item\deepslate_emerald_axe.json
Expand All @@ -45,8 +45,8 @@ ee2efdd46013901baf30fe88dee878ca773c7c9c assets\more_tools_and_armor\models\item
69befff695cb1eaabb22c0f9f02f27a87664c28e assets\more_tools_and_armor\models\item\oled_pickaxe.json
d5c40addfbcc1df298302aeee4c4a52d0d059a0b assets\more_tools_and_armor\models\item\onethdenderite_axe.json
d010409d38ce3686f662a15b3e010bd2b3535647 assets\more_tools_and_armor\models\item\oled_leggings.json
d223256062471beb2d4c052c7f91edcec43686bb assets\more_tools_and_armor\blockstates\blackstone_emerald_block.json
918c205838b5b4a25656455bc95648c878de36b3 assets\more_tools_and_armor\models\item\wooden_paxel.json
d223256062471beb2d4c052c7f91edcec43686bb assets\more_tools_and_armor\blockstates\blackstone_emerald_block.json
77ec50c41c7b77b58b5e67176d23cec43e54a521 assets\more_tools_and_armor\models\item\end_emerald_ore.json
c2ab91057469c6c265843f3474e489950696c12d assets\more_tools_and_armor\models\item\copper_helmet.json
92b0ed4d04a9b345f92ffbf41a15396233a6bd24 assets\more_tools_and_armor\models\item\obsidian_chestplate.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2025-01-19T19:56:47.7646236 More Tools and Armor/World Generator
// 1.21.1 2025-02-03T17:14:03.8834927 More Tools and Armor/World Generator
ba4a3d02660a4b35609467e66050316855075971 data\more_tools_and_armor\worldgen\configured_feature\end_diamond_ore.json
2e3896c37dac17b5e03a8c033309e0f62c7ce5a5 data\more_tools_and_armor\worldgen\placed_feature\end_iron_ore.json
3cafae5754ee15fcf3db661feebde3439b35bd71 data\more_tools_and_armor\worldgen\placed_feature\end_lapis_lazuli_ore.json
Expand All @@ -8,13 +8,13 @@ ba4a3d02660a4b35609467e66050316855075971 data\more_tools_and_armor\worldgen\conf
83cad043608778457e26ea0224fa10c2ebdd0110 data\more_tools_and_armor\worldgen\configured_feature\blackstone_emerald_ore.json
b2ff528f5dbd7b529f3ce1ef51092cfb5d3c997b data\more_tools_and_armor\worldgen\placed_feature\end_coal_ore.json
77ef71f2b91096f2705bef27689ebee713949c01 data\more_tools_and_armor\worldgen\placed_feature\end_diamond_ore.json
b7da8e0186661e5195f99de07ddd9b1668031301 data\more_tools_and_armor\worldgen\placed_feature\end_gold_ore.json
b3ed81a59041b7c691813bf668dd6108ac70fdec data\more_tools_and_armor\worldgen\placed_feature\end_redstone_ore.json
e513b48c685d5ba9a3dc9806604010a94db62284 data\more_tools_and_armor\worldgen\placed_feature\sculk_emerald_ore.json
b3ed81a59041b7c691813bf668dd6108ac70fdec data\more_tools_and_armor\worldgen\placed_feature\end_redstone_ore.json
b7da8e0186661e5195f99de07ddd9b1668031301 data\more_tools_and_armor\worldgen\placed_feature\end_gold_ore.json
e2422cb3c0faa69ad47428ae006862b276221860 data\more_tools_and_armor\worldgen\configured_feature\end_redstone_ore.json
24f0fad0871f4047bf76962af0a7d04e8a2490f8 data\more_tools_and_armor\worldgen\placed_feature\end_emerald_ore.json
b800f10b3e031ba100daad42b389a597bb291f71 data\more_tools_and_armor\worldgen\configured_feature\sculk_emerald_ore.json
53c80e51d2e7922d979dd48692232db23c3d3e81 data\more_tools_and_armor\worldgen\configured_feature\end_coal_ore.json
b800f10b3e031ba100daad42b389a597bb291f71 data\more_tools_and_armor\worldgen\configured_feature\sculk_emerald_ore.json
b71cd95c5e29be6a02190c62264d9589f9e0c9a1 data\more_tools_and_armor\worldgen\configured_feature\end_copper_ore.json
7ca72d3d6a48cc1d7dd54791c4f74ea00498ea65 data\more_tools_and_armor\worldgen\configured_feature\end_gold_ore.json
84927bdc2d0806486576e18351b965d51cc7bf2c data\more_tools_and_armor\worldgen\configured_feature\end_iron_ore.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 1.21.1 2025-01-19T19:56:47.765623 More Tools and Armor/Tags for minecraft:item
// 1.21.1 2025-02-03T17:14:03.8844929 More Tools and Armor/Tags for minecraft:item
009937ca4540f639f0ddb674a89445d2694f6d24 data\minecraft\tags\item\axes.json
82bb69039e14eec62f6a5c18e4b5d98e945104dc data\minecraft\tags\item\chest_armor.json
97527fad2414d3bc93a5fc4625aa2d1686440206 data\more_tools_and_armor\tags\item\enderman_passive_armor.json
8fd2e586820f6ef5060bf1b84783fe571754000c data\minecraft\tags\item\leg_armor.json
bf84011b91a9751f6d4f6050a2886801e797de6f data\minecraft\tags\item\hoes.json
58cb5609a7d35d5ac89565f8851df8cc9dffb3e3 data\minecraft\tags\item\shovels.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2025-01-19T19:56:47.7596242 More Tools and Armor/Tags for minecraft:block
// 1.21.1 2025-02-03T17:14:03.8784933 More Tools and Armor/Tags for minecraft:block
d87bd540822fe6fe9b31edfc7f285021b5d5d83c data\more_tools_and_armor\tags\block\needs_deepslate_emerald_tool.json
35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data\more_tools_and_armor\tags\block\incorrect_for_end_diamond_tool.json
f2ade6868691dd545f2e305d3efccbc2f55ae809 data\minecraft\tags\block\incorrect_for_stone_tool.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2025-01-19T19:56:47.761623 More Tools and Armor/Recipes
// 1.21.1 2025-02-03T17:14:03.8794932 More Tools and Armor/Recipes
44119db4e4161fe83a0f9455fbc3ca568341b1a2 data\more_tools_and_armor\advancement\recipes\tools\copper_boots.json
f8ab1c710b86eba9d5986ffb342a7189a33d13ad data\more_tools_and_armor\advancement\recipes\tools\obsidian_chestplate.json
ab433be35b0956b59af74bb8b07c109d4682898f data\more_tools_and_armor\advancement\recipes\tools\copper_helmet.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"more_tools_and_armor:end_diamond_helmet"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,68 +2,71 @@

import github.mcdatapack.more_tools_and_armor.init.ItemInit;
import github.mcdatapack.more_tools_and_armor.list.TagList;
import github.mcdatapack.more_tools_and_armor.util.MoreToolsAndArmorToolMaterial;
import net.minecraft.block.Block;
import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.TagKey;

public enum ToolMaterials implements ToolMaterial {
public enum ToolMaterials implements MoreToolsAndArmorToolMaterial {
//DEV NOTE 14w34a = 14, w->23->2+3, 34->3+4, a->1
//DEV NOTE 14571(10) -> 431241(5)
//DEV NOTE PI 31415926535897932384626433832795
//DEV NOTE PI 3.1415926535897932384626433832795
BUDDING_AMETHYST(
500, 7F, 1F, BlockTags.INCORRECT_FOR_IRON_TOOL, 12,
Ingredient.ofItems(ItemInit.BUDDING_AMETHYST_CRYSTAL)
Ingredient.ofItems(ItemInit.BUDDING_AMETHYST_CRYSTAL), 1.5F, 1.5F
),
COPPER(
121, 6F, 1F, BlockTags.INCORRECT_FOR_STONE_TOOL, 18,
Ingredient.ofItems(Items.COPPER_INGOT)
Ingredient.ofItems(Items.COPPER_INGOT), 1, 1
),
EMERALD(
375, 6.5F, 1F, BlockTags.INCORRECT_FOR_IRON_TOOL, 14,
Ingredient.ofItems(Items.EMERALD)
Ingredient.ofItems(Items.EMERALD), 1.25F, 1.25F
),
OBSIDIAN(
1831, 8.5F, 1F, BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 10,
Ingredient.ofItems(Items.OBSIDIAN)
Ingredient.ofItems(Items.OBSIDIAN), 4, 2.5F
),
DEEPSLATE_EMERALD(
14571, 40F, 1F, TagList.BlockTags.INCORRECT_FOR_DEEPSLATE_EMERALD_TOOL, 100,
Ingredient.ofItems(ItemInit.DEEPSLATE_EMERALD)
Ingredient.ofItems(ItemInit.DEEPSLATE_EMERALD), 10, 7.5F
),
END_DIAMOND(
24581, 80F, 1F, TagList.BlockTags.INCORRECT_FOR_END_DIAMOND_TOOL, 100,
Ingredient.ofItems(ItemInit.END_DIAMOND)
Ingredient.ofItems(ItemInit.END_DIAMOND), 25, 15
),
VOID(
431241, 256F, 1F, TagList.BlockTags.INCORRECT_FOR_VOID_TOOL, 100,
Ingredient.ofItems(ItemInit.VOID_INGOT)
Ingredient.ofItems(ItemInit.VOID_INGOT), 40, 30
),
ONETHDENDERITE(
3141592, 1256F, 1F, TagList.BlockTags.INCORRECT_FOR_ONETHDENDERITE_TOOL, 100,
Ingredient.ofItems(ItemInit.ONETHDENDERITE_INGOT)
Ingredient.ofItems(ItemInit.ONETHDENDERITE_INGOT), 100, 75
),
OLED(
Integer.MAX_VALUE, 3141F, 1F, TagList.BlockTags.INCORRECT_FOR_OLED_TOOL, 100,
Ingredient.ofItems(ItemInit.OLED_INGOT)
Ingredient.ofItems(ItemInit.OLED_INGOT), 100, 100
);

private final int durability;
private final float miningSpeedMultiplier, attackDamage;
private final float miningSpeedMultiplier, attackDamage, maceEffectMultiplier, bowDamageMultiplier;
private final TagKey<Block> inverseTag;
private final int enchantability;
private final Ingredient repairIngredient;

ToolMaterials(int durability, float miningSpeedMultiplier, float attackDamage, TagKey<Block> inverseTag, int enchantability,
Ingredient repairIngredient) {
Ingredient repairIngredient, float maceEffectMultiplier, float bowDamageMultiplier) {
this.durability = durability;
this.miningSpeedMultiplier = miningSpeedMultiplier;
this.attackDamage = attackDamage;
this.inverseTag = inverseTag;
this.enchantability = enchantability;
this.repairIngredient = repairIngredient;
this.maceEffectMultiplier = maceEffectMultiplier;
this.bowDamageMultiplier = bowDamageMultiplier;
}

@Override
Expand Down Expand Up @@ -95,4 +98,14 @@ public int getEnchantability() {
public Ingredient getRepairIngredient() {
return this.repairIngredient;
}

@Override
public float getMaceEffectMultiplier() {
return maceEffectMultiplier;
}

@Override
public float getBowDamageMultiplier() {
return bowDamageMultiplier;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import github.mcdatapack.more_tools_and_armor.MoreToolsAndArmor;
import github.mcdatapack.more_tools_and_armor.enums.ToolMaterials;
import github.mcdatapack.more_tools_and_armor.item.PaxelItem;
import github.mcdatapack.more_tools_and_armor.item.*;
import net.minecraft.item.*;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
Expand Down Expand Up @@ -77,6 +77,11 @@ public class ItemInit {
.attributeModifiers(PaxelItem.createAttributeModifiers(ToolMaterials.OLED, 100, 0))
.fireproof().rarity(Rarity.EPIC)));

public static final MoreToolsAndArmorBowItem OLED_BOW = register("oled_bow", new MoreToolsAndArmorBowItem(ToolMaterials.OLED, new Item.Settings()));
public static final MoreToolsAndArmorFlintAndSteelItem OLED_FLINT_AND_STEEL = register("oled_flint_and_steel", new MoreToolsAndArmorFlintAndSteelItem(ToolMaterials.OLED, new Item.Settings()));
public static final MoreToolsAndArmorShearsItem OLED_SHEARS = register("oled_shears", new MoreToolsAndArmorShearsItem(ToolMaterials.OLED, new Item.Settings()));
public static final MoreToolsAndArmorMaceItem OLED_MACE = register("oled_mace", new MoreToolsAndArmorMaceItem(ToolMaterials.OLED, new Item.Settings()));

//Budding Amethyst
public static final SwordItem BUDDING_AMETHYST_SWORD = register("budding_amethyst_sword", new SwordItem(ToolMaterials.BUDDING_AMETHYST, new Item.Settings()
.attributeModifiers(SwordItem.createAttributeModifiers(ToolMaterials.BUDDING_AMETHYST, 5, -2.4F))));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package github.mcdatapack.more_tools_and_armor.item;

import net.minecraft.item.FlintAndSteelItem;
import net.minecraft.item.ToolMaterial;

public class MoreToolsAndArmorFlintAndSteelItem extends FlintAndSteelItem {
public MoreToolsAndArmorFlintAndSteelItem(ToolMaterial material, Settings settings) {
super(settings.maxDamage(material.getDurability()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package github.mcdatapack.more_tools_and_armor.item;

import net.minecraft.block.Blocks;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.ToolComponent;
import net.minecraft.item.ShearsItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.tag.BlockTags;

import java.util.List;

public class MoreToolsAndArmorShearsItem extends ShearsItem {
public MoreToolsAndArmorShearsItem(ToolMaterial material, Settings settings) {
super(settings.maxDamage(material.getDurability()).component(DataComponentTypes.TOOL, createBetterToolComponent(material)));
}

private static ToolComponent createBetterToolComponent(ToolMaterial material) {
return new ToolComponent(
List.of(
ToolComponent.Rule.ofAlwaysDropping(List.of(Blocks.COBWEB), material.getMiningSpeedMultiplier() * 15.0F),
ToolComponent.Rule.of(BlockTags.LEAVES, material.getMiningSpeedMultiplier() * 15.0F),
ToolComponent.Rule.of(BlockTags.WOOL, material.getMiningSpeedMultiplier() * 5.0F),
ToolComponent.Rule.of(List.of(Blocks.VINE, Blocks.GLOW_LICHEN), material.getMiningSpeedMultiplier() * 2.0F)
),
1.0F,
1
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import github.mcdatapack.more_tools_and_armor.MoreToolsAndArmor;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;

Expand All @@ -20,5 +21,6 @@ private static TagKey<Block> register(String path) {
return TagKey.of(RegistryKeys.BLOCK, MoreToolsAndArmor.id(path));
}
}

public static class ItemTags {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package github.mcdatapack.more_tools_and_armor.mixns.ability;

import github.mcdatapack.more_tools_and_armor.util.Abilities;
import net.minecraft.entity.mob.EndermanEntity;
import net.minecraft.entity.player.PlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(EndermanEntity.class)
public class EndermanEntityMixin {
@Inject(method = "isPlayerStaring", at = @At("RETURN"), cancellable = true)
private void isPlayerStaring(PlayerEntity player, CallbackInfoReturnable<Boolean> cir) {
if (cir.getReturnValue()) {
if (Abilities.isWearingEndermanSaveArmor(player)) {
cir.setReturnValue(false);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package github.mcdatapack.more_tools_and_armor.mixns.ability;

import github.mcdatapack.more_tools_and_armor.util.Abilities;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.PiglinBrain;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(PiglinBrain.class)
public abstract class PiglinBrainMixin {
@Inject(method = "wearsGoldArmor", at = @At("RETURN"), cancellable = true)
private static void wearsGoldArmor(LivingEntity entity, CallbackInfoReturnable<Boolean> cir) {
if (!cir.getReturnValue()) {
if (Abilities.isWearingPiglinSaveArmor(entity)) {
cir.setReturnValue(true);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package github.mcdatapack.more_tools_and_armor.mixns.ability;

import github.mcdatapack.more_tools_and_armor.util.Abilities;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.TargetPredicate;
import net.minecraft.entity.mob.AbstractPiglinEntity;
import net.minecraft.entity.mob.EndermanEntity;
import net.minecraft.entity.mob.ZombifiedPiglinEntity;
import net.minecraft.entity.passive.IronGolemEntity;
import net.minecraft.entity.player.PlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(TargetPredicate.class)
public class TargetPredicateMixin {
@Inject(method = "test", at = @At("RETURN"), cancellable = true)
private void canTarget(LivingEntity baseEntity, LivingEntity targetEntity, CallbackInfoReturnable<Boolean> cir) {
if (baseEntity instanceof IronGolemEntity ironGolem && targetEntity instanceof PlayerEntity player) {
if (Abilities.isWearingIronGolemPassiveArmor(player)) {
cir.setReturnValue(false);
}
}
if ((baseEntity instanceof AbstractPiglinEntity piglinEntity || baseEntity instanceof ZombifiedPiglinEntity zombifiedPiglinEntity) && targetEntity instanceof PlayerEntity player) {
if (Abilities.isWearingPiglinPassiveArmor(player)) {
cir.setReturnValue(false);
}
}
if (baseEntity instanceof EndermanEntity endermanEntity && targetEntity instanceof PlayerEntity player) {
if (Abilities.isWearingEndermanPassiveArmor(player)) {
cir.setReturnValue(false);
}
}
}
}
Loading

0 comments on commit dda110e

Please sign in to comment.