generated from Team-Abode/abode-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
233 additions
and
365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 3 additions & 7 deletions
10
src/main/java/com/teamabode/guarding/common/enchantment/GuardingEnchantment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
package com.teamabode.guarding.common.enchantment; | ||
|
||
import com.teamabode.guarding.Guarding; | ||
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalItemTags; | ||
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags; | ||
import net.minecraft.world.entity.EquipmentSlot; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.ShieldItem; | ||
import net.minecraft.world.item.enchantment.Enchantment; | ||
|
||
public class GuardingEnchantment extends Enchantment { | ||
|
||
public GuardingEnchantment(Rarity rarity) { | ||
super(rarity, Guarding.GUARDING_SHIELD, new EquipmentSlot[]{EquipmentSlot.MAINHAND}); | ||
} | ||
|
||
public boolean canEnchant(ItemStack stack) { | ||
return stack.is(ConventionalItemTags.SHIELDS) || stack.getItem() instanceof ShieldItem; | ||
public GuardingEnchantment(int weight, int maxLevel, Cost minCost, Cost maxCost, int anvilCost) { | ||
super(Enchantment.definition(Guarding.SHIELD_ENCHANTABLE, weight, maxLevel, minCost, maxCost, anvilCost, EquipmentSlot.MAINHAND)); | ||
} | ||
} |
16 changes: 3 additions & 13 deletions
16
src/main/java/com/teamabode/guarding/common/enchantment/PummelingEnchantment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,10 @@ | ||
package com.teamabode.guarding.common.enchantment; | ||
|
||
import net.minecraft.world.item.enchantment.Enchantment; | ||
|
||
public class PummelingEnchantment extends GuardingEnchantment { | ||
|
||
public PummelingEnchantment() { | ||
super(Rarity.COMMON); | ||
} | ||
|
||
public int getMinCost(int level) { | ||
return level * 10; | ||
} | ||
|
||
public int getMaxCost(int level) { | ||
return this.getMinCost(level) + 30; | ||
} | ||
|
||
public int getMaxLevel() { | ||
return 3; | ||
super(5, 3, Enchantment.dynamicCost(10, 10), Enchantment.dynamicCost(60, 10), 4); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 16 additions & 13 deletions
29
src/main/java/com/teamabode/guarding/common/item/NetheriteShieldItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,52 @@ | ||
package com.teamabode.guarding.common.item; | ||
|
||
import com.google.common.base.Suppliers; | ||
import com.google.common.collect.ImmutableMultimap; | ||
import com.google.common.collect.Multimap; | ||
import com.teamabode.guarding.core.init.GuardingSounds; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.sounds.SoundEvent; | ||
import net.minecraft.world.entity.EquipmentSlot; | ||
import net.minecraft.world.entity.EquipmentSlotGroup; | ||
import net.minecraft.world.entity.ai.attributes.Attribute; | ||
import net.minecraft.world.entity.ai.attributes.AttributeModifier; | ||
import net.minecraft.world.entity.ai.attributes.Attributes; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.item.ShieldItem; | ||
import net.minecraft.world.item.component.ItemAttributeModifiers; | ||
|
||
import java.util.UUID; | ||
import java.util.function.Supplier; | ||
|
||
public class NetheriteShieldItem extends ShieldItem { | ||
private static final UUID MODIIFER_UUID = UUID.fromString("8b128327-f878-4e94-ada2-707cd81b13af"); | ||
private final Multimap<Attribute, AttributeModifier> defaultModifiers; | ||
private final Supplier<ItemAttributeModifiers> defaultModifiers; | ||
|
||
public NetheriteShieldItem(Properties properties) { | ||
super(properties); | ||
|
||
ImmutableMultimap.Builder<Attribute, AttributeModifier> builder = ImmutableMultimap.builder(); | ||
|
||
|
||
builder.put(Attributes.KNOCKBACK_RESISTANCE, new AttributeModifier(NetheriteShieldItem.MODIIFER_UUID, "Shield modifier", 0.1d, AttributeModifier.Operation.ADDITION)); | ||
this.defaultModifiers = builder.build(); | ||
this.defaultModifiers = Suppliers.memoize(() -> { | ||
ItemAttributeModifiers.Builder builder = ItemAttributeModifiers.builder(); | ||
builder.add(Attributes.KNOCKBACK_RESISTANCE, new AttributeModifier(MODIIFER_UUID, "Shield modifier", 0.1d, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.OFFHAND); | ||
return builder.build(); | ||
}); | ||
} | ||
|
||
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot slot) { | ||
if (slot == EquipmentSlot.OFFHAND) { | ||
return this.defaultModifiers; | ||
} | ||
return super.getDefaultAttributeModifiers(slot); | ||
@Override | ||
public ItemAttributeModifiers getDefaultAttributeModifiers() { | ||
return this.defaultModifiers.get(); | ||
} | ||
|
||
public int getEnchantmentValue() { | ||
return 15; | ||
} | ||
|
||
public SoundEvent getEquipSound() { | ||
public Holder<SoundEvent> getEquipSound() { | ||
return GuardingSounds.ITEM_NETHERITE_SHIELD_EQUIP; | ||
} | ||
|
||
public boolean isValidRepairItem(ItemStack stack, ItemStack repairCandidate) { | ||
return repairCandidate.is(Items.NETHERITE_INGOT) || super.isValidRepairItem(stack, repairCandidate); | ||
return repairCandidate.is(Items.NETHERITE_INGOT); | ||
} | ||
} |
Oops, something went wrong.