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
47 changed files
with
549 additions
and
235 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
### Gameplay Changes | ||
* Netherite Shield enchantability has been reduced. `20 -> 15` | ||
* Barbed durability damage has been reduced. `2 -> 1` | ||
* Barbed success chance has been increased. `20% -> 33%` | ||
|
||
### Config Changes | ||
* The enchantability of the Shield and Netherite Shield have been made configurable. | ||
* Configurations for Pummeling and Barbed and projectile deflection strength have been removed. | ||
|
||
### Technical Changes | ||
Guarding now uses 1.21's data driven enchantments, for this reason, several configurations were removed in favor of this new system. | ||
|
||
Added 3 new enchantment effect components: | ||
|
||
`guarding:shield_blocked`: Effects applying after an attack is blocked. | ||
* Condition Context: Damage Parameters | ||
* Effect: Entity Effect | ||
* Additional fields: | ||
- `cancel_on_parry`: When true, stops the effects from being applied when a parry is landed | ||
- `affected`: A specifier for whom the effect is applied to. Possible values are `attacker`, `damaging_entity`, and `victim` | ||
|
||
`guarding:shield_parried`: Effects applying after an attack is parried. | ||
* Condition Context: Damage Parameters | ||
* Effect: Entity Effect | ||
* Additional fields: | ||
- `affected`: A specifier for whom the effect is applied to. Possible values are `attacker`, `damaging_entity`, and `victim` | ||
|
||
`guarding:shield_knockback`: Effects for the amount of knockback to deal when an attack is blocked. | ||
* Condition Context: Damage Parameters | ||
* Effect: Value Effect |
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,33 +1,31 @@ | ||
package com.teamabode.guarding; | ||
|
||
import com.teamabode.guarding.core.init.*; | ||
import com.teamabode.guarding.core.registry.*; | ||
import com.teamabode.guarding.core.util.ShieldUtils; | ||
import com.teamabode.sketch.core.api.config.ConfigManager; | ||
import com.teamabode.sketch.core.api.event.ShieldEvents; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.tags.TagKey; | ||
import net.minecraft.world.item.Item; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class Guarding implements ModInitializer { | ||
public static final String MOD_ID = "guarding"; | ||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); | ||
|
||
public static final TagKey<Item> SHIELD_ENCHANTABLE = TagKey.create(Registries.ITEM, id("enchantable/shield")); | ||
|
||
public void onInitialize() { | ||
GuardingItems.init(); | ||
GuardingEnchantments.init(); | ||
GuardingEnchantmentEffects.init(); | ||
GuardingSounds.init(); | ||
GuardingParticles.init(); | ||
GuardingCallbacks.init(); | ||
GuardingCritieriaTriggers.init(); | ||
GuardingRecipeSerializers.init(); | ||
|
||
ShieldEvents.BLOCKED.register(ShieldUtils::onBlocked); | ||
ConfigManager.INSTANCE.register(GuardingConfig.INSTANCE); | ||
} | ||
|
||
public static ResourceLocation id(String name) { | ||
return new ResourceLocation(MOD_ID, name); | ||
return ResourceLocation.fromNamespaceAndPath(MOD_ID, name); | ||
} | ||
} |
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
9 changes: 0 additions & 9 deletions
9
src/main/java/com/teamabode/guarding/common/enchantment/BarbedEnchantment.java
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
src/main/java/com/teamabode/guarding/common/enchantment/BlockedConditionalEffect.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.teamabode.guarding.common.enchantment; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import net.minecraft.world.item.enchantment.ConditionalEffect; | ||
import net.minecraft.world.item.enchantment.EnchantmentTarget; | ||
import net.minecraft.world.level.storage.loot.LootContext; | ||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; | ||
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; | ||
|
||
import java.util.Optional; | ||
|
||
public record BlockedConditionalEffect<T>(EnchantmentTarget affected, T effect, boolean cancelOnParry, Optional<LootItemCondition> requirements) { | ||
|
||
public static <S> Codec<BlockedConditionalEffect<S>> parriedCodec(Codec<S> codec, LootContextParamSet contextSet) { | ||
return RecordCodecBuilder.create(instance -> instance.group( | ||
EnchantmentTarget.CODEC.fieldOf("affected").forGetter(BlockedConditionalEffect::affected), | ||
codec.fieldOf("effect").forGetter(BlockedConditionalEffect::effect), | ||
ConditionalEffect.conditionCodec(contextSet).optionalFieldOf("requirements").forGetter(BlockedConditionalEffect::requirements) | ||
).apply(instance, (affected, effect, requirements) -> new BlockedConditionalEffect<>(affected, effect, false, requirements))); | ||
} | ||
|
||
public static <S> Codec<BlockedConditionalEffect<S>> codec(Codec<S> codec, LootContextParamSet contextSet) { | ||
return RecordCodecBuilder.create(instance -> instance.group( | ||
EnchantmentTarget.CODEC.fieldOf("affected").forGetter(BlockedConditionalEffect::affected), | ||
codec.fieldOf("effect").forGetter(BlockedConditionalEffect::effect), | ||
Codec.BOOL.fieldOf("cancel_on_parry").forGetter(BlockedConditionalEffect::cancelOnParry), | ||
ConditionalEffect.conditionCodec(contextSet).optionalFieldOf("requirements").forGetter(BlockedConditionalEffect::requirements) | ||
).apply(instance, BlockedConditionalEffect::new)); | ||
} | ||
|
||
public boolean matches(LootContext lootContext) { | ||
return this.requirements.map(lootItemCondition -> lootItemCondition.test(lootContext)).orElse(true); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/teamabode/guarding/common/enchantment/EnchantmentConsumer.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.teamabode.guarding.common.enchantment; | ||
|
||
import net.minecraft.core.Holder; | ||
import net.minecraft.world.item.enchantment.Enchantment; | ||
|
||
@FunctionalInterface | ||
public interface EnchantmentConsumer { | ||
void accept(Holder<Enchantment> holder, int level); | ||
} |
10 changes: 0 additions & 10 deletions
10
src/main/java/com/teamabode/guarding/common/enchantment/PummelingEnchantment.java
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/main/java/com/teamabode/guarding/common/enchantment/ShieldEnchantment.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.