From 30f29726c641810754460503609191ee2e10e662 Mon Sep 17 00:00:00 2001 From: chronosacaria Date: Sun, 15 Dec 2024 18:25:27 -0500 Subject: [PATCH] 1.21 Update 3 - Major refactor of artefacts to accomodate config optimisations and updates - Broke out some of the necessary code for Fabric and NeoForge - Converted Mixins that could be Events to Events - Removed files that were no longer needed - Updated fzzyconfig to 0.5.9 - Changed to fzzy's maven for fzzyconfig --- build.gradle | 4 + common/build.gradle | 5 +- .../java/dev/timefall/mcdar/McdarCommon.java | 4 +- .../java/dev/timefall/mcdar/ModConstants.java | 4 +- .../dev/timefall/mcdar/api/AOEHelper.java | 2 +- .../dev/timefall/mcdar/api/AbilityHelper.java | 3 + .../timefall/mcdar/api/CleanlinessHelper.java | 56 ++------- .../mcdar/api/GroupedObjectsHelper.java | 70 +---------- .../timefall/mcdar/api/SummoningHelper.java | 2 +- .../mcdar/artifacts/ArtifactAgilityItem.java | 10 -- .../mcdar/artifacts/ArtifactDamagingItem.java | 10 -- .../artifacts/ArtifactDefensiveItem.java | 10 -- .../mcdar/artifacts/ArtifactItem.java | 17 +++ .../mcdar/artifacts/ArtifactQuiverItem.java | 10 -- .../ArtifactStatusInflictingItem.java | 10 -- .../artifacts/ArtifactSummoningItem.java | 10 -- .../mcdar/artifacts/BlastFungusItem.java | 17 ++- .../mcdar/artifacts/BootsOfSwiftnessItem.java | 13 +-- .../mcdar/artifacts/BuzzyNestItem.java | 11 +- .../mcdar/artifacts/CorruptedSeedsItem.java | 17 ++- .../mcdar/artifacts/DeathCapMushroomItem.java | 15 ++- .../mcdar/artifacts/EnchantedGrassItem.java | 9 +- .../mcdar/artifacts/EnchantersTomeItem.java | 13 +-- .../mcdar/artifacts/FlamingQuiverItem.java | 9 +- .../mcdar/artifacts/GhostCloakItem.java | 17 ++- .../mcdar/artifacts/GolemKitItem.java | 11 +- .../mcdar/artifacts/GongOfWeakeningItem.java | 17 ++- .../mcdar/artifacts/HarpoonQuiverItem.java | 9 +- .../mcdar/artifacts/HarvesterItem.java | 15 ++- .../mcdar/artifacts/IronHideAmuletItem.java | 13 +-- .../mcdar/artifacts/LightFeatherItem.java | 24 ++-- .../mcdar/artifacts/LightningRodItem.java | 9 +- .../mcdar/artifacts/LoveMedallionItem.java | 16 ++- .../mcdar/artifacts/PowershakerItem.java | 7 +- .../artifacts/SatchelOfElementsItem.java | 23 ++-- .../mcdar/artifacts/SatchelOfElixirsItem.java | 7 +- .../mcdar/artifacts/SatchelOfSnacksItem.java | 9 +- .../mcdar/artifacts/ShockPowderItem.java | 22 ++-- .../mcdar/artifacts/SoulHealerItem.java | 15 ++- .../mcdar/artifacts/TastyBoneItem.java | 11 +- .../mcdar/artifacts/ThunderingQuiverItem.java | 9 +- .../mcdar/artifacts/TormentQuiverItem.java | 9 +- .../artifacts/TotemOfRegenerationItem.java | 17 ++- .../mcdar/artifacts/TotemOfShieldingItem.java | 20 ++-- .../artifacts/TotemOfSoulProtectionItem.java | 22 ++-- .../mcdar/artifacts/UpdraftTomeItem.java | 13 +-- .../mcdar/artifacts/WindHornItem.java | 13 +-- .../mcdar/artifacts/WonderfulWheatItem.java | 11 +- .../artifact_types/ArtifactAgilityItem.java | 11 ++ .../artifact_types/ArtifactDamagingItem.java | 11 ++ .../artifact_types/ArtifactDefensiveItem.java | 11 ++ .../artifact_types/ArtifactQuiverItem.java | 11 ++ .../ArtifactStatusInflictingItem.java | 11 ++ .../artifact_types/ArtifactSummoningItem.java | 11 ++ .../mcdar/client/SummonedEntityRenderers.java | 4 +- .../config/McdarArtifactsStatsConfig.java | 43 ++++--- .../config/artifact_types/ArtifactStats.java | 40 +++---- .../artifact_types/ComplexArtifactStats.java | 9 +- .../artifact_types/DamageArtifactStats.java | 17 ++- .../ExperienceDrainingArtifactStats.java | 40 +++++-- .../StatusCloudCreatingArtifactStats.java | 11 +- .../StatusGrantingArtifactStats.java | 32 +++-- .../item_sections/AgilityArtifactStats.java | 55 +++++---- .../item_sections/DamagingArtifactStats.java | 62 +++++----- .../item_sections/DefensiveArtifactStats.java | 98 ++++++++-------- .../item_sections/QuiverArtifactStats.java | 28 ++--- .../StatusInflictingArtifactStats.java | 76 ++++++------ .../item_sections/SummoningArtifactStats.java | 22 +--- .../{effects => effect}/ArtifactEffects.java | 25 ++-- .../EnchantmentEffects.java | 6 +- .../BuzzyNestBeeEntity.java | 2 +- .../EnchantedGrassBlueSheepEntity.java | 6 +- .../EnchantedGrassGreenSheepEntity.java | 4 +- .../EnchantedGrassRedSheepEntity.java | 6 +- .../GolemKitGolemEntity.java | 4 +- .../SummonedEntityType.java | 18 +-- .../TastyBoneWolfEntity.java | 6 +- .../WonderfulWheatLlamaEntity.java | 4 +- .../renderers/BuzzyNestBeeRenderer.java | 4 +- .../EnchantedGrassBlueSheepRenderer.java | 4 +- ...ntedGrassBlueSheepWoolFeatureRenderer.java | 4 +- .../EnchantedGrassGreenSheepRenderer.java | 4 +- ...tedGrassGreenSheepWoolFeatureRenderer.java | 4 +- .../EnchantedGrassRedSheepRenderer.java | 4 +- ...antedGrassRedSheepWoolFeatureRenderer.java | 4 +- .../GolemKitGolemCrackFeatureRenderer.java | 4 +- .../renderers/GolemKitGolemRenderer.java | 4 +- .../renderers/TastyBoneWolfRenderer.java | 4 +- ...nderfulWheatLlamaDecorFeatureRenderer.java | 4 +- .../WonderfulWheatLlamaRenderer.java | 4 +- .../{goals => goal}/FollowSummonerGoal.java | 2 +- .../LoveMedallionAttackGoal.java | 2 +- .../TrackSummonerAttackerGoal.java | 2 +- .../timefall/mcdar/mixin/BowItemMixin.java | 2 +- .../DefaultAttributeRegistryAccessor.java | 18 --- .../timefall/mcdar/mixin/ItemStackMixin.java | 23 ---- .../mcdar/mixin/LivingEntityMixin.java | 46 +------- .../timefall/mcdar/mixin/MobEntityMixin.java | 2 +- .../PersistentProjectileEntityMixin.java | 10 +- .../mcdar/mixin/PlayerEntityMixin.java | 10 +- .../mcdar/platform/IPlatformHelper.java | 27 ----- .../timefall/mcdar/platform/ImplLoader.java | 11 -- .../mcdar/registry/ArtifactsRegistry.java | 110 +++++++----------- .../mcdar/registry/EnchantmentRegistry.java | 11 +- .../mcdar/registry/ItemGroupRegistry.java | 79 ++++++------- .../mcdar/registry/StatusEffectRegistry.java | 30 +++-- .../SummonedEntityAttributeRegistry.java | 22 ---- .../registry/SummonedEntityRegistry.java | 76 ++++++------ .../timefall/mcdar/registry/tag/TagKeys.java | 6 +- .../statuseffect/CharmedStatusEffect.java | 10 +- .../statuseffect/ShieldingStatusEffect.java | 8 +- .../SoulProtectionStatusEffect.java | 8 +- .../statuseffect/StunnedStatusEffect.java | 8 +- common/src/main/resources/mcdar.mixins.json | 2 - fabric/build.gradle | 6 +- .../java/dev/timefall/mcdar/McdarFabric.java | 13 ++- .../mcdar/client/McdarClientFabric.java | 2 +- .../SummonedEntityRenderRegistryFabric.java | 20 ++++ .../data/providers/McdarTagProvider.java | 64 +++++----- .../mcdar/event/McdarFabricEvents.java | 61 ++++++++++ .../mcdar/platform/FabricPlatformHelper.java | 21 ---- .../DefaultAttributeRegistryFabric.java | 17 +++ .../registry/ItemGroupRegistryFabric.java | 69 ----------- .../timefall/mcdar/registry/LootRegistry.java | 47 -------- .../mcdar/registry/LootRegistryFabric.java | 58 +++++++++ .../SummonedEntityRenderRegistryFabric.java | 19 --- gradle.properties | 2 +- neoforge/build.gradle | 6 + .../dev/timefall/mcdar/McdarNeoForge.java | 20 +++- .../mcdar/client/McdarNeoForgeClient.java | 14 +++ .../SummonedEntityRenderRegistryNeoForge.java | 18 +++ .../mcdar/event/McdarForgeEventHandler.java | 50 ++++++++ .../DefaultAttributeRegistryNeoForge.java | 17 +++ .../mcdar/services/ForgePlatformHelper.java | 23 ---- 134 files changed, 1144 insertions(+), 1330 deletions(-) delete mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactAgilityItem.java delete mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactDamagingItem.java delete mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactDefensiveItem.java create mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactItem.java delete mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactQuiverItem.java delete mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactStatusInflictingItem.java delete mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactSummoningItem.java create mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactAgilityItem.java create mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactDamagingItem.java create mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactDefensiveItem.java create mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactQuiverItem.java create mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactStatusInflictingItem.java create mode 100644 common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactSummoningItem.java rename common/src/main/java/dev/timefall/mcdar/{effects => effect}/ArtifactEffects.java (76%) rename common/src/main/java/dev/timefall/mcdar/{effects => effect}/EnchantmentEffects.java (97%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/BuzzyNestBeeEntity.java (98%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/EnchantedGrassBlueSheepEntity.java (95%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/EnchantedGrassGreenSheepEntity.java (97%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/EnchantedGrassRedSheepEntity.java (95%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/GolemKitGolemEntity.java (96%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/SummonedEntityType.java (86%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/TastyBoneWolfEntity.java (96%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/WonderfulWheatLlamaEntity.java (96%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/BuzzyNestBeeRenderer.java (93%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/EnchantedGrassBlueSheepRenderer.java (88%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/EnchantedGrassBlueSheepWoolFeatureRenderer.java (96%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/EnchantedGrassGreenSheepRenderer.java (88%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/EnchantedGrassGreenSheepWoolFeatureRenderer.java (96%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/EnchantedGrassRedSheepRenderer.java (88%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/EnchantedGrassRedSheepWoolFeatureRenderer.java (96%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/GolemKitGolemCrackFeatureRenderer.java (95%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/GolemKitGolemRenderer.java (89%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/TastyBoneWolfRenderer.java (94%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/WonderfulWheatLlamaDecorFeatureRenderer.java (94%) rename common/src/main/java/dev/timefall/mcdar/{entities => entity}/renderers/WonderfulWheatLlamaRenderer.java (88%) rename common/src/main/java/dev/timefall/mcdar/{goals => goal}/FollowSummonerGoal.java (98%) rename common/src/main/java/dev/timefall/mcdar/{goals => goal}/LoveMedallionAttackGoal.java (95%) rename common/src/main/java/dev/timefall/mcdar/{goals => goal}/TrackSummonerAttackerGoal.java (98%) delete mode 100644 common/src/main/java/dev/timefall/mcdar/mixin/DefaultAttributeRegistryAccessor.java delete mode 100644 common/src/main/java/dev/timefall/mcdar/mixin/ItemStackMixin.java delete mode 100644 common/src/main/java/dev/timefall/mcdar/platform/IPlatformHelper.java delete mode 100644 common/src/main/java/dev/timefall/mcdar/platform/ImplLoader.java delete mode 100644 common/src/main/java/dev/timefall/mcdar/registry/SummonedEntityAttributeRegistry.java rename fabric/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRegistryFabric.java => common/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRegistry.java (54%) create mode 100644 fabric/src/main/java/dev/timefall/mcdar/client/registry/SummonedEntityRenderRegistryFabric.java create mode 100644 fabric/src/main/java/dev/timefall/mcdar/event/McdarFabricEvents.java delete mode 100644 fabric/src/main/java/dev/timefall/mcdar/platform/FabricPlatformHelper.java create mode 100644 fabric/src/main/java/dev/timefall/mcdar/registry/DefaultAttributeRegistryFabric.java delete mode 100644 fabric/src/main/java/dev/timefall/mcdar/registry/ItemGroupRegistryFabric.java delete mode 100644 fabric/src/main/java/dev/timefall/mcdar/registry/LootRegistry.java create mode 100644 fabric/src/main/java/dev/timefall/mcdar/registry/LootRegistryFabric.java delete mode 100644 fabric/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRenderRegistryFabric.java create mode 100644 neoforge/src/main/java/dev/timefall/mcdar/client/McdarNeoForgeClient.java create mode 100644 neoforge/src/main/java/dev/timefall/mcdar/client/registry/SummonedEntityRenderRegistryNeoForge.java create mode 100644 neoforge/src/main/java/dev/timefall/mcdar/event/McdarForgeEventHandler.java create mode 100644 neoforge/src/main/java/dev/timefall/mcdar/registry/DefaultAttributeRegistryNeoForge.java delete mode 100644 neoforge/src/main/java/dev/timefall/mcdar/services/ForgePlatformHelper.java diff --git a/build.gradle b/build.gradle index 8019791..5c7cbf8 100644 --- a/build.gradle +++ b/build.gradle @@ -70,6 +70,10 @@ allprojects { includeGroup "maven.modrinth" } } + maven { + name = "FzzyMaven" + url = "https://maven.fzzyhmstrs.me/" + } } tasks.withType(JavaCompile).configureEach { diff --git a/common/build.gradle b/common/build.gradle index b5d550e..77d90ab 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -9,10 +9,7 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" //modCompileOnly "dev.emi:emi-xplat-intermediary:${rootProject.emi_version}+${rootProject.minecraft_version}" - modImplementation "maven.modrinth:fzzy-config:${rootProject.fzzyConfigVersion}" - modImplementation("net.fabricmc:fabric-language-kotlin:1.12.1+kotlin.2.0.20") - - + modCompileOnly "me.fzzyhmstrs:fzzy_config:${rootProject.fzzyConfigVersion}" } publishing { diff --git a/common/src/main/java/dev/timefall/mcdar/McdarCommon.java b/common/src/main/java/dev/timefall/mcdar/McdarCommon.java index 4862b72..b235cf4 100644 --- a/common/src/main/java/dev/timefall/mcdar/McdarCommon.java +++ b/common/src/main/java/dev/timefall/mcdar/McdarCommon.java @@ -5,12 +5,10 @@ public class McdarCommon { public static void initialize() { - //CONFIG = AutoConfig.getConfigHolder(McdarConfig.class).getConfig(); ArtifactsRegistry.register(); ItemGroupRegistry.register(); EnchantmentRegistry.register(); StatusEffectRegistry.register(); - SummonedEntityAttributeRegistry.register(); - //SummonedEntityRegistry.register(); + SummonedEntityRegistry.register(); } } diff --git a/common/src/main/java/dev/timefall/mcdar/ModConstants.java b/common/src/main/java/dev/timefall/mcdar/ModConstants.java index 079e459..bb04222 100644 --- a/common/src/main/java/dev/timefall/mcdar/ModConstants.java +++ b/common/src/main/java/dev/timefall/mcdar/ModConstants.java @@ -10,10 +10,10 @@ public class ModConstants { public static final String MOD_ID = "mcdar"; - public static Identifier ID (String path){ + public static Identifier id(String path){ return Identifier.of(MOD_ID, path); } - public static final RegistryKey ARTIFACTS = RegistryKey.of(RegistryKeys.ITEM_GROUP, ModConstants.ID("artifacts")); + public static final RegistryKey ARTIFACTS = RegistryKey.of(RegistryKeys.ITEM_GROUP, ModConstants.id("artifacts")); public static final Logger LOGGER = LogManager.getLogger(MOD_ID); diff --git a/common/src/main/java/dev/timefall/mcdar/api/AOEHelper.java b/common/src/main/java/dev/timefall/mcdar/api/AOEHelper.java index 1b9a4fa..b6b3eab 100644 --- a/common/src/main/java/dev/timefall/mcdar/api/AOEHelper.java +++ b/common/src/main/java/dev/timefall/mcdar/api/AOEHelper.java @@ -157,7 +157,7 @@ public static void satchelOfElementsEffects(PlayerEntity user, float damage, flo afflictNearbyEntities( user, range, - new StatusEffectInstance(RegistryEntry.of(StatusEffectRegistry.STUNNED), duration, amplifier), + new StatusEffectInstance(StatusEffectRegistry.STUNNED.getEntry(), duration, amplifier), new StatusEffectInstance(StatusEffects.NAUSEA, duration, amplifier2), new StatusEffectInstance(StatusEffects.SLOWNESS, duration, amplifier3) ); diff --git a/common/src/main/java/dev/timefall/mcdar/api/AbilityHelper.java b/common/src/main/java/dev/timefall/mcdar/api/AbilityHelper.java index e76cd0d..c06dc9d 100644 --- a/common/src/main/java/dev/timefall/mcdar/api/AbilityHelper.java +++ b/common/src/main/java/dev/timefall/mcdar/api/AbilityHelper.java @@ -24,6 +24,7 @@ public static boolean isPetOf(LivingEntity self, LivingEntity owner){ return false; } + //also could be a tag private static boolean isVillagerOrIronGolem(LivingEntity nearbyEntity) { return (nearbyEntity instanceof VillagerEntity) || (nearbyEntity instanceof IronGolemEntity); } @@ -55,11 +56,13 @@ private static boolean isUnaffectedByAoe(LivingEntity entity) { return false; } + //Recommend making into a tag public static final List SATCHEL_OF_ELIXIRS_LIST = List.of( PotionContentsComponent.createStack(Items.POTION, Potions.STRENGTH), PotionContentsComponent.createStack(Items.POTION, Potions.SWIFTNESS), PotionContentsComponent.createStack(Items.POTION, Potions.INVISIBILITY)); + //recommend making into a tag public static final List SATCHEL_OF_SNACKS_LIST = Collections.unmodifiableList(Arrays.asList( Items.APPLE, Items.BREAD, Items.COOKED_SALMON, Items.COOKED_PORKCHOP, Items.COOKED_MUTTON, Items.COOKED_COD, Items.COOKED_COD, Items.COOKED_RABBIT, Items.COOKED_CHICKEN, Items.COOKED_BEEF, diff --git a/common/src/main/java/dev/timefall/mcdar/api/CleanlinessHelper.java b/common/src/main/java/dev/timefall/mcdar/api/CleanlinessHelper.java index c6e3219..22465d5 100644 --- a/common/src/main/java/dev/timefall/mcdar/api/CleanlinessHelper.java +++ b/common/src/main/java/dev/timefall/mcdar/api/CleanlinessHelper.java @@ -1,6 +1,6 @@ package dev.timefall.mcdar.api; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.client.resource.language.I18n; import net.minecraft.entity.EntityType; import net.minecraft.entity.EquipmentSlot; @@ -8,6 +8,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -148,49 +149,14 @@ public static boolean isCoolingDown(PlayerEntity player, Item item) { ? playerEntity.getOffHandStack() : playerEntity.getMainHandStack(); } -/* - public static int mcdar$artifactIDToItemCooldownTime(Item artifactItem) { - int cooldownLevel = EnchantmentHelper.getLevel(RegistryEntry.of(EnchantsRegistry.COOLDOWN), artifactItem.getDefaultStack()); - if (artifactItem instanceof IArtifactItem) { - for (AgilityArtifactID agilityArtifactID : AgilityArtifactID.values()) - if (artifactItem.asItem() == agilityArtifactID.mcdar$getItem() - && McdarArtifactsStatsConfig.CONFIG.AGILITY_ARTIFACT_STATS.get(agilityArtifactID) - .mcdar$getIsEnabled()) - return McdarArtifactsStatsConfig.CONFIG.AGILITY_ARTIFACT_STATS.get(agilityArtifactID) - .mcdar$getMaxCooldownEnchantmentTime(); - for (DamagingArtifactID damagingArtifactID : DamagingArtifactID.values()) - if (artifactItem.asItem() == damagingArtifactID.mcdar$getItem() - && McdarArtifactsStatsConfig.CONFIG.DAMAGING_ARTIFACT_STATS.get(damagingArtifactID) - .mcdar$getIsEnabled()) - return McdarArtifactsStatsConfig.CONFIG.DAMAGING_ARTIFACT_STATS.get(damagingArtifactID) - .mcdar$getMaxCooldownEnchantmentTime(); - for (DefensiveArtifactID defensiveArtifactID : DefensiveArtifactID.values()) - if (artifactItem.asItem() == defensiveArtifactID.mcdar$getItem() - && McdarArtifactsStatsConfig.CONFIG.DEFENSIVE_ARTIFACT_STATS.get(defensiveArtifactID) - .mcdar$getIsEnabled() && artifactItem.asItem() != DefensiveArtifactID.SOUL_HEALER.mcdar$getItem()) - return McdarArtifactsStatsConfig.CONFIG.DEFENSIVE_ARTIFACT_STATS.get(defensiveArtifactID) - .mcdar$getMaxCooldownEnchantmentTime(); - for (QuiverArtifactID quiverArtifactID : QuiverArtifactID.values()) - if (artifactItem.asItem() == quiverArtifactID.mcdar$getItem() - && McdarArtifactsStatsConfig.CONFIG.QUIVER_ARTIFACT_STATS.get(quiverArtifactID) - .mcdar$getIsEnabled()) - return (cooldownLevel + 1) * McdarArtifactsStatsConfig.CONFIG.QUIVER_ARTIFACT_STATS.get(quiverArtifactID) - .mcdar$getMaxCooldownEnchantmentTime(); - for (StatusInflictingArtifactID statusInflictingArtifactID : StatusInflictingArtifactID.values()) - if (artifactItem.asItem() == statusInflictingArtifactID.mcdar$getItem() - && McdarArtifactsStatsConfig.CONFIG.STATUS_INFLICTING_ARTIFACT_STATS.get(statusInflictingArtifactID) - .mcdar$getIsEnabled()) - return McdarArtifactsStatsConfig.CONFIG.STATUS_INFLICTING_ARTIFACT_STATS.get(statusInflictingArtifactID) - .mcdar$getMaxCooldownEnchantmentTime(); - for (SummoningArtifactID summoningArtifactID : SummoningArtifactID.values()) - if (artifactItem.asItem() == summoningArtifactID.mcdar$getItem() - && McdarArtifactsStatsConfig.CONFIG.SUMMONING_ARTIFACT_STATS.get(summoningArtifactID) - .mcdar$getIsEnabled()) - return McdarArtifactsStatsConfig.CONFIG.SUMMONING_ARTIFACT_STATS.get(summoningArtifactID) - .mcdar$getMaxCooldownEnchantmentTime(); - //} - return 0; - } - */ + @SuppressWarnings("SizeReplaceableByIsEmpty") + public static boolean mcdar$isValidForBeastEffects(List potionEffects) { + return potionEffects.stream().filter( + (instance) -> instance.getEffectType() + == StatusEffects.INSTANT_HEALTH + || instance.getEffectType() + == StatusEffects.REGENERATION + ).toList().size() > 0; + } } diff --git a/common/src/main/java/dev/timefall/mcdar/api/GroupedObjectsHelper.java b/common/src/main/java/dev/timefall/mcdar/api/GroupedObjectsHelper.java index 49288a5..778d26c 100644 --- a/common/src/main/java/dev/timefall/mcdar/api/GroupedObjectsHelper.java +++ b/common/src/main/java/dev/timefall/mcdar/api/GroupedObjectsHelper.java @@ -19,75 +19,7 @@ public class GroupedObjectsHelper { LootTables.VILLAGE_SNOWY_HOUSE_CHEST, LootTables.VILLAGE_TAIGA_HOUSE_CHEST, LootTables.VILLAGE_TANNERY_CHEST, LootTables.VILLAGE_TEMPLE_CHEST, LootTables.VILLAGE_TOOLSMITH_CHEST); + public static final Set> ALL_ARTIFACTS_DUNGEON_LOOT_TABLES = Set.of(LootTables.ABANDONED_MINESHAFT_CHEST, LootTables.SIMPLE_DUNGEON_CHEST, LootTables.SHIPWRECK_TREASURE_CHEST); - - /* - public static final List illagerArtifacts = List.of( - AgilityArtifactID.DEATH_CAP_MUSHROOM, - DamagingArtifactID.BLAST_FUNGUS, - DamagingArtifactID.HARVESTER, - DamagingArtifactID.LIGHTNING_ROD, - DamagingArtifactID.POWERSHAKER, - DefensiveArtifactID.ENCHANTERS_TOME, - DefensiveArtifactID.SOUL_HEALER, - DefensiveArtifactID.TOTEM_OF_REGENERATION, - DefensiveArtifactID.TOTEM_OF_SHIELDING, - DefensiveArtifactID.TOTEM_OF_SOUL_PROTECTION, - QuiverArtifactID.HARPOON_QUIVER, - QuiverArtifactID.THUNDERING_QUIVER, - QuiverArtifactID.TORMENT_QUIVER, - StatusInflictingArtifactID.CORRUPTED_SEEDS, - StatusInflictingArtifactID.GONG_OF_WEAKENING, - StatusInflictingArtifactID.LOVE_MEDALLION, - StatusInflictingArtifactID.SATCHEL_OF_ELEMENTS, - StatusInflictingArtifactID.SHOCK_POWDER - ); - - public static final List villagerArtifacts = List.of( - AgilityArtifactID.BOOTS_OF_SWIFTNESS, - AgilityArtifactID.GHOST_CLOAK, - AgilityArtifactID.LIGHT_FEATHER, - DamagingArtifactID.UPDRAFT_TOME, - DefensiveArtifactID.IRON_HIDE_AMULET, - DefensiveArtifactID.WIND_HORN, - QuiverArtifactID.FLAMING_QUIVER, - SummoningArtifactID.BUZZY_NEST, - SummoningArtifactID.ENCHANTED_GRASS, - SummoningArtifactID.GOLEM_KIT, - SummoningArtifactID.TASTY_BONE, - SummoningArtifactID.WONDERFUL_WHEAT - ); - - public static final List allArtifacts = List.of( - AgilityArtifactID.BOOTS_OF_SWIFTNESS, - AgilityArtifactID.DEATH_CAP_MUSHROOM, - AgilityArtifactID.GHOST_CLOAK, - AgilityArtifactID.LIGHT_FEATHER, - DamagingArtifactID.BLAST_FUNGUS, - DamagingArtifactID.HARVESTER, - DamagingArtifactID.LIGHTNING_ROD, - DamagingArtifactID.POWERSHAKER, - DamagingArtifactID.UPDRAFT_TOME, - DefensiveArtifactID.ENCHANTERS_TOME, - DefensiveArtifactID.IRON_HIDE_AMULET, - DefensiveArtifactID.SOUL_HEALER, - DefensiveArtifactID.TOTEM_OF_REGENERATION, - DefensiveArtifactID.TOTEM_OF_SHIELDING, - DefensiveArtifactID.TOTEM_OF_SOUL_PROTECTION, - DefensiveArtifactID.WIND_HORN, - QuiverArtifactID.FLAMING_QUIVER, - QuiverArtifactID.HARPOON_QUIVER, - QuiverArtifactID.THUNDERING_QUIVER, - QuiverArtifactID.TORMENT_QUIVER, - StatusInflictingArtifactID.CORRUPTED_SEEDS, - StatusInflictingArtifactID.GONG_OF_WEAKENING, - StatusInflictingArtifactID.SATCHEL_OF_ELEMENTS, - StatusInflictingArtifactID.SHOCK_POWDER, - SummoningArtifactID.BUZZY_NEST, - SummoningArtifactID.ENCHANTED_GRASS, - SummoningArtifactID.GOLEM_KIT, - SummoningArtifactID.TASTY_BONE, - SummoningArtifactID.WONDERFUL_WHEAT); - */ } diff --git a/common/src/main/java/dev/timefall/mcdar/api/SummoningHelper.java b/common/src/main/java/dev/timefall/mcdar/api/SummoningHelper.java index 9bd79b0..13a96ba 100644 --- a/common/src/main/java/dev/timefall/mcdar/api/SummoningHelper.java +++ b/common/src/main/java/dev/timefall/mcdar/api/SummoningHelper.java @@ -1,7 +1,7 @@ package dev.timefall.mcdar.api; import dev.timefall.mcdar.api.interfaces.Summonable; -import dev.timefall.mcdar.entities.SummonedEntityType; +import dev.timefall.mcdar.entity.SummonedEntityType; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactAgilityItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactAgilityItem.java deleted file mode 100644 index c5908d1..0000000 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactAgilityItem.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.timefall.mcdar.artifacts; - -import net.minecraft.item.Item; - -public class ArtifactAgilityItem extends Item { - - public ArtifactAgilityItem(int artifactDurability) { - super(new Settings().maxCount(1).maxDamage(artifactDurability)); - } -} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactDamagingItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactDamagingItem.java deleted file mode 100644 index 711ec4a..0000000 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactDamagingItem.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.timefall.mcdar.artifacts; - -import net.minecraft.item.Item; - -public class ArtifactDamagingItem extends Item { - - public ArtifactDamagingItem(int artifactDurability) { - super(new Settings().maxCount(1).maxDamage(artifactDurability)); - } -} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactDefensiveItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactDefensiveItem.java deleted file mode 100644 index 1d6c7d5..0000000 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactDefensiveItem.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.timefall.mcdar.artifacts; - -import net.minecraft.item.Item; - -public class ArtifactDefensiveItem extends Item { - - public ArtifactDefensiveItem(int artifactDurability) { - super(new Settings().maxCount(1).maxDamage(artifactDurability)); - } -} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactItem.java new file mode 100644 index 0000000..0c61f18 --- /dev/null +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactItem.java @@ -0,0 +1,17 @@ +package dev.timefall.mcdar.artifacts; + +import dev.timefall.mcdar.config.artifact_types.ArtifactStats; +import net.minecraft.item.Item; + +public class ArtifactItem extends Item { + protected ArtifactStats artifactStats; + + public ArtifactStats mcdar$getStats() { + return artifactStats; + } + + public ArtifactItem(ArtifactStats artifactStats) { + super(new Settings().maxCount(1).maxDamage(artifactStats.mcdar$getDurability())); + this.artifactStats = artifactStats; + } +} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactQuiverItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactQuiverItem.java deleted file mode 100644 index 7064f86..0000000 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactQuiverItem.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.timefall.mcdar.artifacts; - -import net.minecraft.item.Item; - -public class ArtifactQuiverItem extends Item { - - public ArtifactQuiverItem(int artifactDurability) { - super(new Settings().maxCount(1).maxDamage(artifactDurability)); - } -} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactStatusInflictingItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactStatusInflictingItem.java deleted file mode 100644 index 49ffb6d..0000000 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactStatusInflictingItem.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.timefall.mcdar.artifacts; - -import net.minecraft.item.Item; - -public class ArtifactStatusInflictingItem extends Item { - - public ArtifactStatusInflictingItem(int artifactDurability) { - super(new Settings().maxCount(1).maxDamage(artifactDurability)); - } -} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactSummoningItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactSummoningItem.java deleted file mode 100644 index 0c196bc..0000000 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/ArtifactSummoningItem.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.timefall.mcdar.artifacts; - -import net.minecraft.item.Item; - -public class ArtifactSummoningItem extends Item { - - public ArtifactSummoningItem(int artifactDurability) { - super(new Settings().maxCount(1).maxDamage(artifactDurability)); - } -} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/BlastFungusItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/BlastFungusItem.java index e8fb53a..45f8ff9 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/BlastFungusItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/BlastFungusItem.java @@ -1,9 +1,10 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDamagingItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.ArtifactEffects; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.ArtifactEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -18,25 +19,23 @@ import java.util.List; -public class BlastFungusItem extends ArtifactDamagingItem{ +public class BlastFungusItem extends ArtifactDamagingItem { public BlastFungusItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().BLAST_FUNGUS_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().BLAST_FUNGUS_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ ItemStack itemStack = user.getStackInHand(hand); - float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().BLAST_FUNGUS_STATS.mcdar$getInnerStat().mcdar$getRange(); - float damage = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().BLAST_FUNGUS_STATS.mcdar$getInnerStat().mcdar$getDamage(); + float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().BLAST_FUNGUS_STATS.mcdar$getRange(); + float damage = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().BLAST_FUNGUS_STATS.mcdar$getDamage(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().BLAST_FUNGUS_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); CleanlinessHelper.playCenteredSound(user, SoundEvents.ENTITY_GENERIC_EXPLODE.value(), 1.0F, 1.0F); - ArtifactEffects.causeBlastFungusExplosions(user, range, damage); + ArtifactEffects.mcdar$causeBlastFungusExplosions(user, range, damage); if (!user.isCreative()) { EquipmentSlot equipmentSlot = hand == Hand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND; itemStack.damage(1, user, equipmentSlot); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/BootsOfSwiftnessItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/BootsOfSwiftnessItem.java index 5f17c8f..5fe8933 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/BootsOfSwiftnessItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/BootsOfSwiftnessItem.java @@ -1,8 +1,9 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactAgilityItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -14,16 +15,14 @@ import java.util.List; -public class BootsOfSwiftnessItem extends ArtifactAgilityItem{ +public class BootsOfSwiftnessItem extends ArtifactAgilityItem { public BootsOfSwiftnessItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().BOOTS_OF_SWIFTNESS_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().BOOTS_OF_SWIFTNESS_STATS); } public TypedActionResult use(World world, PlayerEntity user, Hand hand){ - int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().BOOTS_OF_SWIFTNESS_STATS.mcdar$getInnerStat().mcdar$getDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().BOOTS_OF_SWIFTNESS_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); + int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().BOOTS_OF_SWIFTNESS_STATS.mcdar$getDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().BOOTS_OF_SWIFTNESS_STATS.mcdar$getAmplifier(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().BOOTS_OF_SWIFTNESS_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/BuzzyNestItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/BuzzyNestItem.java index 81d9fd4..fb02192 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/BuzzyNestItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/BuzzyNestItem.java @@ -1,9 +1,10 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactSummoningItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; -import dev.timefall.mcdar.entities.SummonedEntityType; +import dev.timefall.mcdar.effect.EnchantmentEffects; +import dev.timefall.mcdar.entity.SummonedEntityType; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; import net.minecraft.item.tooltip.TooltipType; @@ -12,11 +13,9 @@ import java.util.List; -public class BuzzyNestItem extends ArtifactSummoningItem{ +public class BuzzyNestItem extends ArtifactSummoningItem { public BuzzyNestItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getSummoningArtifactStats().BUZZY_NEST_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getSummoningArtifactStats().BUZZY_NEST_STATS); } public ActionResult useOnBlock(ItemUsageContext itemUsageContext) { diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/CorruptedSeedsItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/CorruptedSeedsItem.java index 18f579c..19a64f0 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/CorruptedSeedsItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/CorruptedSeedsItem.java @@ -2,8 +2,9 @@ import dev.timefall.mcdar.api.AOEHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactStatusInflictingItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; @@ -18,19 +19,17 @@ import java.util.List; -public class CorruptedSeedsItem extends ArtifactStatusInflictingItem{ +public class CorruptedSeedsItem extends ArtifactStatusInflictingItem { public CorruptedSeedsItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().CORRUPTED_SEEDS_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().CORRUPTED_SEEDS_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ ItemStack itemStack = user.getStackInHand(hand); - float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().CORRUPTED_SEEDS_STATS.mcdar$getInnerStat().mcdar$getRange(); - int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().CORRUPTED_SEEDS_STATS.mcdar$getInnerStat().mcdar$getDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().CORRUPTED_SEEDS_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); - int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().CORRUPTED_SEEDS_STATS.mcdar$getInnerStat().mcdar$getAmplifier2(); + float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().CORRUPTED_SEEDS_STATS.mcdar$getRange(); + int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().CORRUPTED_SEEDS_STATS.mcdar$getDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().CORRUPTED_SEEDS_STATS.mcdar$getAmplifier(); + int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().CORRUPTED_SEEDS_STATS.mcdar$getAmplifier2(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().CORRUPTED_SEEDS_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/DeathCapMushroomItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/DeathCapMushroomItem.java index 415f1ed..67bc14e 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/DeathCapMushroomItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/DeathCapMushroomItem.java @@ -1,8 +1,9 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactAgilityItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -14,17 +15,15 @@ import java.util.List; -public class DeathCapMushroomItem extends ArtifactAgilityItem{ +public class DeathCapMushroomItem extends ArtifactAgilityItem { public DeathCapMushroomItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand) { - int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getInnerStat().mcdar$getDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); - int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getInnerStat().mcdar$getAmplifier2(); + int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getAmplifier(); + int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getAmplifier2(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/EnchantedGrassItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/EnchantedGrassItem.java index add3402..e05a98a 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/EnchantedGrassItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/EnchantedGrassItem.java @@ -2,8 +2,9 @@ import dev.timefall.mcdar.api.CleanlinessHelper; import dev.timefall.mcdar.api.SummoningHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactSummoningItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.passive.SheepEntity; import net.minecraft.entity.player.PlayerEntity; @@ -17,11 +18,9 @@ import java.util.List; -public class EnchantedGrassItem extends ArtifactSummoningItem{ +public class EnchantedGrassItem extends ArtifactSummoningItem { public EnchantedGrassItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getSummoningArtifactStats().ENCHANTED_GRASS_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getSummoningArtifactStats().ENCHANTED_GRASS_STATS); } public ActionResult useOnBlock (ItemUsageContext itemUsageContext){ diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/EnchantersTomeItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/EnchantersTomeItem.java index f30ddaa..bac248b 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/EnchantersTomeItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/EnchantersTomeItem.java @@ -1,9 +1,10 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDefensiveItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.ArtifactEffects; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.ArtifactEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -16,11 +17,9 @@ import java.util.List; -public class EnchantersTomeItem extends ArtifactDefensiveItem{ +public class EnchantersTomeItem extends ArtifactDefensiveItem { public EnchantersTomeItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().ENCHANTERS_TOME_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().ENCHANTERS_TOME_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand) { @@ -29,7 +28,7 @@ public TypedActionResult use (World world, PlayerEntity user, Hand ha int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().ENCHANTERS_TOME_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); - ArtifactEffects.enchantersTomeEffects(user); + ArtifactEffects.mcdar$enchantersTomeEffects(user); if (!user.isCreative()){ EquipmentSlot equipmentSlot = hand == Hand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND; diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/FlamingQuiverItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/FlamingQuiverItem.java index 0a80d8e..7847f86 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/FlamingQuiverItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/FlamingQuiverItem.java @@ -1,8 +1,9 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactQuiverItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.tooltip.TooltipType; @@ -13,11 +14,9 @@ import java.util.List; -public class FlamingQuiverItem extends ArtifactQuiverItem{ +public class FlamingQuiverItem extends ArtifactQuiverItem { public FlamingQuiverItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getQuiverArtifactStats().FLAMING_QUIVER_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getQuiverArtifactStats().FLAMING_QUIVER_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/GhostCloakItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/GhostCloakItem.java index 693277c..26760dd 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/GhostCloakItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/GhostCloakItem.java @@ -1,8 +1,9 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactAgilityItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -14,19 +15,17 @@ import java.util.List; -public class GhostCloakItem extends ArtifactAgilityItem{ +public class GhostCloakItem extends ArtifactAgilityItem { public GhostCloakItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().GHOST_CLOAK_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().GHOST_CLOAK_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ - int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().GHOST_CLOAK_STATS.mcdar$getInnerStat().mcdar$getDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().GHOST_CLOAK_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); - int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().GHOST_CLOAK_STATS.mcdar$getInnerStat().mcdar$getAmplifier2(); - int amplifier3 = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().GHOST_CLOAK_STATS.mcdar$getInnerStat().mcdar$getAmplifier3(); + int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().GHOST_CLOAK_STATS.mcdar$getDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().GHOST_CLOAK_STATS.mcdar$getAmplifier(); + int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().GHOST_CLOAK_STATS.mcdar$getAmplifier2(); + int amplifier3 = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().GHOST_CLOAK_STATS.mcdar$getAmplifier3(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().GHOST_CLOAK_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/GolemKitItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/GolemKitItem.java index e41b59d..4a16138 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/GolemKitItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/GolemKitItem.java @@ -1,9 +1,10 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactSummoningItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; -import dev.timefall.mcdar.entities.SummonedEntityType; +import dev.timefall.mcdar.effect.EnchantmentEffects; +import dev.timefall.mcdar.entity.SummonedEntityType; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; import net.minecraft.item.tooltip.TooltipType; @@ -12,11 +13,9 @@ import java.util.List; -public class GolemKitItem extends ArtifactSummoningItem{ +public class GolemKitItem extends ArtifactSummoningItem { public GolemKitItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getSummoningArtifactStats().GOLEM_KIT_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getSummoningArtifactStats().GOLEM_KIT_STATS); } public ActionResult useOnBlock (ItemUsageContext itemUsageContext){ diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/GongOfWeakeningItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/GongOfWeakeningItem.java index b9ffa94..a23977f 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/GongOfWeakeningItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/GongOfWeakeningItem.java @@ -2,8 +2,9 @@ import dev.timefall.mcdar.api.AOEHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactStatusInflictingItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; @@ -21,19 +22,17 @@ import java.util.List; -public class GongOfWeakeningItem extends ArtifactStatusInflictingItem{ +public class GongOfWeakeningItem extends ArtifactStatusInflictingItem { public GongOfWeakeningItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().GONG_OF_WEAKENING_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().GONG_OF_WEAKENING_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ ItemStack itemStack = user.getStackInHand(hand); - float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().GONG_OF_WEAKENING_STATS.mcdar$getInnerStat().mcdar$getRange(); - int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().GONG_OF_WEAKENING_STATS.mcdar$getInnerStat().mcdar$getDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().GONG_OF_WEAKENING_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); - int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().GONG_OF_WEAKENING_STATS.mcdar$getInnerStat().mcdar$getAmplifier2(); + float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().GONG_OF_WEAKENING_STATS.mcdar$getRange(); + int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().GONG_OF_WEAKENING_STATS.mcdar$getDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().GONG_OF_WEAKENING_STATS.mcdar$getAmplifier(); + int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().GONG_OF_WEAKENING_STATS.mcdar$getAmplifier2(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().GONG_OF_WEAKENING_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/HarpoonQuiverItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/HarpoonQuiverItem.java index 35dd2c1..a41e182 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/HarpoonQuiverItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/HarpoonQuiverItem.java @@ -1,8 +1,9 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactQuiverItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.tooltip.TooltipType; @@ -13,11 +14,9 @@ import java.util.List; -public class HarpoonQuiverItem extends ArtifactQuiverItem{ +public class HarpoonQuiverItem extends ArtifactQuiverItem { public HarpoonQuiverItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getQuiverArtifactStats().HARPOON_QUIVER_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getQuiverArtifactStats().HARPOON_QUIVER_STATS); } public TypedActionResult use(World world, PlayerEntity user, Hand hand){ diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/HarvesterItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/HarvesterItem.java index 862a065..625788a 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/HarvesterItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/HarvesterItem.java @@ -3,8 +3,9 @@ import dev.timefall.mcdar.api.AOECloudHelper; import dev.timefall.mcdar.api.AOEHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDamagingItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -18,20 +19,18 @@ import java.util.List; -public class HarvesterItem extends ArtifactDamagingItem{ +public class HarvesterItem extends ArtifactDamagingItem { public HarvesterItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().HARVESTER_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().HARVESTER_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ ItemStack itemStack = user.getStackInHand(hand); - int experienceDrain = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().HARVESTER_STATS.mcdar$getInnerStat().mcdar$getExperienceDrain(); + int experienceDrain = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().HARVESTER_STATS.mcdar$getExperienceDrain(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().HARVESTER_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); - int damage = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().HARVESTER_STATS.mcdar$getInnerStat().mcdar$getDamageOrHealing(); - float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().HARVESTER_STATS.mcdar$getInnerStat().mcdar$getRange(); + int damage = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().HARVESTER_STATS.mcdar$getDamageOrHealing(); + float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().HARVESTER_STATS.mcdar$getRange(); if (user.totalExperience >= experienceDrain || user.isCreative()) { CleanlinessHelper.playCenteredSound(user, SoundEvents.ENTITY_GENERIC_EXPLODE.value(), 1.0F, 1.0F); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/IronHideAmuletItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/IronHideAmuletItem.java index 55b5494..ce60c24 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/IronHideAmuletItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/IronHideAmuletItem.java @@ -1,8 +1,9 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDefensiveItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -14,16 +15,14 @@ import java.util.List; -public class IronHideAmuletItem extends ArtifactDefensiveItem{ +public class IronHideAmuletItem extends ArtifactDefensiveItem { public IronHideAmuletItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().IRON_HIDE_AMULET_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().IRON_HIDE_AMULET_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ - int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().IRON_HIDE_AMULET_STATS.mcdar$getInnerStat().mcdar$getDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().IRON_HIDE_AMULET_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); + int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().IRON_HIDE_AMULET_STATS.mcdar$getDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().IRON_HIDE_AMULET_STATS.mcdar$getAmplifier(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().IRON_HIDE_AMULET_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/LightFeatherItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/LightFeatherItem.java index 864f22c..faf9a7a 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/LightFeatherItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/LightFeatherItem.java @@ -3,8 +3,9 @@ import dev.timefall.mcdar.api.AOEHelper; import dev.timefall.mcdar.api.AbilityHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactAgilityItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import dev.timefall.mcdar.registry.StatusEffectRegistry; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; @@ -13,7 +14,6 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; @@ -22,11 +22,9 @@ import java.util.List; -public class LightFeatherItem extends ArtifactAgilityItem{ +public class LightFeatherItem extends ArtifactAgilityItem { public LightFeatherItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().LIGHT_FEATHER_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().LIGHT_FEATHER_STATS); } public TypedActionResult use(World world, PlayerEntity user, Hand hand) { @@ -42,21 +40,21 @@ public TypedActionResult use(World world, PlayerEntity user, Hand han nearbyEntity.addStatusEffect( new StatusEffectInstance( - RegistryEntry.of(StatusEffectRegistry.STUNNED), - McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getInnerStat().mcdar$getDuration(), - McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getInnerStat().mcdar$getAmplifier() + StatusEffectRegistry.STUNNED.getEntry(), + McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getDuration(), + McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getAmplifier() )); nearbyEntity.addStatusEffect( new StatusEffectInstance( StatusEffects.NAUSEA, - McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getInnerStat().mcdar$getDuration(), - McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getInnerStat().mcdar$getAmplifier2() + McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getDuration(), + McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getAmplifier2() )); nearbyEntity.addStatusEffect( new StatusEffectInstance( StatusEffects.SLOWNESS, - McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getInnerStat().mcdar$getDuration(), - McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getInnerStat().mcdar$getAmplifier3() + McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getDuration(), + McdarArtifactsStatsConfig.CONFIG.mcdar$getAgilityArtifactStats().DEATH_CAP_MUSHROOM_STATS.mcdar$getAmplifier3() )); } diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/LightningRodItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/LightningRodItem.java index 7666398..1ea7358 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/LightningRodItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/LightningRodItem.java @@ -2,8 +2,9 @@ import dev.timefall.mcdar.api.AOEHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDamagingItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -16,11 +17,9 @@ import java.util.List; -public class LightningRodItem extends ArtifactDamagingItem{ +public class LightningRodItem extends ArtifactDamagingItem { public LightningRodItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().LIGHTNING_ROD_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().LIGHTNING_ROD_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand) { diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/LoveMedallionItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/LoveMedallionItem.java index b2ce4e6..2f15ed8 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/LoveMedallionItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/LoveMedallionItem.java @@ -3,8 +3,9 @@ import dev.timefall.mcdar.api.AOEHelper; import dev.timefall.mcdar.api.AbilityHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactStatusInflictingItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import dev.timefall.mcdar.registry.StatusEffectRegistry; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; @@ -17,7 +18,6 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; @@ -28,16 +28,14 @@ public class LoveMedallionItem extends ArtifactStatusInflictingItem { public LoveMedallionItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().LOVE_MEDALLION_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().LOVE_MEDALLION_STATS); } public TypedActionResult use(World world, PlayerEntity user, Hand hand){ ItemStack itemStack = user.getStackInHand(hand); - float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().LOVE_MEDALLION_STATS.mcdar$getInnerStat().mcdar$getRange(); - int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().LOVE_MEDALLION_STATS.mcdar$getInnerStat().mcdar$getDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().LOVE_MEDALLION_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); + float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().LOVE_MEDALLION_STATS.mcdar$getRange(); + int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().LOVE_MEDALLION_STATS.mcdar$getDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().LOVE_MEDALLION_STATS.mcdar$getAmplifier(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().LOVE_MEDALLION_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); @@ -73,7 +71,7 @@ public static void sendIntoWildRage(LivingEntity mobEntity, int duration, int am bl = true; } if (!(bl || mobEntity instanceof WitherEntity || mobEntity instanceof EnderDragonEntity || mobEntity instanceof AmbientEntity)) - mobEntity.addStatusEffect(new StatusEffectInstance(RegistryEntry.of(StatusEffectRegistry.CHARMED), duration, amplifier)); + mobEntity.addStatusEffect(new StatusEffectInstance(StatusEffectRegistry.CHARMED.getEntry(), duration, amplifier)); } @Override diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/PowershakerItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/PowershakerItem.java index 5a16906..3002419 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/PowershakerItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/PowershakerItem.java @@ -1,8 +1,9 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDamagingItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.tooltip.TooltipType; @@ -15,9 +16,7 @@ public class PowershakerItem extends ArtifactDamagingItem { public PowershakerItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().POWERSHAKER_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().POWERSHAKER_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand) { diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfElementsItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfElementsItem.java index 5eb442e..392033f 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfElementsItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfElementsItem.java @@ -2,8 +2,9 @@ import dev.timefall.mcdar.api.AOEHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactStatusInflictingItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; @@ -15,11 +16,9 @@ import java.util.List; -public class SatchelOfElementsItem extends ArtifactStatusInflictingItem{ +public class SatchelOfElementsItem extends ArtifactStatusInflictingItem { public SatchelOfElementsItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS); } @Override @@ -29,13 +28,13 @@ public ActionResult useOnBlock (ItemUsageContext context) { if (user != null) { Hand hand = user.getActiveHand(); ItemStack itemStack = user.getStackInHand(hand); - int experienceDrain = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getInnerStat().mcdar$getExperienceDrain(); - float damage = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getInnerStat().mcdar$getDamageOrHealingFactor(); - float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getInnerStat().mcdar$getRange(); - int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getInnerStat().mcdar$getDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); - int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getInnerStat().mcdar$getAmplifier2(); - int amplifier3 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getInnerStat().mcdar$getAmplifier3(); + int experienceDrain = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getExperienceDrain(); + float damage = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getDamageOrHealingFactor(); + float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getRange(); + int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getAmplifier(); + int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getAmplifier2(); + int amplifier3 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getAmplifier3(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SATCHEL_OF_ELEMENTS_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, user.getWorld()); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfElixirsItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfElixirsItem.java index 91dcc51..4f7200a 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfElixirsItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfElixirsItem.java @@ -2,8 +2,9 @@ import dev.timefall.mcdar.api.AbilityHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDefensiveItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -18,9 +19,7 @@ public class SatchelOfElixirsItem extends ArtifactDefensiveItem { public SatchelOfElixirsItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SATCHEL_OF_ELIXIRS_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SATCHEL_OF_ELIXIRS_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfSnacksItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfSnacksItem.java index f4dbf8a..dd3989f 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfSnacksItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/SatchelOfSnacksItem.java @@ -2,8 +2,9 @@ import dev.timefall.mcdar.api.AbilityHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDefensiveItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; @@ -17,11 +18,9 @@ import java.util.List; -public class SatchelOfSnacksItem extends ArtifactDefensiveItem{ +public class SatchelOfSnacksItem extends ArtifactDefensiveItem { public SatchelOfSnacksItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SATCHEL_OF_SNACKS_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SATCHEL_OF_SNACKS_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/ShockPowderItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/ShockPowderItem.java index 15f56bd..77efcf5 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/ShockPowderItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/ShockPowderItem.java @@ -2,8 +2,9 @@ import dev.timefall.mcdar.api.AOEHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactStatusInflictingItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import dev.timefall.mcdar.registry.StatusEffectRegistry; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffectInstance; @@ -11,7 +12,6 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; @@ -21,27 +21,25 @@ import java.util.List; -public class ShockPowderItem extends ArtifactStatusInflictingItem{ +public class ShockPowderItem extends ArtifactStatusInflictingItem { public ShockPowderItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ ItemStack itemStack = user.getStackInHand(hand); - float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getInnerStat().mcdar$getRange(); - int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getInnerStat().mcdar$getDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); - int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getInnerStat().mcdar$getAmplifier2(); - int amplifier3 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getInnerStat().mcdar$getAmplifier3(); + float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getRange(); + int duration = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getAmplifier(); + int amplifier2 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getAmplifier2(); + int amplifier3 = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getAmplifier3(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getStatusInflictingArtifactStats().SHOCK_POWDER_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); AOEHelper.afflictNearbyEntities( user, range, - new StatusEffectInstance(RegistryEntry.of(StatusEffectRegistry.STUNNED), duration, amplifier), + new StatusEffectInstance(StatusEffectRegistry.STUNNED.getEntry(), duration, amplifier), new StatusEffectInstance(StatusEffects.NAUSEA, duration, amplifier2), new StatusEffectInstance(StatusEffects.SLOWNESS, duration, amplifier3) ); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/SoulHealerItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/SoulHealerItem.java index e2af9fa..b5a9795 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/SoulHealerItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/SoulHealerItem.java @@ -3,8 +3,9 @@ import dev.timefall.mcdar.api.AOEHelper; import dev.timefall.mcdar.api.AbilityHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDefensiveItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; @@ -18,18 +19,16 @@ import java.util.List; -public class SoulHealerItem extends ArtifactDefensiveItem{ +public class SoulHealerItem extends ArtifactDefensiveItem { public SoulHealerItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SOUL_HEALER_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SOUL_HEALER_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ - int experienceDrain = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SOUL_HEALER_STATS.mcdar$getInnerStat().mcdar$getExperienceDrain(); + int experienceDrain = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SOUL_HEALER_STATS.mcdar$getExperienceDrain(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SOUL_HEALER_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); - float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SOUL_HEALER_STATS.mcdar$getInnerStat().mcdar$getRange(); + float range = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SOUL_HEALER_STATS.mcdar$getRange(); ItemStack itemStack = user.getStackInHand(hand); @@ -81,7 +80,7 @@ public static float healMostInjuredAlly(LivingEntity healer, float distance) { return 0; } public static float healAlly(LivingEntity allyToBeHealed) { - float healingBase = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SOUL_HEALER_STATS.mcdar$getInnerStat().mcdar$getDamageOrHealingFactor(); + float healingBase = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().SOUL_HEALER_STATS.mcdar$getDamageOrHealingFactor(); float maxHealth = allyToBeHealed.getMaxHealth(); float lostHealth = maxHealth - allyToBeHealed.getHealth(); float healedAmount = Math.min( diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/TastyBoneItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/TastyBoneItem.java index e8d70de..a128dd9 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/TastyBoneItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/TastyBoneItem.java @@ -1,9 +1,10 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactSummoningItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; -import dev.timefall.mcdar.entities.SummonedEntityType; +import dev.timefall.mcdar.effect.EnchantmentEffects; +import dev.timefall.mcdar.entity.SummonedEntityType; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; import net.minecraft.item.tooltip.TooltipType; @@ -12,11 +13,9 @@ import java.util.List; -public class TastyBoneItem extends ArtifactSummoningItem{ +public class TastyBoneItem extends ArtifactSummoningItem { public TastyBoneItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getSummoningArtifactStats().TASTY_BONE_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getSummoningArtifactStats().TASTY_BONE_STATS); } public ActionResult useOnBlock (ItemUsageContext itemUsageContext) { diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/ThunderingQuiverItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/ThunderingQuiverItem.java index b25c38e..b3eb983 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/ThunderingQuiverItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/ThunderingQuiverItem.java @@ -1,8 +1,9 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactQuiverItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.tooltip.TooltipType; @@ -13,11 +14,9 @@ import java.util.List; -public class ThunderingQuiverItem extends ArtifactQuiverItem{ +public class ThunderingQuiverItem extends ArtifactQuiverItem { public ThunderingQuiverItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getQuiverArtifactStats().THUNDERING_QUIVER_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getQuiverArtifactStats().THUNDERING_QUIVER_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/TormentQuiverItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/TormentQuiverItem.java index 7ee07c9..4d5a79b 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/TormentQuiverItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/TormentQuiverItem.java @@ -1,8 +1,9 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactQuiverItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -15,11 +16,9 @@ import java.util.List; -public class TormentQuiverItem extends ArtifactQuiverItem{ +public class TormentQuiverItem extends ArtifactQuiverItem { public TormentQuiverItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getQuiverArtifactStats().TORMENT_QUIVER_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getQuiverArtifactStats().TORMENT_QUIVER_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfRegenerationItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfRegenerationItem.java index 4704e40..56da35f 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfRegenerationItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfRegenerationItem.java @@ -2,8 +2,9 @@ import dev.timefall.mcdar.api.AOECloudHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDefensiveItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; @@ -19,18 +20,16 @@ import java.util.List; -public class TotemOfRegenerationItem extends ArtifactDefensiveItem{ +public class TotemOfRegenerationItem extends ArtifactDefensiveItem { public TotemOfRegenerationItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_REGENERATION_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_REGENERATION_STATS); } public ActionResult useOnBlock (ItemUsageContext itemUsageContext) { - float cloudRadius = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_REGENERATION_STATS.mcdar$getInnerStat().mcdar$getCloudRadius(); - int cloudDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_REGENERATION_STATS.mcdar$getInnerStat().mcdar$getCloudDuration(); - int effectDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_REGENERATION_STATS.mcdar$getInnerStat().mcdar$getEffectDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_REGENERATION_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); + float cloudRadius = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_REGENERATION_STATS.mcdar$getCloudRadius(); + int cloudDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_REGENERATION_STATS.mcdar$getCloudDuration(); + int effectDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_REGENERATION_STATS.mcdar$getEffectDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_REGENERATION_STATS.mcdar$getAmplifier(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_REGENERATION_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, itemUsageContext.getPlayer(), itemUsageContext.getWorld()); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfShieldingItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfShieldingItem.java index ac0947a..58724f2 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfShieldingItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfShieldingItem.java @@ -2,8 +2,9 @@ import dev.timefall.mcdar.api.AOECloudHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDefensiveItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import dev.timefall.mcdar.registry.StatusEffectRegistry; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffectInstance; @@ -11,7 +12,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.server.world.ServerWorld; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; @@ -20,18 +20,16 @@ import java.util.List; -public class TotemOfShieldingItem extends ArtifactDefensiveItem{ +public class TotemOfShieldingItem extends ArtifactDefensiveItem { public TotemOfShieldingItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SHIELDING_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SHIELDING_STATS); } public ActionResult useOnBlock (ItemUsageContext itemUsageContext){ - float cloudRadius = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SHIELDING_STATS.mcdar$getInnerStat().mcdar$getCloudRadius(); - int cloudDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SHIELDING_STATS.mcdar$getInnerStat().mcdar$getCloudDuration(); - int effectDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SHIELDING_STATS.mcdar$getInnerStat().mcdar$getEffectDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SHIELDING_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); + float cloudRadius = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SHIELDING_STATS.mcdar$getCloudRadius(); + int cloudDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SHIELDING_STATS.mcdar$getCloudDuration(); + int effectDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SHIELDING_STATS.mcdar$getEffectDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SHIELDING_STATS.mcdar$getAmplifier(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SHIELDING_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, itemUsageContext.getPlayer(), itemUsageContext.getWorld()); @@ -53,7 +51,7 @@ public ActionResult useOnBlock (ItemUsageContext itemUsageContext){ cloudRadius, cloudDuration, new StatusEffectInstance( - RegistryEntry.of(StatusEffectRegistry.SHIELDING), + StatusEffectRegistry.SHIELDING.getEntry(), effectDuration, amplifier ) diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfSoulProtectionItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfSoulProtectionItem.java index 9d14957..7fdf938 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfSoulProtectionItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/TotemOfSoulProtectionItem.java @@ -2,8 +2,9 @@ import dev.timefall.mcdar.api.AOECloudHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDefensiveItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import dev.timefall.mcdar.registry.StatusEffectRegistry; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffectInstance; @@ -11,7 +12,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.server.world.ServerWorld; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; @@ -20,18 +20,16 @@ import java.util.List; -public class TotemOfSoulProtectionItem extends ArtifactDefensiveItem{ +public class TotemOfSoulProtectionItem extends ArtifactDefensiveItem { public TotemOfSoulProtectionItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SOUL_PROTECTION_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SOUL_PROTECTION_STATS); } - public ActionResult useOnBlock (ItemUsageContext itemUsageContext){ - float cloudRadius = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SOUL_PROTECTION_STATS.mcdar$getInnerStat().mcdar$getCloudRadius(); - int cloudDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SOUL_PROTECTION_STATS.mcdar$getInnerStat().mcdar$getCloudDuration(); - int effectDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SOUL_PROTECTION_STATS.mcdar$getInnerStat().mcdar$getEffectDuration(); - int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SOUL_PROTECTION_STATS.mcdar$getInnerStat().mcdar$getAmplifier(); + public ActionResult useOnBlock (ItemUsageContext itemUsageContext) { + float cloudRadius = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SOUL_PROTECTION_STATS.mcdar$getCloudRadius(); + int cloudDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SOUL_PROTECTION_STATS.mcdar$getCloudDuration(); + int effectDuration = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SOUL_PROTECTION_STATS.mcdar$getEffectDuration(); + int amplifier = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SOUL_PROTECTION_STATS.mcdar$getAmplifier(); int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().TOTEM_OF_SOUL_PROTECTION_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, itemUsageContext.getPlayer(), itemUsageContext.getWorld()); @@ -53,7 +51,7 @@ public ActionResult useOnBlock (ItemUsageContext itemUsageContext){ cloudRadius, cloudDuration, new StatusEffectInstance( - RegistryEntry.of(StatusEffectRegistry.SOUL_PROTECTION), + StatusEffectRegistry.SOUL_PROTECTION.getEntry(), effectDuration, amplifier ) diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/UpdraftTomeItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/UpdraftTomeItem.java index 500773b..b72841f 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/UpdraftTomeItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/UpdraftTomeItem.java @@ -1,9 +1,10 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDamagingItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.ArtifactEffects; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.ArtifactEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -17,11 +18,9 @@ import java.util.List; -public class UpdraftTomeItem extends ArtifactDamagingItem{ +public class UpdraftTomeItem extends ArtifactDamagingItem { public UpdraftTomeItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().UPDRAFT_TOME_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().UPDRAFT_TOME_STATS); } public TypedActionResult use (World world, PlayerEntity user, Hand hand){ @@ -29,7 +28,7 @@ public TypedActionResult use (World world, PlayerEntity user, Hand ha int maxCooldownEnchantmentTime = McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().UPDRAFT_TOME_STATS.mcdar$getMaxCooldownEnchantmentTime(); int modifiedCooldownEnchantmentTime = EnchantmentEffects.cooldownEffect(maxCooldownEnchantmentTime, user, world); - ArtifactEffects.updraftNearbyEnemies(user); + ArtifactEffects.mcdar$updraftNearbyEnemies(user); if (!user.isCreative()){ EquipmentSlot equipmentSlot = hand == Hand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND; itemStack.damage(1, user, equipmentSlot); diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/WindHornItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/WindHornItem.java index 1586468..5f2f682 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/WindHornItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/WindHornItem.java @@ -3,8 +3,9 @@ import dev.timefall.mcdar.api.AOEHelper; import dev.timefall.mcdar.api.AbilityHelper; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactDefensiveItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import net.minecraft.component.DataComponentTypes; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; @@ -28,16 +29,14 @@ import java.util.List; import java.util.Optional; -public class WindHornItem extends ArtifactDefensiveItem{ +public class WindHornItem extends ArtifactDefensiveItem { private static final String INSTRUMENT_KEY = "instrument"; private final TagKey instrumentTag; public WindHornItem(TagKey instrumentTag) { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().WIND_HORN_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().WIND_HORN_STATS); this.instrumentTag = instrumentTag; } @@ -51,9 +50,9 @@ public TypedActionResult use (World world, PlayerEntity user, Hand ha Instrument instrument = optional.get().value(); user.setCurrentHand(hand); WindHornItem.playSound(world, user, instrument); - for (LivingEntity nearbyEntity : AOEHelper.getEntitiesByPredicate(user, McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().WIND_HORN_STATS.mcdar$getInnerStat().mcdar$getRange(), + for (LivingEntity nearbyEntity : AOEHelper.getEntitiesByPredicate(user, McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().WIND_HORN_STATS.mcdar$getRange(), (nearbyEntity) -> nearbyEntity != user && !AbilityHelper.isPetOf(nearbyEntity, user) && nearbyEntity.isAlive())) { - AOEHelper.knockbackNearbyEnemies(user, nearbyEntity, McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().WIND_HORN_STATS.mcdar$getInnerStat().mcdar$getDamage()); + AOEHelper.knockbackNearbyEnemies(user, nearbyEntity, McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().WIND_HORN_STATS.mcdar$getDamage()); } if (!user.isCreative()) { diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/WonderfulWheatItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/WonderfulWheatItem.java index c95feb0..67db7a3 100644 --- a/common/src/main/java/dev/timefall/mcdar/artifacts/WonderfulWheatItem.java +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/WonderfulWheatItem.java @@ -1,9 +1,10 @@ package dev.timefall.mcdar.artifacts; import dev.timefall.mcdar.api.CleanlinessHelper; +import dev.timefall.mcdar.artifacts.artifact_types.ArtifactSummoningItem; import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.EnchantmentEffects; -import dev.timefall.mcdar.entities.SummonedEntityType; +import dev.timefall.mcdar.effect.EnchantmentEffects; +import dev.timefall.mcdar.entity.SummonedEntityType; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; import net.minecraft.item.tooltip.TooltipType; @@ -12,11 +13,9 @@ import java.util.List; -public class WonderfulWheatItem extends ArtifactSummoningItem{ +public class WonderfulWheatItem extends ArtifactSummoningItem { public WonderfulWheatItem() { - super( - McdarArtifactsStatsConfig.CONFIG.mcdar$getSummoningArtifactStats().WONDERFUL_WHEAT_STATS.mcdar$getDurability() - ); + super(McdarArtifactsStatsConfig.CONFIG.mcdar$getSummoningArtifactStats().WONDERFUL_WHEAT_STATS); } public ActionResult useOnBlock (ItemUsageContext itemUsageContext){ diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactAgilityItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactAgilityItem.java new file mode 100644 index 0000000..7ef7efa --- /dev/null +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactAgilityItem.java @@ -0,0 +1,11 @@ +package dev.timefall.mcdar.artifacts.artifact_types; + +import dev.timefall.mcdar.artifacts.ArtifactItem; +import dev.timefall.mcdar.config.artifact_types.ArtifactStats; + +public class ArtifactAgilityItem extends ArtifactItem { + + public ArtifactAgilityItem(ArtifactStats artifactStats) { + super(artifactStats); + } +} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactDamagingItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactDamagingItem.java new file mode 100644 index 0000000..bc9e4e8 --- /dev/null +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactDamagingItem.java @@ -0,0 +1,11 @@ +package dev.timefall.mcdar.artifacts.artifact_types; + +import dev.timefall.mcdar.artifacts.ArtifactItem; +import dev.timefall.mcdar.config.artifact_types.ArtifactStats; + +public class ArtifactDamagingItem extends ArtifactItem { + + public ArtifactDamagingItem(ArtifactStats artifactStats) { + super(artifactStats); + } +} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactDefensiveItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactDefensiveItem.java new file mode 100644 index 0000000..f196d71 --- /dev/null +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactDefensiveItem.java @@ -0,0 +1,11 @@ +package dev.timefall.mcdar.artifacts.artifact_types; + +import dev.timefall.mcdar.artifacts.ArtifactItem; +import dev.timefall.mcdar.config.artifact_types.ArtifactStats; + +public class ArtifactDefensiveItem extends ArtifactItem { + + public ArtifactDefensiveItem(ArtifactStats artifactStats) { + super(artifactStats); + } +} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactQuiverItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactQuiverItem.java new file mode 100644 index 0000000..e9034c1 --- /dev/null +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactQuiverItem.java @@ -0,0 +1,11 @@ +package dev.timefall.mcdar.artifacts.artifact_types; + +import dev.timefall.mcdar.artifacts.ArtifactItem; +import dev.timefall.mcdar.config.artifact_types.ArtifactStats; + +public class ArtifactQuiverItem extends ArtifactItem { + + public ArtifactQuiverItem(ArtifactStats artifactStats) { + super(artifactStats); + } +} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactStatusInflictingItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactStatusInflictingItem.java new file mode 100644 index 0000000..86e8e9d --- /dev/null +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactStatusInflictingItem.java @@ -0,0 +1,11 @@ +package dev.timefall.mcdar.artifacts.artifact_types; + +import dev.timefall.mcdar.artifacts.ArtifactItem; +import dev.timefall.mcdar.config.artifact_types.ArtifactStats; + +public class ArtifactStatusInflictingItem extends ArtifactItem { + + public ArtifactStatusInflictingItem(ArtifactStats artifactStats) { + super(artifactStats); + } +} diff --git a/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactSummoningItem.java b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactSummoningItem.java new file mode 100644 index 0000000..331b415 --- /dev/null +++ b/common/src/main/java/dev/timefall/mcdar/artifacts/artifact_types/ArtifactSummoningItem.java @@ -0,0 +1,11 @@ +package dev.timefall.mcdar.artifacts.artifact_types; + +import dev.timefall.mcdar.artifacts.ArtifactItem; +import dev.timefall.mcdar.config.artifact_types.ArtifactStats; + +public class ArtifactSummoningItem extends ArtifactItem { + + public ArtifactSummoningItem(ArtifactStats artifactStats) { + super(artifactStats); + } +} diff --git a/common/src/main/java/dev/timefall/mcdar/client/SummonedEntityRenderers.java b/common/src/main/java/dev/timefall/mcdar/client/SummonedEntityRenderers.java index d82c640..4e377da 100644 --- a/common/src/main/java/dev/timefall/mcdar/client/SummonedEntityRenderers.java +++ b/common/src/main/java/dev/timefall/mcdar/client/SummonedEntityRenderers.java @@ -1,7 +1,7 @@ package dev.timefall.mcdar.client; -import dev.timefall.mcdar.entities.SummonedEntityType; -import dev.timefall.mcdar.entities.renderers.BuzzyNestBeeRenderer; +import dev.timefall.mcdar.entity.SummonedEntityType; +import dev.timefall.mcdar.entity.renderers.BuzzyNestBeeRenderer; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.EntityRenderers; diff --git a/common/src/main/java/dev/timefall/mcdar/config/McdarArtifactsStatsConfig.java b/common/src/main/java/dev/timefall/mcdar/config/McdarArtifactsStatsConfig.java index 0d7c1d5..a5acb9e 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/McdarArtifactsStatsConfig.java +++ b/common/src/main/java/dev/timefall/mcdar/config/McdarArtifactsStatsConfig.java @@ -6,13 +6,12 @@ import me.fzzyhmstrs.fzzy_config.annotations.IgnoreVisibility; import me.fzzyhmstrs.fzzy_config.api.ConfigApiJava; import me.fzzyhmstrs.fzzy_config.config.Config; -import me.fzzyhmstrs.fzzy_config.validation.collection.ValidatedList; +import me.fzzyhmstrs.fzzy_config.validation.collection.ValidatedSet; import me.fzzyhmstrs.fzzy_config.validation.minecraft.ValidatedIdentifier; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; import net.minecraft.util.Identifier; -import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -22,25 +21,31 @@ public class McdarArtifactsStatsConfig extends Config { public static final McdarArtifactsStatsConfig CONFIG = ConfigApiJava.registerAndLoadConfig(McdarArtifactsStatsConfig::new); - public float ARTIFACT_GENERAL_SPAWN_CHANCE = 0.25f; - public float ARTIFACT_DUNGEON_SPAWN_CHANCE = 0.1f; + private float artifactGeneralSpawnChance = 0.25f; + private float artifactDungeonSpawnChance = 0.1f; transient Set villager = GroupedObjectsHelper.VILLAGER_ARTIFACT_GENERAL_LOOT_TABLES.stream().map(RegistryKey::getValue).collect(Collectors.toSet()); transient Set illager = GroupedObjectsHelper.ILLAGER_ARTIFACT_GENERAL_LOOT_TABLES.stream().map(RegistryKey::getValue).collect(Collectors.toSet()); transient Set dungeon = GroupedObjectsHelper.ALL_ARTIFACTS_DUNGEON_LOOT_TABLES.stream().map(RegistryKey::getValue).collect(Collectors.toSet()); // Determines if the table is valid - private ValidatedList villagerLootTables = ValidatedIdentifier.ofDynamicKey(RegistryKeys.LOOT_TABLE, "mcdar_artifact_stats_villager_loot_tables", (id, entry) -> true).toList(villager); - private ValidatedList illagerLootTables = ValidatedIdentifier.ofDynamicKey(RegistryKeys.LOOT_TABLE, "mcdar_artifacts_stats_illager_loot_tables", (id, entry) -> true).toList(illager); - private ValidatedList dungeonLootTables = ValidatedIdentifier.ofDynamicKey(RegistryKeys.LOOT_TABLE, "mcdar_artifacts_stats_dungeon_loot_tables", (id, entry) -> true).toList(dungeon); - - private DamagingArtifactStats damagingArtifactStats = new DamagingArtifactStats(villager, illager, dungeon); - private AgilityArtifactStats agilityArtifactStats = new AgilityArtifactStats(villager, illager, dungeon); - private DefensiveArtifactStats defensiveArtifactStats = new DefensiveArtifactStats(villager, illager, dungeon); - private QuiverArtifactStats quiverArtifactStats = new QuiverArtifactStats(villager, illager, dungeon); - private StatusInflictingArtifactStats statusInflictingArtifactStats = new StatusInflictingArtifactStats(villager, illager, dungeon); - private SummoningArtifactStats summoningArtifactStats = new SummoningArtifactStats(villager, illager, dungeon); - + private ValidatedSet villagerLootTables = ValidatedIdentifier.ofDynamicKey(RegistryKeys.LOOT_TABLE, "mcdar_artifact_stats_villager_loot_tables", (id, entry) -> true).toSet(villager); + private ValidatedSet illagerLootTables = ValidatedIdentifier.ofDynamicKey(RegistryKeys.LOOT_TABLE, "mcdar_artifacts_stats_illager_loot_tables", (id, entry) -> true).toSet(illager); + private ValidatedSet dungeonLootTables = ValidatedIdentifier.ofDynamicKey(RegistryKeys.LOOT_TABLE, "mcdar_artifacts_stats_dungeon_loot_tables", (id, entry) -> true).toSet(dungeon); + + private DamagingArtifactStats damagingArtifactStats = new DamagingArtifactStats(); + private AgilityArtifactStats agilityArtifactStats = new AgilityArtifactStats(); + private DefensiveArtifactStats defensiveArtifactStats = new DefensiveArtifactStats(); + private QuiverArtifactStats quiverArtifactStats = new QuiverArtifactStats(); + private StatusInflictingArtifactStats statusInflictingArtifactStats = new StatusInflictingArtifactStats(); + private SummoningArtifactStats summoningArtifactStats = new SummoningArtifactStats(); + + public float mcdar$getGeneralSpawnChance() { + return artifactGeneralSpawnChance; + } + public float mcdar$getDungeonSpawnChance() { + return artifactDungeonSpawnChance; + } public DamagingArtifactStats mcdar$getDamagingArtifactStats() { return damagingArtifactStats; } @@ -61,15 +66,15 @@ public class McdarArtifactsStatsConfig extends Config { return statusInflictingArtifactStats; } - public List mcdar$getVillagerLootTables() { + public Set mcdar$getVillagerLootTables() { return villagerLootTables; } - public List mcdar$getIllagerLootTables() { + public Set mcdar$getIllagerLootTables() { return illagerLootTables; } - public List mcdar$getDungeonLootTables() { + public Set mcdar$getDungeonLootTables() { return dungeonLootTables; } @@ -78,6 +83,6 @@ public class McdarArtifactsStatsConfig extends Config { } public McdarArtifactsStatsConfig() { - super(ModConstants.ID("mcdar_artifacts_stats_config")); + super(ModConstants.id("mcdar_artifacts_stats_config")); } } \ No newline at end of file diff --git a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ArtifactStats.java index 0e0436b..348a111 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ArtifactStats.java @@ -3,11 +3,9 @@ import me.fzzyhmstrs.fzzy_config.annotations.Action; import me.fzzyhmstrs.fzzy_config.annotations.IgnoreVisibility; import me.fzzyhmstrs.fzzy_config.annotations.RequiresAction; +import me.fzzyhmstrs.fzzy_config.annotations.Translation; import me.fzzyhmstrs.fzzy_config.util.Walkable; import me.fzzyhmstrs.fzzy_config.validation.number.ValidatedInt; -import net.minecraft.util.Identifier; - -import java.util.Set; //ComplexArtifactStats(...) extends ArtifactStats @@ -15,24 +13,31 @@ public class ArtifactStats implements Walkable { // The visual order of the elements in the config is defined by the order of the fields below + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats") boolean isEnabled = true; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats") @RequiresAction(action = Action.RESTART) @ValidatedInt.Restrict(min = 1) - int durability; + int durability; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats") @ValidatedInt.Restrict(min = 1) - int maxCooldownEnchantmentTime; + int maxCooldownEnchantmentTime; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats") @RequiresAction(action = Action.RELOAD_DATA) - boolean isSpawnableInLoot = true; + boolean isSpawnableInLoot = true; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats") @RequiresAction(action = Action.RELOAD_DATA) @ValidatedInt.Restrict(min = 0) - int generalSpawnWeight; - //@RequiresAction(action = Action.RELOAD_DATA) - // ValidatedSet generalLootTables = ValidatedIdentifier.ofRegistryKey(RegistryKeys.LOOT_TABLE).toSet(); + int generalSpawnWeight; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats") @RequiresAction(action = Action.RELOAD_DATA) @ValidatedInt.Restrict(min = 0) - int dungeonSpawnWeight; - //@RequiresAction(action = Action.RELOAD_DATA) - // ValidatedSet dungeonLootTables = ValidatedIdentifier.ofDynamicKey(RegistryKeys.LOOT_TABLE, "mcdar_artifacts_stats", (id, entry) -> true).toSet(); + int dungeonSpawnWeight; public boolean mcdar$getIsEnabled() { return isEnabled; @@ -57,26 +62,17 @@ public class ArtifactStats implements Walkable { public int mcdar$getDungeonArtifactSpawnWeight() { return dungeonSpawnWeight; } - //public Set mcdar$getGeneralLootTables() { - // return generalLootTables; - //} - - //public Set mcdar$getDungeonLootTables() { - // return dungeonLootTables; - //} @SuppressWarnings("unused") public ArtifactStats() { } - public ArtifactStats(boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight, Set generalLootTables, Set dungeonLootTables) { + public ArtifactStats(boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { this.isEnabled = isEnabled; this.durability = durability; this.maxCooldownEnchantmentTime = maxCooldownEnchantmentTime; this.isSpawnableInLoot = isSpawnableInLoot; this.generalSpawnWeight = generalSpawnWeight; this.dungeonSpawnWeight = dungeonSpawnWeight; - //this.generalLootTables.validateAndSet(generalLootTables); - //this.dungeonLootTables.validateAndSet(dungeonLootTables); } } diff --git a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ComplexArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ComplexArtifactStats.java index 3b9479e..038b2b1 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ComplexArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ComplexArtifactStats.java @@ -2,16 +2,13 @@ import me.fzzyhmstrs.fzzy_config.annotations.IgnoreVisibility; import me.fzzyhmstrs.fzzy_config.util.Walkable; -import net.minecraft.util.Identifier; - -import java.util.Set; //ComplexArtifactStats(...) extends ArtifactStats // public ComplexArtifactStats BLAST_FUNGUS_STATS = ComplexArtifactStats(new DamageArtifactStat(5, 4) -// Congig.BLAST_FUNGUS_STATS.mcdar$getInnerStat().mcdar$getRange() +// Congig.BLAST_FUNGUS_STATS.mcdar$getRange() // public DamageArtifactStats BLAST_FUNGUS_STATS = DamageArtifactStats(range = 5, damage = 4, ;ggggggg) @@ -31,8 +28,8 @@ public class ComplexArtifactStats extends ArtifactStats { public ComplexArtifactStats() { } - public ComplexArtifactStats(T innerStat, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight, Set generalLootTables, Set dungeonLootTables) { - super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight, generalLootTables, dungeonLootTables); + public ComplexArtifactStats(T innerStat, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.innerStat = innerStat; } } diff --git a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/DamageArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/DamageArtifactStats.java index a47c58e..7dff301 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/DamageArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/DamageArtifactStats.java @@ -1,12 +1,15 @@ package dev.timefall.mcdar.config.artifact_types; import me.fzzyhmstrs.fzzy_config.annotations.IgnoreVisibility; -import me.fzzyhmstrs.fzzy_config.util.Walkable; +import me.fzzyhmstrs.fzzy_config.annotations.Translation; @IgnoreVisibility -public class DamageArtifactStats implements Walkable { +public class DamageArtifactStats extends ArtifactStats { + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage") float range; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage") float damage; public float mcdar$getRange() { @@ -17,11 +20,13 @@ public class DamageArtifactStats implements Walkable { return damage; } - public DamageArtifactStats(float range, float damage) { - this.range = range; - this.damage = damage; + public DamageArtifactStats() { + super(); } - public DamageArtifactStats() { + public DamageArtifactStats(float range, float damage, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super (isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); + this.range = range; + this.damage = damage; } } diff --git a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ExperienceDrainingArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ExperienceDrainingArtifactStats.java index 611a4bf..bb68c1c 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ExperienceDrainingArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/ExperienceDrainingArtifactStats.java @@ -1,18 +1,33 @@ package dev.timefall.mcdar.config.artifact_types; import me.fzzyhmstrs.fzzy_config.annotations.IgnoreVisibility; -import me.fzzyhmstrs.fzzy_config.util.Walkable; +import me.fzzyhmstrs.fzzy_config.annotations.Translation; @IgnoreVisibility -public class ExperienceDrainingArtifactStats implements Walkable { +public class ExperienceDrainingArtifactStats extends ArtifactStats { + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.experience_draining") int experienceDrain; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.experience_draining") float range; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.experience_draining") float damageOrHealingFactor; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.experience_draining") int damageOrHealing; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.experience_draining") int duration; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.experience_draining") int amplifier; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.experience_draining") int amplifier2; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.experience_draining") int amplifier3; public int mcdar$getExperienceDrain() { @@ -48,22 +63,30 @@ public class ExperienceDrainingArtifactStats implements Walkable { } - public ExperienceDrainingArtifactStats(int experienceDrain) { + public ExperienceDrainingArtifactStats(int experienceDrain, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.experienceDrain = experienceDrain; + } - public ExperienceDrainingArtifactStats(int experienceDrain, float range, float damageOrHealingFactor) { + public ExperienceDrainingArtifactStats(int experienceDrain, float range, float damageOrHealingFactor, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.experienceDrain = experienceDrain; this.range = range; this.damageOrHealingFactor = damageOrHealingFactor; + } - public ExperienceDrainingArtifactStats(int experienceDrain, float range, int damageOrHealing) { + + public ExperienceDrainingArtifactStats(int experienceDrain, float range, int damageOrHealing, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.experienceDrain = experienceDrain; this.range = range; this.damageOrHealing = damageOrHealing; + } - public ExperienceDrainingArtifactStats(int experienceDrain, float damageOrHealingFactor, float range, int duration, int amplifier, int amplifier2, int amplifier3) { + public ExperienceDrainingArtifactStats(int experienceDrain, float damageOrHealingFactor, float range, int duration, int amplifier, int amplifier2, int amplifier3, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.experienceDrain = experienceDrain; this.damageOrHealingFactor = damageOrHealingFactor; this.range = range; @@ -71,9 +94,11 @@ public ExperienceDrainingArtifactStats(int experienceDrain, float damageOrHealin this.amplifier = amplifier; this.amplifier2 = amplifier2; this.amplifier3 = amplifier3; + } - public ExperienceDrainingArtifactStats(int experienceDrain, int damageOrHealing, float range, int duration, int amplifier, int amplifier2, int amplifier3) { + public ExperienceDrainingArtifactStats(int experienceDrain, int damageOrHealing, float range, int duration, int amplifier, int amplifier2, int amplifier3, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.experienceDrain = experienceDrain; this.damageOrHealing = damageOrHealing; this.range = range; @@ -84,5 +109,6 @@ public ExperienceDrainingArtifactStats(int experienceDrain, int damageOrHealing, } public ExperienceDrainingArtifactStats() { + super(); } } diff --git a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/StatusCloudCreatingArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/StatusCloudCreatingArtifactStats.java index 171673d..9166f30 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/StatusCloudCreatingArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/StatusCloudCreatingArtifactStats.java @@ -1,17 +1,22 @@ package dev.timefall.mcdar.config.artifact_types; import me.fzzyhmstrs.fzzy_config.annotations.IgnoreVisibility; +import me.fzzyhmstrs.fzzy_config.annotations.Translation; import me.fzzyhmstrs.fzzy_config.util.Walkable; @IgnoreVisibility -public class StatusCloudCreatingArtifactStats implements Walkable { +public class StatusCloudCreatingArtifactStats extends ArtifactStats { + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.status_cloud_creating") float cloudRadius; + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.status_cloud_creating") int cloudDuration; + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.status_cloud_creating") int effectDuration; + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.status_cloud_creating") int amplifier; @@ -33,7 +38,8 @@ public class StatusCloudCreatingArtifactStats implements Walkable { - public StatusCloudCreatingArtifactStats(float cloudRadius, int cloudDuration, int effectDuration, int amplifier) { + public StatusCloudCreatingArtifactStats(float cloudRadius, int cloudDuration, int effectDuration, int amplifier, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.cloudRadius = cloudRadius; this.cloudDuration = cloudDuration; this.effectDuration = effectDuration; @@ -41,5 +47,6 @@ public StatusCloudCreatingArtifactStats(float cloudRadius, int cloudDuration, in } public StatusCloudCreatingArtifactStats() { + super(); } } diff --git a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/StatusGrantingArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/StatusGrantingArtifactStats.java index 3e3e268..5ce0a54 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/artifact_types/StatusGrantingArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/artifact_types/StatusGrantingArtifactStats.java @@ -1,18 +1,27 @@ package dev.timefall.mcdar.config.artifact_types; import me.fzzyhmstrs.fzzy_config.annotations.IgnoreVisibility; -import me.fzzyhmstrs.fzzy_config.util.Walkable; +import me.fzzyhmstrs.fzzy_config.annotations.Translation; @IgnoreVisibility -public class StatusGrantingArtifactStats implements Walkable { +public class StatusGrantingArtifactStats extends ArtifactStats { + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.status_granting") int duration; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.status_granting") int duration2; + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.status_granting") int amplifier; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.status_granting") int amplifier2; + + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.status_granting") int amplifier3; + @Translation(prefix = "mcdar.mcdar_artifacts_stats_config.artifact_stats.damage.status_granting") float range; @@ -36,38 +45,44 @@ public class StatusGrantingArtifactStats implements Walkable { return range; } - public StatusGrantingArtifactStats(int duration, int amplifier) { + public StatusGrantingArtifactStats(int duration, int amplifier, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.duration = duration; this.amplifier = amplifier; } - public StatusGrantingArtifactStats(int duration, int amplifier, int amplifier2) { + public StatusGrantingArtifactStats(int duration, int amplifier, int amplifier2, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.duration = duration; this.amplifier = amplifier; this.amplifier2 = amplifier2; } - public StatusGrantingArtifactStats(int duration, int amplifier, int amplifier2, int amplifier3) { + public StatusGrantingArtifactStats(int duration, int amplifier, int amplifier2, int amplifier3, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.duration = duration; this.amplifier = amplifier; this.amplifier2 = amplifier2; this.amplifier3 = amplifier3; } - public StatusGrantingArtifactStats(int duration, int amplifier, float range) { + public StatusGrantingArtifactStats(int duration, int amplifier, float range, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.duration = duration; this.amplifier = amplifier; this.range = range; } - public StatusGrantingArtifactStats(int duration, int amplifier, int amplifier2, float range) { + public StatusGrantingArtifactStats(int duration, int amplifier, int amplifier2, float range, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.duration = duration; this.amplifier = amplifier; this.amplifier2 = amplifier2; this.range = range; } - public StatusGrantingArtifactStats(int duration, int amplifier, int amplifier2, int amplifier3, float range) { + public StatusGrantingArtifactStats(int duration, int amplifier, int amplifier2, int amplifier3, float range, boolean isEnabled, boolean isSpawnableInLoot, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight) { + super(isEnabled, isSpawnableInLoot, durability, maxCooldownEnchantmentTime, generalSpawnWeight, dungeonSpawnWeight); this.duration = duration; this.amplifier = amplifier; this.amplifier2 = amplifier2; @@ -76,5 +91,6 @@ public StatusGrantingArtifactStats(int duration, int amplifier, int amplifier2, } public StatusGrantingArtifactStats() { + super(); } } diff --git a/common/src/main/java/dev/timefall/mcdar/config/item_sections/AgilityArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/item_sections/AgilityArtifactStats.java index 1d500b4..88b11de 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/item_sections/AgilityArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/item_sections/AgilityArtifactStats.java @@ -1,64 +1,61 @@ package dev.timefall.mcdar.config.item_sections; -import dev.timefall.mcdar.config.artifact_types.ComplexArtifactStats; import dev.timefall.mcdar.config.artifact_types.StatusGrantingArtifactStats; import me.fzzyhmstrs.fzzy_config.config.ConfigSection; -import net.minecraft.util.Identifier; - -import java.util.Set; public class AgilityArtifactStats extends ConfigSection { - public AgilityArtifactStats(Set villager, Set illager, Set dungeon) { + public AgilityArtifactStats() { super(); - this.BOOTS_OF_SWIFTNESS_STATS = new ComplexArtifactStats<>( - new StatusGrantingArtifactStats(40, 2), + this.BOOTS_OF_SWIFTNESS_STATS = new StatusGrantingArtifactStats( + 40, + 2, true, true, 64, 100, 2, - 1, - villager, - dungeon + 1 ); - this.DEATH_CAP_MUSHROOM_STATS = new ComplexArtifactStats<>( - new StatusGrantingArtifactStats(180, 3, 1), + this.DEATH_CAP_MUSHROOM_STATS = new StatusGrantingArtifactStats( + 180, + 3, + 1, true, true, 64, 600, 2, - 1, - illager, - dungeon + 1 ); - this.GHOST_CLOAK_STATS = new ComplexArtifactStats<>( - new StatusGrantingArtifactStats(60, 0, 3, 0), + this.GHOST_CLOAK_STATS = new StatusGrantingArtifactStats( + 60, + 0, + 3, + 0, true, true, 64, 120, 2, - 1, - villager, - dungeon + 1 ); - this.LIGHT_FEATHER_STATS = new ComplexArtifactStats<>( - new StatusGrantingArtifactStats(60, 0, 0, 4), + this.LIGHT_FEATHER_STATS = new StatusGrantingArtifactStats( + 60, + 0, + 0, + 4, true, true, 64, 120, 2, - 1, - villager, - dungeon + 1 ); } - public ComplexArtifactStats BOOTS_OF_SWIFTNESS_STATS; - public ComplexArtifactStats DEATH_CAP_MUSHROOM_STATS; - public ComplexArtifactStats GHOST_CLOAK_STATS; - public ComplexArtifactStats LIGHT_FEATHER_STATS; + public StatusGrantingArtifactStats BOOTS_OF_SWIFTNESS_STATS; + public StatusGrantingArtifactStats DEATH_CAP_MUSHROOM_STATS; + public StatusGrantingArtifactStats GHOST_CLOAK_STATS; + public StatusGrantingArtifactStats LIGHT_FEATHER_STATS; } diff --git a/common/src/main/java/dev/timefall/mcdar/config/item_sections/DamagingArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/item_sections/DamagingArtifactStats.java index 828356a..4dde683 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/item_sections/DamagingArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/item_sections/DamagingArtifactStats.java @@ -1,77 +1,69 @@ package dev.timefall.mcdar.config.item_sections; -import dev.timefall.mcdar.config.artifact_types.ComplexArtifactStats; import dev.timefall.mcdar.config.artifact_types.DamageArtifactStats; import dev.timefall.mcdar.config.artifact_types.ExperienceDrainingArtifactStats; import me.fzzyhmstrs.fzzy_config.config.ConfigSection; -import net.minecraft.util.Identifier; - -import java.util.Set; public class DamagingArtifactStats extends ConfigSection { - public DamagingArtifactStats(Set villager, Set illager, Set dungeon) { + public DamagingArtifactStats() { super(); - this.BLAST_FUNGUS_STATS = new ComplexArtifactStats<>( - new DamageArtifactStats(5f, 4f), + this.BLAST_FUNGUS_STATS = new DamageArtifactStats( + 5f, + 4f, true, true, 64, 120, 2, - 1, - illager, - dungeon + 1 ); - this.HARVESTER_STATS = new ComplexArtifactStats<>( - new ExperienceDrainingArtifactStats(40, 3f, 15f), + this.HARVESTER_STATS = new ExperienceDrainingArtifactStats( + 40, + 3f, + 15f, true, true, 64, 60, 2, - 1, - illager, - dungeon + 1 ); - this.LIGHTNING_ROD_STATS = new ComplexArtifactStats<>( - new DamageArtifactStats(5f, 5f), + this.LIGHTNING_ROD_STATS = new DamageArtifactStats( + 5f, + 5f, true, true, 64, 40, 2, - 1, - illager, - dungeon + 1 ); - this.POWERSHAKER_STATS = new ComplexArtifactStats<>( - new DamageArtifactStats(1f, 1f), + this.POWERSHAKER_STATS = new DamageArtifactStats( + 1f, + 1f, true, true, 64, 600, 2, - 1, - illager, - dungeon + 1 ); - this.UPDRAFT_TOME_STATS = new ComplexArtifactStats<>( - new DamageArtifactStats(1f, 1f), + this.UPDRAFT_TOME_STATS = new DamageArtifactStats( + 1f, + 1f, true, true, 64, 300, 2, - 1, - villager, - dungeon + 1 ); } - public ComplexArtifactStats BLAST_FUNGUS_STATS; - public ComplexArtifactStats HARVESTER_STATS; - public ComplexArtifactStats LIGHTNING_ROD_STATS; - public ComplexArtifactStats POWERSHAKER_STATS; - public ComplexArtifactStats UPDRAFT_TOME_STATS; + public DamageArtifactStats BLAST_FUNGUS_STATS; + public ExperienceDrainingArtifactStats HARVESTER_STATS; + public DamageArtifactStats LIGHTNING_ROD_STATS; + public DamageArtifactStats POWERSHAKER_STATS; + public DamageArtifactStats UPDRAFT_TOME_STATS; } diff --git a/common/src/main/java/dev/timefall/mcdar/config/item_sections/DefensiveArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/item_sections/DefensiveArtifactStats.java index 3849ab1..eb22cc8 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/item_sections/DefensiveArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/item_sections/DefensiveArtifactStats.java @@ -2,35 +2,31 @@ import dev.timefall.mcdar.config.artifact_types.*; import me.fzzyhmstrs.fzzy_config.config.ConfigSection; -import net.minecraft.util.Identifier; - -import java.util.Set; public class DefensiveArtifactStats extends ConfigSection { - public DefensiveArtifactStats(Set villager, Set illager, Set dungeon) { + public DefensiveArtifactStats() { super(); - this.ENCHANTERS_TOME_STATS = new ComplexArtifactStats<>( - new StatusGrantingArtifactStats(100, 2, 5f), + this.ENCHANTERS_TOME_STATS = new StatusGrantingArtifactStats( + 100, + 2, + 5f, true, true, 64, 100, 2, - 1, - illager, - dungeon + 1 ); - this.IRON_HIDE_AMULET_STATS = new ComplexArtifactStats<>( - new StatusGrantingArtifactStats(220, 1), + this.IRON_HIDE_AMULET_STATS = new StatusGrantingArtifactStats( + 220, + 1, true, true, 64, 500, 2, - 1, - villager, - dungeon + 1 ); this.SATCHEL_OF_ELIXIRS_STATS = new ArtifactStats( true, @@ -38,9 +34,7 @@ public DefensiveArtifactStats(Set villager, Set illager, 64, 120, 2, - 1, - villager, - dungeon + 1 ); this.SATCHEL_OF_SNACKS_STATS = new ArtifactStats( true, @@ -48,75 +42,75 @@ public DefensiveArtifactStats(Set villager, Set illager, 64, 120, 2, - 1, - villager, - dungeon + 1 ); - this.SOUL_HEALER_STATS = new ComplexArtifactStats<>( - new ExperienceDrainingArtifactStats(20, 12, 0.2f), + this.SOUL_HEALER_STATS = new ExperienceDrainingArtifactStats( + 20, + 12, + 0.2f, true, true, 64, 60, 2, - 1, - illager, - dungeon + 1 ); - this.TOTEM_OF_REGENERATION_STATS = new ComplexArtifactStats<>( - new StatusCloudCreatingArtifactStats(5.0f, 100, 100, 100), + this.TOTEM_OF_REGENERATION_STATS = new StatusCloudCreatingArtifactStats( + 5.0f, + 100, + 100, + 100, true, true, 64, 600, 2, - 1, - illager, - dungeon + 1 ); - this.TOTEM_OF_SHIELDING_STATS = new ComplexArtifactStats<>( - new StatusCloudCreatingArtifactStats(5.0f, 500, 40, 0), + this.TOTEM_OF_SHIELDING_STATS = new StatusCloudCreatingArtifactStats( + 5.0f, + 500, + 40, + 0, true, true, 64, 600, 2, - 1, - illager, - dungeon + 1 ); - this.TOTEM_OF_SOUL_PROTECTION_STATS = new ComplexArtifactStats<>( - new StatusCloudCreatingArtifactStats(5.0f, 500, 40, 0), + this.TOTEM_OF_SOUL_PROTECTION_STATS = new StatusCloudCreatingArtifactStats( + 5.0f, + 500, + 40, + 0, true, true, 64, 600, 2, - 1, - illager, - dungeon + 1 ); // Damage for the Wind Horn is the Knockback Multiplier - this.WIND_HORN_STATS = new ComplexArtifactStats<>( - new DamageArtifactStats(5f, 2.0f), + this.WIND_HORN_STATS = new DamageArtifactStats( + 5f, + 2.0f, true, true, 64, 250, 2, - 1, - villager, - dungeon + 1 ); } - public ComplexArtifactStats ENCHANTERS_TOME_STATS; - public ComplexArtifactStats IRON_HIDE_AMULET_STATS; + public StatusGrantingArtifactStats ENCHANTERS_TOME_STATS; + public StatusGrantingArtifactStats IRON_HIDE_AMULET_STATS; public ArtifactStats SATCHEL_OF_ELIXIRS_STATS; public ArtifactStats SATCHEL_OF_SNACKS_STATS; - public ComplexArtifactStats SOUL_HEALER_STATS; - public ComplexArtifactStats TOTEM_OF_REGENERATION_STATS; - public ComplexArtifactStats TOTEM_OF_SHIELDING_STATS; - public ComplexArtifactStats TOTEM_OF_SOUL_PROTECTION_STATS; - public ComplexArtifactStats WIND_HORN_STATS; + public ExperienceDrainingArtifactStats SOUL_HEALER_STATS; + public StatusCloudCreatingArtifactStats TOTEM_OF_REGENERATION_STATS; + public StatusCloudCreatingArtifactStats TOTEM_OF_SHIELDING_STATS; + public StatusCloudCreatingArtifactStats TOTEM_OF_SOUL_PROTECTION_STATS; + public DamageArtifactStats WIND_HORN_STATS; } diff --git a/common/src/main/java/dev/timefall/mcdar/config/item_sections/QuiverArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/item_sections/QuiverArtifactStats.java index d6df895..88ca55f 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/item_sections/QuiverArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/item_sections/QuiverArtifactStats.java @@ -1,16 +1,12 @@ package dev.timefall.mcdar.config.item_sections; import dev.timefall.mcdar.config.artifact_types.ArtifactStats; -import dev.timefall.mcdar.config.artifact_types.ComplexArtifactStats; import dev.timefall.mcdar.config.artifact_types.ExperienceDrainingArtifactStats; import me.fzzyhmstrs.fzzy_config.config.ConfigSection; -import net.minecraft.util.Identifier; - -import java.util.Set; public class QuiverArtifactStats extends ConfigSection { - public QuiverArtifactStats(Set villager, Set illager, Set dungeon) { + public QuiverArtifactStats() { super(); this.FLAMING_QUIVER_STATS = new ArtifactStats( true, @@ -18,9 +14,7 @@ public QuiverArtifactStats(Set villager, Set illager, Se 64, 600, 2, - 1, - villager, - dungeon + 1 ); this.HARPOON_QUIVER_STATS = new ArtifactStats( true, @@ -28,9 +22,7 @@ public QuiverArtifactStats(Set villager, Set illager, Se 64, 600, 2, - 1, - illager, - dungeon + 1 ); this.THUNDERING_QUIVER_STATS = new ArtifactStats( true, @@ -38,25 +30,21 @@ public QuiverArtifactStats(Set villager, Set illager, Se 64, 600, 2, - 1, - illager, - dungeon + 1 ); - this.TORMENT_QUIVER_STATS = new ComplexArtifactStats<>( - new ExperienceDrainingArtifactStats(20), + this.TORMENT_QUIVER_STATS = new ExperienceDrainingArtifactStats( + 20, true, true, 64, 600, 2, - 1, - illager, - dungeon + 1 ); } public ArtifactStats FLAMING_QUIVER_STATS; public ArtifactStats HARPOON_QUIVER_STATS; public ArtifactStats THUNDERING_QUIVER_STATS; - public ComplexArtifactStats TORMENT_QUIVER_STATS; + public ExperienceDrainingArtifactStats TORMENT_QUIVER_STATS; } diff --git a/common/src/main/java/dev/timefall/mcdar/config/item_sections/StatusInflictingArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/item_sections/StatusInflictingArtifactStats.java index bdefef4..001b3cd 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/item_sections/StatusInflictingArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/item_sections/StatusInflictingArtifactStats.java @@ -1,75 +1,81 @@ package dev.timefall.mcdar.config.item_sections; -import dev.timefall.mcdar.config.artifact_types.*; +import dev.timefall.mcdar.config.artifact_types.ExperienceDrainingArtifactStats; +import dev.timefall.mcdar.config.artifact_types.StatusGrantingArtifactStats; import me.fzzyhmstrs.fzzy_config.config.ConfigSection; -import net.minecraft.util.Identifier; - -import java.util.Set; public class StatusInflictingArtifactStats extends ConfigSection { - public StatusInflictingArtifactStats(Set villager, Set illager, Set dungeon) { + public StatusInflictingArtifactStats() { super(); - this.CORRUPTED_SEEDS_STATS = new ComplexArtifactStats<>( - new StatusGrantingArtifactStats(140, 4, 1, 5.0f), + this.CORRUPTED_SEEDS_STATS = new StatusGrantingArtifactStats( + 140, + 4, + 1, + 5.0f, true, true, 64, 100, 2, - 1, - illager, - dungeon + 1 ); - this.GONG_OF_WEAKENING_STATS = new ComplexArtifactStats<>( - new StatusGrantingArtifactStats(140, 1, -2, 5.0f), + this.GONG_OF_WEAKENING_STATS = new StatusGrantingArtifactStats( + 140, + 1, + -2, + 5.0f, true, true, 64, 100, 2, - 1, - illager, - dungeon + 1 ); - this.LOVE_MEDALLION_STATS = new ComplexArtifactStats<>( - new StatusGrantingArtifactStats(200, 0, 6.0f), + this.LOVE_MEDALLION_STATS = new StatusGrantingArtifactStats( + 200, + 0, + 6.0f, true, true, 64, 120, 2, - 1, - illager, - dungeon + 1 ); - this.SATCHEL_OF_ELEMENTS_STATS = new ComplexArtifactStats<>( - new ExperienceDrainingArtifactStats(15, 5.0f, 5.0f, 100, 0, 0, 4), + this.SATCHEL_OF_ELEMENTS_STATS = new ExperienceDrainingArtifactStats( + 15, + 5.0f, + 5.0f, + 100, + 0, + 0, + 4, true, true, 64, 60, 2, - 1, - illager, - dungeon + 1 ); - this.SHOCK_POWDER_STATS = new ComplexArtifactStats<>( - new StatusGrantingArtifactStats(100, 0, 0, 4, 0.5f), + this.SHOCK_POWDER_STATS = new StatusGrantingArtifactStats( + 100, + 0, + 0, + 4, + 0.5f, true, true, 64, 300, 2, - 1, - illager, - dungeon + 1 ); } - public ComplexArtifactStats CORRUPTED_SEEDS_STATS; - public ComplexArtifactStats GONG_OF_WEAKENING_STATS; - public ComplexArtifactStats LOVE_MEDALLION_STATS; - public ComplexArtifactStats SATCHEL_OF_ELEMENTS_STATS; - public ComplexArtifactStats SHOCK_POWDER_STATS; + public StatusGrantingArtifactStats CORRUPTED_SEEDS_STATS; + public StatusGrantingArtifactStats GONG_OF_WEAKENING_STATS; + public StatusGrantingArtifactStats LOVE_MEDALLION_STATS; + public ExperienceDrainingArtifactStats SATCHEL_OF_ELEMENTS_STATS; + public StatusGrantingArtifactStats SHOCK_POWDER_STATS; } diff --git a/common/src/main/java/dev/timefall/mcdar/config/item_sections/SummoningArtifactStats.java b/common/src/main/java/dev/timefall/mcdar/config/item_sections/SummoningArtifactStats.java index 4f8b2ec..5baa181 100644 --- a/common/src/main/java/dev/timefall/mcdar/config/item_sections/SummoningArtifactStats.java +++ b/common/src/main/java/dev/timefall/mcdar/config/item_sections/SummoningArtifactStats.java @@ -8,7 +8,7 @@ public class SummoningArtifactStats extends ConfigSection { - public SummoningArtifactStats(Set villager, Set illager, Set dungeon) { + public SummoningArtifactStats() { super(); this.BUZZY_NEST_STATS = new ArtifactStats( true, @@ -16,9 +16,7 @@ public SummoningArtifactStats(Set villager, Set illager, 8, 600, 2, - 1, - villager, - dungeon + 1 ); this.ENCHANTED_GRASS_STATS = new ArtifactStats( true, @@ -26,9 +24,7 @@ public SummoningArtifactStats(Set villager, Set illager, 8, 600, 2, - 1, - villager, - dungeon + 1 ); this.GOLEM_KIT_STATS = new ArtifactStats( true, @@ -36,9 +32,7 @@ public SummoningArtifactStats(Set villager, Set illager, 8, 600, 2, - 1, - villager, - dungeon + 1 ); this.TASTY_BONE_STATS = new ArtifactStats( true, @@ -46,9 +40,7 @@ public SummoningArtifactStats(Set villager, Set illager, 8, 600, 2, - 1, - villager, - dungeon + 1 ); this.WONDERFUL_WHEAT_STATS = new ArtifactStats( true, @@ -56,9 +48,7 @@ public SummoningArtifactStats(Set villager, Set illager, 8, 600, 2, - 1, - villager, - dungeon + 1 ); } diff --git a/common/src/main/java/dev/timefall/mcdar/effects/ArtifactEffects.java b/common/src/main/java/dev/timefall/mcdar/effect/ArtifactEffects.java similarity index 76% rename from common/src/main/java/dev/timefall/mcdar/effects/ArtifactEffects.java rename to common/src/main/java/dev/timefall/mcdar/effect/ArtifactEffects.java index 5210866..4a5918e 100644 --- a/common/src/main/java/dev/timefall/mcdar/effects/ArtifactEffects.java +++ b/common/src/main/java/dev/timefall/mcdar/effect/ArtifactEffects.java @@ -1,4 +1,4 @@ -package dev.timefall.mcdar.effects; +package dev.timefall.mcdar.effect; import dev.timefall.mcdar.api.AOECloudHelper; import dev.timefall.mcdar.api.AOEHelper; @@ -16,54 +16,53 @@ import net.minecraft.sound.SoundEvents; public class ArtifactEffects { - private static final float EXPLOSION_RADIUS = 3.0F; - public static void activatePowerShaker(PlayerEntity player, LivingEntity target) { + public static void mcdar$activatePowerShaker(PlayerEntity player, LivingEntity target) { // Temporary way to stop crash with Industrial Revolution Slaughter Block if (player.getName().toString().equals("slaughter")) { return; } ItemStack offhand = player.getOffHandStack(); - if (target != null && offhand.getItem() == ArtifactsRegistry.POWERSHAKER) { + if (target != null && offhand.getItem() == ArtifactsRegistry.POWERSHAKER.get()) { if (CleanlinessHelper.isCoolingDown(player, offhand.getItem()) && CleanlinessHelper.percentToOccur(20)) { CleanlinessHelper.playCenteredSound(target, SoundEvents.ENTITY_GENERIC_EXPLODE.value(), 0.5F, 1.0F); - AOECloudHelper.spawnExplosionCloud(player, target, EXPLOSION_RADIUS); + AOECloudHelper.spawnExplosionCloud(player, target, McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().POWERSHAKER_STATS.mcdar$getRange()); AOEHelper.affectNearbyEntities(player, 3.0f, (nearbyEntity) -> AbilityHelper.isAoeTarget(nearbyEntity, player, target), - livingEntity -> AOEHelper.causeExplosion(player, target, target.getMaxHealth() * 0.2F, EXPLOSION_RADIUS) + livingEntity -> AOEHelper.causeExplosion(player, target, target.getMaxHealth() * 0.2F, McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().POWERSHAKER_STATS.mcdar$getRange()) ); } } } - public static void causeBlastFungusExplosions(LivingEntity user, float distance, float damageAmount) { + public static void mcdar$causeBlastFungusExplosions(LivingEntity user, float distance, float damageAmount) { AOEHelper.affectNearbyEntities(user, distance, (nearbyEntity) -> AbilityHelper.isAoeTarget(nearbyEntity, user, nearbyEntity), livingEntity -> { if (!(livingEntity instanceof PlayerEntity playerEntity && playerEntity.getAbilities().creativeMode)) { - AOECloudHelper.spawnExplosionCloud(user, livingEntity, EXPLOSION_RADIUS); + AOECloudHelper.spawnExplosionCloud(user, livingEntity, McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().BLAST_FUNGUS_STATS.mcdar$getRange()); AOEHelper.causeExplosion(user, livingEntity, damageAmount, distance); } } ); } - public static void enchantersTomeEffects(PlayerEntity user) { - for (LivingEntity nearbyEntity : AOEHelper.getEntitiesByPredicate(user, McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().ENCHANTERS_TOME_STATS.mcdar$getInnerStat().mcdar$getRange(), + public static void mcdar$enchantersTomeEffects(PlayerEntity user) { + for (LivingEntity nearbyEntity : AOEHelper.getEntitiesByPredicate(user, McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().ENCHANTERS_TOME_STATS.mcdar$getRange(), (nearbyEntity) -> AbilityHelper.isPetOf(nearbyEntity, user))){ StatusEffect[] statuses = {StatusEffects.HASTE.value(), StatusEffects.STRENGTH.value(), StatusEffects.SPEED.value()}; StatusEffectInstance statusEffectInstance = new StatusEffectInstance(RegistryEntry.of( statuses[CleanlinessHelper.RANDOM.nextInt(statuses.length)]), - McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().ENCHANTERS_TOME_STATS.mcdar$getInnerStat().mcdar$getDuration(), - McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().ENCHANTERS_TOME_STATS.mcdar$getInnerStat().mcdar$getAmplifier() + McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().ENCHANTERS_TOME_STATS.mcdar$getDuration(), + McdarArtifactsStatsConfig.CONFIG.mcdar$getDefensiveArtifactStats().ENCHANTERS_TOME_STATS.mcdar$getAmplifier() ); nearbyEntity.addStatusEffect(statusEffectInstance); } } - public static void updraftNearbyEnemies(PlayerEntity user) { + public static void mcdar$updraftNearbyEnemies(PlayerEntity user) { for (LivingEntity nearbyEntity : AOEHelper.getEntitiesByPredicate(user, 5, (nearbyEntity) -> nearbyEntity != user && !AbilityHelper.isPetOf(nearbyEntity, user) && nearbyEntity.isAlive())){ nearbyEntity.setVelocity(0.0D, 1.25D, 0.0D); diff --git a/common/src/main/java/dev/timefall/mcdar/effects/EnchantmentEffects.java b/common/src/main/java/dev/timefall/mcdar/effect/EnchantmentEffects.java similarity index 97% rename from common/src/main/java/dev/timefall/mcdar/effects/EnchantmentEffects.java rename to common/src/main/java/dev/timefall/mcdar/effect/EnchantmentEffects.java index 766c88b..d8e2b39 100644 --- a/common/src/main/java/dev/timefall/mcdar/effects/EnchantmentEffects.java +++ b/common/src/main/java/dev/timefall/mcdar/effect/EnchantmentEffects.java @@ -1,4 +1,4 @@ -package dev.timefall.mcdar.effects; +package dev.timefall.mcdar.effect; import dev.timefall.mcdar.api.AOECloudHelper; import dev.timefall.mcdar.api.AOEHelper; @@ -64,7 +64,7 @@ public static void activateBeastBurst(PlayerEntity player, ServerWorld serverWor float explosionRadius = 3.0f; List potionEffects = PotionContentsComponent.DEFAULT.customEffects(); if (potionEffects.isEmpty()) return; - if (potionEffects.get(0).getEffectType() == StatusEffects.INSTANT_HEALTH){ + if (CleanlinessHelper.mcdar$isValidForBeastEffects(potionEffects)) { Optional> entry = serverWorld.getRegistryManager().get(RegistryKeys.ENCHANTMENT).getEntry(EnchantmentRegistry.BEAST_BURST); int beastBurstLevel = entry.map(e -> EnchantmentHelper.getEquipmentLevel(e, player)).orElse(0); @@ -84,7 +84,7 @@ public static void activateBeastSurge(PlayerEntity player, ServerWorld serverWor List potionEffects = PotionContentsComponent.DEFAULT.customEffects(); if (potionEffects.isEmpty()) return; if (potionEffects.get(0).getEffectType().equals(StatusEffects.INSTANT_HEALTH)) { - Optional> entry = serverWorld.getRegistryManager().get(RegistryKeys.ENCHANTMENT).getEntry(EnchantmentRegistry.BEAST_BURST); + Optional> entry = serverWorld.getRegistryManager().get(RegistryKeys.ENCHANTMENT).getEntry(EnchantmentRegistry.BEAST_SURGE); int beastSurgeLevel = entry.map(e -> EnchantmentHelper.getEquipmentLevel(e, player)).orElse(0); if (beastSurgeLevel > 0) { diff --git a/common/src/main/java/dev/timefall/mcdar/entities/BuzzyNestBeeEntity.java b/common/src/main/java/dev/timefall/mcdar/entity/BuzzyNestBeeEntity.java similarity index 98% rename from common/src/main/java/dev/timefall/mcdar/entities/BuzzyNestBeeEntity.java rename to common/src/main/java/dev/timefall/mcdar/entity/BuzzyNestBeeEntity.java index 57d9db6..6995ca0 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/BuzzyNestBeeEntity.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/BuzzyNestBeeEntity.java @@ -1,4 +1,4 @@ -package dev.timefall.mcdar.entities; +package dev.timefall.mcdar.entity; import dev.timefall.mcdar.api.interfaces.Summonable; import net.minecraft.entity.Entity; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/EnchantedGrassBlueSheepEntity.java b/common/src/main/java/dev/timefall/mcdar/entity/EnchantedGrassBlueSheepEntity.java similarity index 95% rename from common/src/main/java/dev/timefall/mcdar/entities/EnchantedGrassBlueSheepEntity.java rename to common/src/main/java/dev/timefall/mcdar/entity/EnchantedGrassBlueSheepEntity.java index b947b11..add5ca5 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/EnchantedGrassBlueSheepEntity.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/EnchantedGrassBlueSheepEntity.java @@ -1,9 +1,9 @@ -package dev.timefall.mcdar.entities; +package dev.timefall.mcdar.entity; import dev.timefall.mcdar.api.SummoningHelper; import dev.timefall.mcdar.api.interfaces.Summonable; -import dev.timefall.mcdar.goals.FollowSummonerGoal; -import dev.timefall.mcdar.goals.TrackSummonerAttackerGoal; +import dev.timefall.mcdar.goal.FollowSummonerGoal; +import dev.timefall.mcdar.goal.TrackSummonerAttackerGoal; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/EnchantedGrassGreenSheepEntity.java b/common/src/main/java/dev/timefall/mcdar/entity/EnchantedGrassGreenSheepEntity.java similarity index 97% rename from common/src/main/java/dev/timefall/mcdar/entities/EnchantedGrassGreenSheepEntity.java rename to common/src/main/java/dev/timefall/mcdar/entity/EnchantedGrassGreenSheepEntity.java index 4cf5fd6..2b8a131 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/EnchantedGrassGreenSheepEntity.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/EnchantedGrassGreenSheepEntity.java @@ -1,8 +1,8 @@ -package dev.timefall.mcdar.entities; +package dev.timefall.mcdar.entity; import dev.timefall.mcdar.api.SummoningHelper; import dev.timefall.mcdar.api.interfaces.Summonable; -import dev.timefall.mcdar.goals.FollowSummonerGoal; +import dev.timefall.mcdar.goal.FollowSummonerGoal; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/EnchantedGrassRedSheepEntity.java b/common/src/main/java/dev/timefall/mcdar/entity/EnchantedGrassRedSheepEntity.java similarity index 95% rename from common/src/main/java/dev/timefall/mcdar/entities/EnchantedGrassRedSheepEntity.java rename to common/src/main/java/dev/timefall/mcdar/entity/EnchantedGrassRedSheepEntity.java index 0255adb..a13725e 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/EnchantedGrassRedSheepEntity.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/EnchantedGrassRedSheepEntity.java @@ -1,9 +1,9 @@ -package dev.timefall.mcdar.entities; +package dev.timefall.mcdar.entity; import dev.timefall.mcdar.api.SummoningHelper; import dev.timefall.mcdar.api.interfaces.Summonable; -import dev.timefall.mcdar.goals.FollowSummonerGoal; -import dev.timefall.mcdar.goals.TrackSummonerAttackerGoal; +import dev.timefall.mcdar.goal.FollowSummonerGoal; +import dev.timefall.mcdar.goal.TrackSummonerAttackerGoal; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/GolemKitGolemEntity.java b/common/src/main/java/dev/timefall/mcdar/entity/GolemKitGolemEntity.java similarity index 96% rename from common/src/main/java/dev/timefall/mcdar/entities/GolemKitGolemEntity.java rename to common/src/main/java/dev/timefall/mcdar/entity/GolemKitGolemEntity.java index 4487708..d7ff5d2 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/GolemKitGolemEntity.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/GolemKitGolemEntity.java @@ -1,8 +1,8 @@ -package dev.timefall.mcdar.entities; +package dev.timefall.mcdar.entity; import dev.timefall.mcdar.api.SummoningHelper; import dev.timefall.mcdar.api.interfaces.Summonable; -import dev.timefall.mcdar.goals.FollowSummonerGoal; +import dev.timefall.mcdar.goal.FollowSummonerGoal; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/SummonedEntityType.java b/common/src/main/java/dev/timefall/mcdar/entity/SummonedEntityType.java similarity index 86% rename from common/src/main/java/dev/timefall/mcdar/entities/SummonedEntityType.java rename to common/src/main/java/dev/timefall/mcdar/entity/SummonedEntityType.java index 7925374..e7e820b 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/SummonedEntityType.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/SummonedEntityType.java @@ -1,4 +1,4 @@ -package dev.timefall.mcdar.entities; +package dev.timefall.mcdar.entity; import dev.timefall.mcdar.ModConstants; import net.minecraft.entity.Entity; @@ -15,7 +15,7 @@ public class SummonedEntityType { EntityType.Builder.create(BuzzyNestBeeEntity::new, SpawnGroup.CREATURE) .dimensions(0.7F, 0.6F) .eyeHeight(0.3F) - .build(ModConstants.ID("buzzy_nest_bee").toString()) + .build(ModConstants.id("buzzy_nest_bee").toString()) ); public static final EntityType ENCHANTED_GRASS_GREEN_SHEEP_ENTITY = registerEntity( "enchanted_grass_green_sheep", @@ -24,7 +24,7 @@ public class SummonedEntityType { .eyeHeight(1.235F) .passengerAttachments(1.2375F) //.maxTrackingRange(10) - .build(ModConstants.ID("enchanted_grass_green_sheep").toString()) + .build(ModConstants.id("enchanted_grass_green_sheep").toString()) ); public static final EntityType ENCHANTED_GRASS_BLUE_SHEEP_ENTITY = registerEntity( "enchanted_grass_blue_sheep", @@ -33,7 +33,7 @@ public class SummonedEntityType { .eyeHeight(1.235F) .passengerAttachments(1.2375F) //.maxTrackingRange(10) - .build(ModConstants.ID("enchanted_grass_blue_sheep").toString()) + .build(ModConstants.id("enchanted_grass_blue_sheep").toString()) ); public static final EntityType ENCHANTED_GRASS_RED_SHEEP_ENTITY = registerEntity( "enchanted_grass_red_sheep", @@ -42,13 +42,13 @@ public class SummonedEntityType { .eyeHeight(1.235F) .passengerAttachments(1.2375F) //.maxTrackingRange(10) - .build(ModConstants.ID("enchanted_grass_red_sheep").toString()) + .build(ModConstants.id("enchanted_grass_red_sheep").toString()) ); public static final EntityType GOLEM_KIT_GOLEM_ENTITY = registerEntity( "golem_kit_golem", EntityType.Builder.create(GolemKitGolemEntity::new, SpawnGroup.CREATURE) .dimensions(1.4f, 2.7f) - .build(ModConstants.ID("golem_kit_golem").toString()) + .build(ModConstants.id("golem_kit_golem").toString()) ); public static final EntityType TASTY_BONE_WOLF_ENTITY = registerEntity( "tasty_bone_wolf", @@ -56,7 +56,7 @@ public class SummonedEntityType { .dimensions(0.6f, 0.85f) .eyeHeight(0.68F) .passengerAttachments(new Vec3d(0.0, 0.81875, -0.0625)) - .build(ModConstants.ID("tasty_bone_wolf").toString()) + .build(ModConstants.id("tasty_bone_wolf").toString()) ); public static final EntityType WONDERFUL_WHEAT_LLAMA_ENTITY = registerEntity( "wonderful_wheat_llama", @@ -64,10 +64,10 @@ public class SummonedEntityType { .dimensions(0.9F, 1.87F) .eyeHeight(1.7765F) .passengerAttachments(new Vec3d(0.0, 1.37, -0.3)) - .build(ModConstants.ID("wonderful_wheat_llama").toString()) + .build(ModConstants.id("wonderful_wheat_llama").toString()) ); private static EntityType registerEntity(String id, EntityType type) { - return Registry.register(Registries.ENTITY_TYPE, ModConstants.ID(id), type); + return Registry.register(Registries.ENTITY_TYPE, ModConstants.id(id), type); } } diff --git a/common/src/main/java/dev/timefall/mcdar/entities/TastyBoneWolfEntity.java b/common/src/main/java/dev/timefall/mcdar/entity/TastyBoneWolfEntity.java similarity index 96% rename from common/src/main/java/dev/timefall/mcdar/entities/TastyBoneWolfEntity.java rename to common/src/main/java/dev/timefall/mcdar/entity/TastyBoneWolfEntity.java index 91b636b..de0c2e4 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/TastyBoneWolfEntity.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/TastyBoneWolfEntity.java @@ -1,9 +1,9 @@ -package dev.timefall.mcdar.entities; +package dev.timefall.mcdar.entity; import dev.timefall.mcdar.api.SummoningHelper; import dev.timefall.mcdar.api.interfaces.Summonable; -import dev.timefall.mcdar.goals.FollowSummonerGoal; -import dev.timefall.mcdar.goals.TrackSummonerAttackerGoal; +import dev.timefall.mcdar.goal.FollowSummonerGoal; +import dev.timefall.mcdar.goal.TrackSummonerAttackerGoal; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/WonderfulWheatLlamaEntity.java b/common/src/main/java/dev/timefall/mcdar/entity/WonderfulWheatLlamaEntity.java similarity index 96% rename from common/src/main/java/dev/timefall/mcdar/entities/WonderfulWheatLlamaEntity.java rename to common/src/main/java/dev/timefall/mcdar/entity/WonderfulWheatLlamaEntity.java index 1473697..d02524b 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/WonderfulWheatLlamaEntity.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/WonderfulWheatLlamaEntity.java @@ -1,8 +1,8 @@ -package dev.timefall.mcdar.entities; +package dev.timefall.mcdar.entity; import dev.timefall.mcdar.api.SummoningHelper; import dev.timefall.mcdar.api.interfaces.Summonable; -import dev.timefall.mcdar.goals.FollowSummonerGoal; +import dev.timefall.mcdar.goal.FollowSummonerGoal; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/BuzzyNestBeeRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/BuzzyNestBeeRenderer.java similarity index 93% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/BuzzyNestBeeRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/BuzzyNestBeeRenderer.java index ff9ae62..76ba263 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/BuzzyNestBeeRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/BuzzyNestBeeRenderer.java @@ -1,6 +1,6 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; -import dev.timefall.mcdar.entities.BuzzyNestBeeEntity; +import dev.timefall.mcdar.entity.BuzzyNestBeeEntity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.render.entity.EntityRendererFactory; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassBlueSheepRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassBlueSheepRenderer.java similarity index 88% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassBlueSheepRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassBlueSheepRenderer.java index 80f67e1..5b6d03c 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassBlueSheepRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassBlueSheepRenderer.java @@ -1,6 +1,6 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; -import dev.timefall.mcdar.entities.EnchantedGrassBlueSheepEntity; +import dev.timefall.mcdar.entity.EnchantedGrassBlueSheepEntity; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.client.render.entity.model.EntityModelLayers; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassBlueSheepWoolFeatureRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassBlueSheepWoolFeatureRenderer.java similarity index 96% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassBlueSheepWoolFeatureRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassBlueSheepWoolFeatureRenderer.java index ce41828..96a54dd 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassBlueSheepWoolFeatureRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassBlueSheepWoolFeatureRenderer.java @@ -1,6 +1,6 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; -import dev.timefall.mcdar.entities.EnchantedGrassBlueSheepEntity; +import dev.timefall.mcdar.entity.EnchantedGrassBlueSheepEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumer; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassGreenSheepRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassGreenSheepRenderer.java similarity index 88% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassGreenSheepRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassGreenSheepRenderer.java index 5aebb3a..eb0369b 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassGreenSheepRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassGreenSheepRenderer.java @@ -1,6 +1,6 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; -import dev.timefall.mcdar.entities.EnchantedGrassGreenSheepEntity; +import dev.timefall.mcdar.entity.EnchantedGrassGreenSheepEntity; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.client.render.entity.model.EntityModelLayers; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassGreenSheepWoolFeatureRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassGreenSheepWoolFeatureRenderer.java similarity index 96% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassGreenSheepWoolFeatureRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassGreenSheepWoolFeatureRenderer.java index 1ec5031..6d3c4d0 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassGreenSheepWoolFeatureRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassGreenSheepWoolFeatureRenderer.java @@ -1,6 +1,6 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; -import dev.timefall.mcdar.entities.EnchantedGrassGreenSheepEntity; +import dev.timefall.mcdar.entity.EnchantedGrassGreenSheepEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumer; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassRedSheepRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassRedSheepRenderer.java similarity index 88% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassRedSheepRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassRedSheepRenderer.java index 96b22a1..7f515fc 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassRedSheepRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassRedSheepRenderer.java @@ -1,6 +1,6 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; -import dev.timefall.mcdar.entities.EnchantedGrassRedSheepEntity; +import dev.timefall.mcdar.entity.EnchantedGrassRedSheepEntity; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.client.render.entity.model.EntityModelLayers; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassRedSheepWoolFeatureRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassRedSheepWoolFeatureRenderer.java similarity index 96% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassRedSheepWoolFeatureRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassRedSheepWoolFeatureRenderer.java index 00740ff..4ac0951 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/EnchantedGrassRedSheepWoolFeatureRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/EnchantedGrassRedSheepWoolFeatureRenderer.java @@ -1,6 +1,6 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; -import dev.timefall.mcdar.entities.EnchantedGrassRedSheepEntity; +import dev.timefall.mcdar.entity.EnchantedGrassRedSheepEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumer; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/GolemKitGolemCrackFeatureRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/GolemKitGolemCrackFeatureRenderer.java similarity index 95% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/GolemKitGolemCrackFeatureRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/GolemKitGolemCrackFeatureRenderer.java index 051d770..1553a4f 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/GolemKitGolemCrackFeatureRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/GolemKitGolemCrackFeatureRenderer.java @@ -1,7 +1,7 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; import com.google.common.collect.ImmutableMap; -import dev.timefall.mcdar.entities.GolemKitGolemEntity; +import dev.timefall.mcdar.entity.GolemKitGolemEntity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.render.VertexConsumerProvider; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/GolemKitGolemRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/GolemKitGolemRenderer.java similarity index 89% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/GolemKitGolemRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/GolemKitGolemRenderer.java index d59fd14..24cb3ad 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/GolemKitGolemRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/GolemKitGolemRenderer.java @@ -1,6 +1,6 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; -import dev.timefall.mcdar.entities.GolemKitGolemEntity; +import dev.timefall.mcdar.entity.GolemKitGolemEntity; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.client.render.entity.model.EntityModelLayers; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/TastyBoneWolfRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/TastyBoneWolfRenderer.java similarity index 94% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/TastyBoneWolfRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/TastyBoneWolfRenderer.java index ddaaa3e..69d930e 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/TastyBoneWolfRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/TastyBoneWolfRenderer.java @@ -1,6 +1,6 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; -import dev.timefall.mcdar.entities.TastyBoneWolfEntity; +import dev.timefall.mcdar.entity.TastyBoneWolfEntity; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.MobEntityRenderer; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/WonderfulWheatLlamaDecorFeatureRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/WonderfulWheatLlamaDecorFeatureRenderer.java similarity index 94% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/WonderfulWheatLlamaDecorFeatureRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/WonderfulWheatLlamaDecorFeatureRenderer.java index 7308330..f423429 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/WonderfulWheatLlamaDecorFeatureRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/WonderfulWheatLlamaDecorFeatureRenderer.java @@ -1,6 +1,6 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; -import dev.timefall.mcdar.entities.WonderfulWheatLlamaEntity; +import dev.timefall.mcdar.entity.WonderfulWheatLlamaEntity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.render.OverlayTexture; diff --git a/common/src/main/java/dev/timefall/mcdar/entities/renderers/WonderfulWheatLlamaRenderer.java b/common/src/main/java/dev/timefall/mcdar/entity/renderers/WonderfulWheatLlamaRenderer.java similarity index 88% rename from common/src/main/java/dev/timefall/mcdar/entities/renderers/WonderfulWheatLlamaRenderer.java rename to common/src/main/java/dev/timefall/mcdar/entity/renderers/WonderfulWheatLlamaRenderer.java index bd73baa..2823492 100644 --- a/common/src/main/java/dev/timefall/mcdar/entities/renderers/WonderfulWheatLlamaRenderer.java +++ b/common/src/main/java/dev/timefall/mcdar/entity/renderers/WonderfulWheatLlamaRenderer.java @@ -1,6 +1,6 @@ -package dev.timefall.mcdar.entities.renderers; +package dev.timefall.mcdar.entity.renderers; -import dev.timefall.mcdar.entities.WonderfulWheatLlamaEntity; +import dev.timefall.mcdar.entity.WonderfulWheatLlamaEntity; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.client.render.entity.model.EntityModelLayers; diff --git a/common/src/main/java/dev/timefall/mcdar/goals/FollowSummonerGoal.java b/common/src/main/java/dev/timefall/mcdar/goal/FollowSummonerGoal.java similarity index 98% rename from common/src/main/java/dev/timefall/mcdar/goals/FollowSummonerGoal.java rename to common/src/main/java/dev/timefall/mcdar/goal/FollowSummonerGoal.java index 37a2d43..8b39705 100644 --- a/common/src/main/java/dev/timefall/mcdar/goals/FollowSummonerGoal.java +++ b/common/src/main/java/dev/timefall/mcdar/goal/FollowSummonerGoal.java @@ -1,4 +1,4 @@ -package dev.timefall.mcdar.goals; +package dev.timefall.mcdar.goal; import dev.timefall.mcdar.api.SummoningHelper; import net.minecraft.entity.LivingEntity; diff --git a/common/src/main/java/dev/timefall/mcdar/goals/LoveMedallionAttackGoal.java b/common/src/main/java/dev/timefall/mcdar/goal/LoveMedallionAttackGoal.java similarity index 95% rename from common/src/main/java/dev/timefall/mcdar/goals/LoveMedallionAttackGoal.java rename to common/src/main/java/dev/timefall/mcdar/goal/LoveMedallionAttackGoal.java index c61623f..9a1a55d 100644 --- a/common/src/main/java/dev/timefall/mcdar/goals/LoveMedallionAttackGoal.java +++ b/common/src/main/java/dev/timefall/mcdar/goal/LoveMedallionAttackGoal.java @@ -1,4 +1,4 @@ -package dev.timefall.mcdar.goals; +package dev.timefall.mcdar.goal; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.ai.goal.ActiveTargetGoal; diff --git a/common/src/main/java/dev/timefall/mcdar/goals/TrackSummonerAttackerGoal.java b/common/src/main/java/dev/timefall/mcdar/goal/TrackSummonerAttackerGoal.java similarity index 98% rename from common/src/main/java/dev/timefall/mcdar/goals/TrackSummonerAttackerGoal.java rename to common/src/main/java/dev/timefall/mcdar/goal/TrackSummonerAttackerGoal.java index 7d71501..da26016 100644 --- a/common/src/main/java/dev/timefall/mcdar/goals/TrackSummonerAttackerGoal.java +++ b/common/src/main/java/dev/timefall/mcdar/goal/TrackSummonerAttackerGoal.java @@ -1,4 +1,4 @@ -package dev.timefall.mcdar.goals; +package dev.timefall.mcdar.goal; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.Tameable; diff --git a/common/src/main/java/dev/timefall/mcdar/mixin/BowItemMixin.java b/common/src/main/java/dev/timefall/mcdar/mixin/BowItemMixin.java index dce7854..06a4a4a 100644 --- a/common/src/main/java/dev/timefall/mcdar/mixin/BowItemMixin.java +++ b/common/src/main/java/dev/timefall/mcdar/mixin/BowItemMixin.java @@ -19,7 +19,7 @@ public abstract class BowItemMixin { @Inject(method = "shoot", at = @At(value = "HEAD")) public void onFlamingQuiverArrowLoosing(LivingEntity shooter, ProjectileEntity projectile, int index, float speed, float divergence, float yaw, LivingEntity target, CallbackInfo ci){ if (McdarArtifactsStatsConfig.CONFIG.mcdar$getQuiverArtifactStats().FLAMING_QUIVER_STATS.mcdar$getIsEnabled()){ - if (shooter.getOffHandStack().isOf(ArtifactsRegistry.FLAMING_QUIVER)) { + if (shooter.getOffHandStack().isOf(ArtifactsRegistry.FLAMING_QUIVER.get())) { if (shooter instanceof PlayerEntity playerEntity) { float effectTimer = playerEntity.getItemCooldownManager().getCooldownProgress(shooter.getOffHandStack().getItem(), 0); if (effectTimer > 0) { diff --git a/common/src/main/java/dev/timefall/mcdar/mixin/DefaultAttributeRegistryAccessor.java b/common/src/main/java/dev/timefall/mcdar/mixin/DefaultAttributeRegistryAccessor.java deleted file mode 100644 index 6032899..0000000 --- a/common/src/main/java/dev/timefall/mcdar/mixin/DefaultAttributeRegistryAccessor.java +++ /dev/null @@ -1,18 +0,0 @@ -package dev.timefall.mcdar.mixin; - -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.DefaultAttributeRegistry; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.Map; - -@Mixin(DefaultAttributeRegistry.class) -public interface DefaultAttributeRegistryAccessor { - @Accessor("DEFAULT_ATTRIBUTE_REGISTRY") - static Map, DefaultAttributeContainer> getRegistry() { - throw new AssertionError("mixin dummy"); - } -} diff --git a/common/src/main/java/dev/timefall/mcdar/mixin/ItemStackMixin.java b/common/src/main/java/dev/timefall/mcdar/mixin/ItemStackMixin.java deleted file mode 100644 index 032a94f..0000000 --- a/common/src/main/java/dev/timefall/mcdar/mixin/ItemStackMixin.java +++ /dev/null @@ -1,23 +0,0 @@ -package dev.timefall.mcdar.mixin; - -import dev.timefall.mcdar.registry.StatusEffectRegistry; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Hand; -import net.minecraft.util.TypedActionResult; -import net.minecraft.world.World; -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(ItemStack.class) -public class ItemStackMixin { - @Inject(method = "use", at = @At("HEAD"), cancellable = true) - public void onUsingBowWhilstStunned(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable> cir){ - if (user.hasStatusEffect(RegistryEntry.of(StatusEffectRegistry.STUNNED))){ - cir.setReturnValue(TypedActionResult.fail((ItemStack) (Object) this)); - } - } -} diff --git a/common/src/main/java/dev/timefall/mcdar/mixin/LivingEntityMixin.java b/common/src/main/java/dev/timefall/mcdar/mixin/LivingEntityMixin.java index 49bc046..1a19f3c 100644 --- a/common/src/main/java/dev/timefall/mcdar/mixin/LivingEntityMixin.java +++ b/common/src/main/java/dev/timefall/mcdar/mixin/LivingEntityMixin.java @@ -1,23 +1,17 @@ package dev.timefall.mcdar.mixin; -import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.effects.ArtifactEffects; -import dev.timefall.mcdar.effects.EnchantmentEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; import dev.timefall.mcdar.registry.StatusEffectRegistry; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.Tameable; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.Hand; 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.ModifyVariable; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @SuppressWarnings("ConstantConditions") @@ -28,7 +22,7 @@ public class LivingEntityMixin { public void onSoulProtectionDeath(DamageSource damageSource, CallbackInfoReturnable cir) { LivingEntity livingEntity = (LivingEntity) (Object) this; - if (livingEntity.hasStatusEffect(RegistryEntry.of(StatusEffectRegistry.SOUL_PROTECTION))) { + if (livingEntity.hasStatusEffect(StatusEffectRegistry.SOUL_PROTECTION.getEntry())) { livingEntity.setHealth(1.0F); livingEntity.clearStatusEffects(); livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 900, 1)); @@ -39,49 +33,13 @@ public void onSoulProtectionDeath(DamageSource damageSource, CallbackInfoReturna } } - @Inject(method = "swingHand(Lnet/minecraft/util/Hand;)V", at = @At("HEAD"), cancellable = true) - public void onAttackWhilstStunnedNoTarget(Hand hand, CallbackInfo ci) { - LivingEntity livingEntity = (LivingEntity) (Object) this; - - if (livingEntity.hasStatusEffect(RegistryEntry.of(StatusEffectRegistry.STUNNED))) { - ci.cancel(); - } - } - - @Inject(method = "onDeath", at = @At("HEAD")) - public void onPowershakerExplodingKill(DamageSource source, CallbackInfo ci) { - if (!(source.getAttacker() instanceof PlayerEntity player)) return; - - LivingEntity target = (LivingEntity) (Object) this; - - if (McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().POWERSHAKER_STATS.mcdar$getIsEnabled()) - ArtifactEffects.activatePowerShaker(player, target); - } - @ModifyVariable(method = "damage", at = @At(value = "HEAD"), argsOnly = true) public float mcdar$damageModifiers(float amount, DamageSource source) { if (source.getSource() instanceof Tameable summonedEntity) { if (source.getSource().getWorld() instanceof ServerWorld serverWorld) { - - //if (McdarCommon.CONFIG.mcdarEnchantmentsConfig.ENCHANTMENT_CONFIG.get(EnchantmentIds.BEAST_BOSS).mcdar$getIsEnabled()) amount *= EnchantmentEffects.beastBossDamage(summonedEntity, serverWorld); - } } return amount; } - - @Inject(method = "consumeItem", at = @At("HEAD")) - public void mcdar$onConsume(CallbackInfo ci) { - - if (!((Object) this instanceof PlayerEntity player)) return; - - if (player.isAlive() && player.getWorld() instanceof ServerWorld serverWorld) { - - //if (McdarCommon.CONFIG.mcdarEnchantmentsConfig.ENCHANTMENT_CONFIG.get(EnchantmentIds.BEAST_BURST).mcdar$getIsEnabled()) - EnchantmentEffects.activateBeastBurst(player, serverWorld); - //if (McdarCommon.CONFIG.mcdarEnchantmentsConfig.ENCHANTMENT_CONFIG.get(EnchantmentIds.BEAST_SURGE).mcdar$getIsEnabled()) - EnchantmentEffects.activateBeastSurge(player, serverWorld); - } - } } \ No newline at end of file diff --git a/common/src/main/java/dev/timefall/mcdar/mixin/MobEntityMixin.java b/common/src/main/java/dev/timefall/mcdar/mixin/MobEntityMixin.java index 4230c55..ed08693 100644 --- a/common/src/main/java/dev/timefall/mcdar/mixin/MobEntityMixin.java +++ b/common/src/main/java/dev/timefall/mcdar/mixin/MobEntityMixin.java @@ -12,7 +12,7 @@ public abstract class MobEntityMixin { @Inject(method = "isAiDisabled", at = @At("HEAD"), cancellable = true) public void onStunnedMob(CallbackInfoReturnable cir){ - if (((MobEntity) (Object) this).hasStatusEffect(RegistryEntry.of(StatusEffectRegistry.STUNNED))){ + if (((MobEntity) (Object) this).hasStatusEffect(StatusEffectRegistry.STUNNED.getEntry())){ cir.setReturnValue(true); } } diff --git a/common/src/main/java/dev/timefall/mcdar/mixin/PersistentProjectileEntityMixin.java b/common/src/main/java/dev/timefall/mcdar/mixin/PersistentProjectileEntityMixin.java index f14f5d0..3c101a3 100644 --- a/common/src/main/java/dev/timefall/mcdar/mixin/PersistentProjectileEntityMixin.java +++ b/common/src/main/java/dev/timefall/mcdar/mixin/PersistentProjectileEntityMixin.java @@ -36,10 +36,10 @@ public class PersistentProjectileEntityMixin { if (CleanlinessHelper.isCoolingDown(shooter, offhand.getItem())) { if (McdarArtifactsStatsConfig.CONFIG.mcdar$getQuiverArtifactStats().THUNDERING_QUIVER_STATS.mcdar$getIsEnabled()) - if (offhand.isOf(ArtifactsRegistry.THUNDERING_QUIVER)) + if (offhand.isOf(ArtifactsRegistry.THUNDERING_QUIVER.get())) AOEHelper.electrocute(livingEntity, (float) persistentProjectileEntity.getDamage()); if (McdarArtifactsStatsConfig.CONFIG.mcdar$getQuiverArtifactStats().TORMENT_QUIVER_STATS.mcdar$getIsEnabled()) - if (offhand.isOf(ArtifactsRegistry.TORMENT_QUIVER)) { + if (offhand.isOf(ArtifactsRegistry.TORMENT_QUIVER.get())) { // TODO: There's gotta be a better way to do this double d = Math.max(0.0, 1.0 - livingEntity.getAttributeValue(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE)); @@ -53,7 +53,7 @@ public class PersistentProjectileEntityMixin { } } // * Shielding Status Effect * // - if (livingEntity.hasStatusEffect(RegistryEntry.of(StatusEffectRegistry.SHIELDING))){ + if (livingEntity.hasStatusEffect(StatusEffectRegistry.SHIELDING.getEntry())){ if (ci.isCancellable()) ci.cancel(); ProjectileEffectHelper.ricochetArrowLikeShield(persistentProjectileEntity); @@ -69,7 +69,7 @@ public void onTormentingArrowBlockImpact(BlockHitResult blockHitResult, Callback if (ppe.getOwner() instanceof PlayerEntity shooter) { ItemStack offhand = shooter.getOffHandStack(); - if (offhand.isOf(ArtifactsRegistry.TORMENT_QUIVER)) { + if (offhand.isOf(ArtifactsRegistry.TORMENT_QUIVER.get())) { if (CleanlinessHelper.isCoolingDown(shooter, offhand.getItem())) { if (ci.isCancellable()) { ci.cancel(); @@ -88,7 +88,7 @@ public void onHarpoonArrowFire(CallbackInfoReturnable cir) { if (ppe.getOwner() instanceof PlayerEntity shooter) { ItemStack offhand = shooter.getOffHandStack(); - if (offhand.isOf(ArtifactsRegistry.HARPOON_QUIVER)) { + if (offhand.isOf(ArtifactsRegistry.HARPOON_QUIVER.get())) { if (CleanlinessHelper.isCoolingDown(shooter, offhand.getItem())) { if (ppe.isTouchingWater()) { float normDrag = cir.getReturnValueF(); diff --git a/common/src/main/java/dev/timefall/mcdar/mixin/PlayerEntityMixin.java b/common/src/main/java/dev/timefall/mcdar/mixin/PlayerEntityMixin.java index 0489b73..b499c18 100644 --- a/common/src/main/java/dev/timefall/mcdar/mixin/PlayerEntityMixin.java +++ b/common/src/main/java/dev/timefall/mcdar/mixin/PlayerEntityMixin.java @@ -1,9 +1,7 @@ package dev.timefall.mcdar.mixin; import dev.timefall.mcdar.registry.StatusEffectRegistry; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.registry.entry.RegistryEntry; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -11,16 +9,10 @@ @Mixin(PlayerEntity.class) public class PlayerEntityMixin { - @Inject(method = "attack", at = @At("HEAD"), cancellable = true) - public void onPlayerAttackWhilstStunnedTarget(Entity target, CallbackInfo ci) { - if (((PlayerEntity) (Object) this).hasStatusEffect(RegistryEntry.of(StatusEffectRegistry.STUNNED))){ - ci.cancel(); - } - } @Inject(method = "tickMovement", at = @At("HEAD"), cancellable = true) public void onPlayerMovementWhilstStunnedTarget(CallbackInfo ci) { - if (((PlayerEntity) (Object) this).hasStatusEffect(RegistryEntry.of(StatusEffectRegistry.STUNNED))){ + if (((PlayerEntity) (Object) this).hasStatusEffect(StatusEffectRegistry.STUNNED.getEntry())){ ci.cancel(); } } diff --git a/common/src/main/java/dev/timefall/mcdar/platform/IPlatformHelper.java b/common/src/main/java/dev/timefall/mcdar/platform/IPlatformHelper.java deleted file mode 100644 index e3bbfb5..0000000 --- a/common/src/main/java/dev/timefall/mcdar/platform/IPlatformHelper.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.timefall.mcdar.platform; - -public interface IPlatformHelper { - IPlatformHelper INSTANCE = ImplLoader.load(IPlatformHelper.class); - - /** - * Gets the name of the current platform - * - * @return The name of the current platform. - */ - String getPlatformName(); - - /** - * Checks if a mod with the given id is loaded. - * - * @param modId The mod to check if it is loaded. - * @return True if the mod is loaded, false otherwise. - */ - boolean isModLoaded(String modId); - - /** - * Check if the game is currently in a development environment. - * - * @return True if in a development environment, false otherwise. - */ - boolean isDevelopmentEnvironment(); -} diff --git a/common/src/main/java/dev/timefall/mcdar/platform/ImplLoader.java b/common/src/main/java/dev/timefall/mcdar/platform/ImplLoader.java deleted file mode 100644 index 358183d..0000000 --- a/common/src/main/java/dev/timefall/mcdar/platform/ImplLoader.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.timefall.mcdar.platform; - -import java.util.ServiceLoader; - -public class ImplLoader { - public static T load(Class clazz) { - return ServiceLoader.load(clazz) - .findFirst() - .orElseThrow(() -> new NullPointerException("Failed to load service for " + clazz.getName())); - } -} diff --git a/common/src/main/java/dev/timefall/mcdar/registry/ArtifactsRegistry.java b/common/src/main/java/dev/timefall/mcdar/registry/ArtifactsRegistry.java index 74b4b32..fe012fa 100644 --- a/common/src/main/java/dev/timefall/mcdar/registry/ArtifactsRegistry.java +++ b/common/src/main/java/dev/timefall/mcdar/registry/ArtifactsRegistry.java @@ -2,86 +2,60 @@ import dev.timefall.mcdar.ModConstants; import dev.timefall.mcdar.artifacts.*; +import me.fzzyhmstrs.fzzy_config.api.ConfigApiJava; +import me.fzzyhmstrs.fzzy_config.util.platform.Registrar; +import me.fzzyhmstrs.fzzy_config.util.platform.RegistrySupplier; import net.minecraft.item.Item; import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; import net.minecraft.registry.tag.InstrumentTags; public class ArtifactsRegistry { + private static final Registrar ITEM = ConfigApiJava.platform().createRegistrar(ModConstants.MOD_ID, Registries.ITEM); + // Illager Artifacts - public static final Item DEATH_CAP_MUSHROOM = new DeathCapMushroomItem(); - public static final Item BLAST_FUNGUS = new BlastFungusItem(); - public static final Item HARVESTER = new HarvesterItem(); - public static final Item LIGHTNING_ROD = new LightningRodItem(); - public static final Item POWERSHAKER = new PowershakerItem(); - public static final Item ENCHANTERS_TOME = new EnchantersTomeItem(); - public static final Item SOUL_HEALER = new SoulHealerItem(); - public static final Item TOTEM_OF_REGENERATION = new TotemOfRegenerationItem(); - public static final Item TOTEM_OF_SHIELDING = new TotemOfShieldingItem(); - public static final Item TOTEM_OF_SOUL_PROTECTION = new TotemOfSoulProtectionItem(); - public static final Item HARPOON_QUIVER = new HarpoonQuiverItem(); - public static final Item THUNDERING_QUIVER = new ThunderingQuiverItem(); - public static final Item TORMENT_QUIVER = new TormentQuiverItem(); - public static final Item CORRUPTED_SEEDS = new CorruptedSeedsItem(); - public static final Item GONG_OF_WEAKENING = new GongOfWeakeningItem(); - public static final Item LOVE_MEDALLION = new LoveMedallionItem(); - public static final Item SATCHEL_OF_ELEMENTS = new SatchelOfElementsItem(); - public static final Item SHOCK_POWDER = new ShockPowderItem(); + public static final RegistrySupplier DEATH_CAP_MUSHROOM = registerArtifacts("death_cap_mushroom", new DeathCapMushroomItem()); + public static final RegistrySupplier BLAST_FUNGUS = registerArtifacts("blast_fungus", new BlastFungusItem()); + public static final RegistrySupplier HARVESTER = registerArtifacts("harvester", new HarvesterItem()); + public static final RegistrySupplier LIGHTNING_ROD = registerArtifacts("lightning_rod", new LightningRodItem()); + public static final RegistrySupplier POWERSHAKER = registerArtifacts("powershaker", new PowershakerItem()); + public static final RegistrySupplier ENCHANTERS_TOME = registerArtifacts("enchanters_tome", new EnchantersTomeItem()); + public static final RegistrySupplier SOUL_HEALER = registerArtifacts("soul_healer", new SoulHealerItem()); + public static final RegistrySupplier TOTEM_OF_REGENERATION = registerArtifacts("totem_of_regeneration", new TotemOfRegenerationItem()); + public static final RegistrySupplier TOTEM_OF_SHIELDING = registerArtifacts("totem_of_shielding", new TotemOfShieldingItem()); + public static final RegistrySupplier TOTEM_OF_SOUL_PROTECTION = registerArtifacts("totem_of_soul_protection", new TotemOfSoulProtectionItem()); + public static final RegistrySupplier HARPOON_QUIVER = registerArtifacts("harpoon_quiver", new HarpoonQuiverItem()); + public static final RegistrySupplier THUNDERING_QUIVER = registerArtifacts("thundering_quiver", new ThunderingQuiverItem()); + public static final RegistrySupplier TORMENT_QUIVER = registerArtifacts("torment_quiver", new TormentQuiverItem()); + public static final RegistrySupplier CORRUPTED_SEEDS = registerArtifacts("corrupted_seeds", new CorruptedSeedsItem()); + public static final RegistrySupplier GONG_OF_WEAKENING = registerArtifacts("gong_of_weakening", new GongOfWeakeningItem()); + public static final RegistrySupplier LOVE_MEDALLION = registerArtifacts("love_medallion", new LoveMedallionItem()); + public static final RegistrySupplier SATCHEL_OF_ELEMENTS = registerArtifacts("satchel_of_elements", new SatchelOfElementsItem()); + public static final RegistrySupplier SHOCK_POWDER = registerArtifacts("shock_powder", new ShockPowderItem()); // Villager Artifacts - public static final Item BOOTS_OF_SWIFTNESS = new BootsOfSwiftnessItem(); - public static final Item GHOST_CLOAK = new GhostCloakItem(); - public static final Item LIGHT_FEATHER = new LightFeatherItem(); - public static final Item UPDRAFT_TOME = new UpdraftTomeItem(); - public static final Item IRON_HIDE_AMULET = new IronHideAmuletItem(); - public static final Item WIND_HORN = new WindHornItem(InstrumentTags.GOAT_HORNS); - public static final Item FLAMING_QUIVER = new FlamingQuiverItem(); - public static final Item BUZZY_NEST = new BuzzyNestItem(); - public static final Item ENCHANTED_GRASS = new EnchantedGrassItem(); - public static final Item GOLEM_KIT = new GolemKitItem(); - public static final Item TASTY_BONE = new TastyBoneItem(); - public static final Item WONDERFUL_WHEAT = new WonderfulWheatItem(); - public static final Item SATCHEL_OF_SNACKS = new SatchelOfSnacksItem(); - public static final Item SATCHEL_OF_ELIXERS = new SatchelOfElixirsItem(); - - public static void register() { - registerArtifacts("death_cap_mushroom", DEATH_CAP_MUSHROOM); - registerArtifacts("blast_fungus", BLAST_FUNGUS); - registerArtifacts("harvester", HARVESTER); - registerArtifacts("lightning_rod", LIGHTNING_ROD); - registerArtifacts("powershaker", POWERSHAKER); - registerArtifacts("enchanters_tome", ENCHANTERS_TOME); - registerArtifacts("soul_healer", SOUL_HEALER); - registerArtifacts("totem_of_regeneration", TOTEM_OF_REGENERATION); - registerArtifacts("totem_of_shielding", TOTEM_OF_SHIELDING); - registerArtifacts("totem_of_soul_protection", TOTEM_OF_SOUL_PROTECTION); - registerArtifacts("harpoon_quiver", HARPOON_QUIVER); - registerArtifacts("thundering_quiver", THUNDERING_QUIVER); - registerArtifacts("torment_quiver", TORMENT_QUIVER); - registerArtifacts("corrupted_seeds", CORRUPTED_SEEDS); - registerArtifacts("gong_of_weakening", GONG_OF_WEAKENING); - registerArtifacts("love_medallion", LOVE_MEDALLION); - registerArtifacts("satchel_of_elements", SATCHEL_OF_ELEMENTS); - registerArtifacts("shock_powder", SHOCK_POWDER); - - registerArtifacts("boots_of_swiftness", BOOTS_OF_SWIFTNESS); - registerArtifacts("ghost_cloak", GHOST_CLOAK); - registerArtifacts("light_feather", LIGHT_FEATHER); - registerArtifacts("updraft_tome", UPDRAFT_TOME); - registerArtifacts("iron_hide_amulet", IRON_HIDE_AMULET); - registerArtifacts("wind_horn", WIND_HORN); - registerArtifacts("flaming_quiver", FLAMING_QUIVER); - registerArtifacts("buzzy_nest", BUZZY_NEST); - registerArtifacts("enchanted_grass", ENCHANTED_GRASS); - registerArtifacts("golem_kit", GOLEM_KIT); - registerArtifacts("tasty_bone", TASTY_BONE); - registerArtifacts("wonderful_wheat", WONDERFUL_WHEAT); + public static final RegistrySupplier BOOTS_OF_SWIFTNESS = registerArtifacts("boots_of_swiftness", new BootsOfSwiftnessItem()); + public static final RegistrySupplier GHOST_CLOAK = registerArtifacts("ghost_cloak", new GhostCloakItem()); + public static final RegistrySupplier LIGHT_FEATHER = registerArtifacts("light_feather", new LightFeatherItem()); + public static final RegistrySupplier UPDRAFT_TOME = registerArtifacts("updraft_tome", new UpdraftTomeItem()); + public static final RegistrySupplier IRON_HIDE_AMULET = registerArtifacts("iron_hide_amulet", new IronHideAmuletItem()); + public static final RegistrySupplier WIND_HORN = registerArtifacts("wind_horn", new WindHornItem(InstrumentTags.GOAT_HORNS)); + public static final RegistrySupplier FLAMING_QUIVER = registerArtifacts("flaming_quiver", new FlamingQuiverItem()); + public static final RegistrySupplier BUZZY_NEST = registerArtifacts("buzzy_nest", new BuzzyNestItem()); + public static final RegistrySupplier ENCHANTED_GRASS = registerArtifacts("enchanted_grass", new EnchantedGrassItem()); + public static final RegistrySupplier GOLEM_KIT = registerArtifacts("golem_kit", new GolemKitItem()); + public static final RegistrySupplier TASTY_BONE = registerArtifacts("tasty_bone", new TastyBoneItem()); + public static final RegistrySupplier WONDERFUL_WHEAT = registerArtifacts("wonderful_wheat", new WonderfulWheatItem()); + public static final RegistrySupplier SATCHEL_OF_SNACKS = registerArtifacts("satchel_of_snacks", new SatchelOfSnacksItem()); + public static final RegistrySupplier SATCHEL_OF_ELIXERS = registerArtifacts("satchel_of_elixers", new SatchelOfElixirsItem()); + + protected static RegistrySupplier registerArtifacts(String id, Item item) { + return ITEM.register(id, () -> item); } - protected static void registerArtifacts(String id, Item item) { - Registry.register(Registries.ITEM, ModConstants.ID(id), item); + public static void register() { + ITEM.init(); } } diff --git a/common/src/main/java/dev/timefall/mcdar/registry/EnchantmentRegistry.java b/common/src/main/java/dev/timefall/mcdar/registry/EnchantmentRegistry.java index b721157..bd52a57 100644 --- a/common/src/main/java/dev/timefall/mcdar/registry/EnchantmentRegistry.java +++ b/common/src/main/java/dev/timefall/mcdar/registry/EnchantmentRegistry.java @@ -1,11 +1,7 @@ package dev.timefall.mcdar.registry; -import com.mojang.serialization.MapCodec; import dev.timefall.mcdar.ModConstants; import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.effect.EnchantmentEntityEffect; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; @@ -15,13 +11,8 @@ public class EnchantmentRegistry { public static RegistryKey BEAST_BURST = of("beast_burst"); public static RegistryKey BEAST_SURGE = of("beast_surge"); - - private static MapCodec registerEnchantmentEffect(String id, MapCodec codec) { - return Registry.register(Registries.ENCHANTMENT_ENTITY_EFFECT_TYPE, ModConstants.ID(id), codec); - } - private static RegistryKey of(String id) { - return RegistryKey.of(RegistryKeys.ENCHANTMENT, ModConstants.ID(id)); + return RegistryKey.of(RegistryKeys.ENCHANTMENT, ModConstants.id(id)); } public static void register() { diff --git a/common/src/main/java/dev/timefall/mcdar/registry/ItemGroupRegistry.java b/common/src/main/java/dev/timefall/mcdar/registry/ItemGroupRegistry.java index 475ad6b..cb266ba 100644 --- a/common/src/main/java/dev/timefall/mcdar/registry/ItemGroupRegistry.java +++ b/common/src/main/java/dev/timefall/mcdar/registry/ItemGroupRegistry.java @@ -1,67 +1,68 @@ package dev.timefall.mcdar.registry; import dev.timefall.mcdar.ModConstants; +import me.fzzyhmstrs.fzzy_config.api.ConfigApiJava; +import me.fzzyhmstrs.fzzy_config.util.platform.Registrar; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; import net.minecraft.text.Text; public class ItemGroupRegistry { - public static final RegistryKey ARTIFACTS = RegistryKey.of(RegistryKeys.ITEM_GROUP, ModConstants.ID("artifacts")); + + private static final Registrar ITEM_GROUP = ConfigApiJava.platform().createRegistrar(ModConstants.MOD_ID, Registries.ITEM_GROUP); public static void register() { - Registry.register(Registries.ITEM_GROUP, ARTIFACTS, ItemGroup.create(null, -1) + ITEM_GROUP.init(); + ITEM_GROUP.register("artifacts", () -> ItemGroup.create(null, -1) .displayName(Text.translatable("itemGroup.mcdar.artifacts")) - .icon(() -> new ItemStack(ArtifactsRegistry.LIGHTNING_ROD)) + .icon(() -> new ItemStack(ArtifactsRegistry.LIGHTNING_ROD.get())) .entries((displayContext, entries) -> { // AGILITY ARTEFACTS - entries.add(ArtifactsRegistry.BOOTS_OF_SWIFTNESS); - entries.add(ArtifactsRegistry.DEATH_CAP_MUSHROOM); - entries.add(ArtifactsRegistry.GHOST_CLOAK); - entries.add(ArtifactsRegistry.LIGHT_FEATHER); + entries.add(ArtifactsRegistry.BOOTS_OF_SWIFTNESS.get()); + entries.add(ArtifactsRegistry.DEATH_CAP_MUSHROOM.get()); + entries.add(ArtifactsRegistry.GHOST_CLOAK.get()); + entries.add(ArtifactsRegistry.LIGHT_FEATHER.get()); // DAMAGING ARTEFACTS - entries.add(ArtifactsRegistry.BLAST_FUNGUS); - //entries.add(ArtifactsRegistry.CORRUPTED_BEACON); - entries.add(ArtifactsRegistry.HARVESTER); - entries.add(ArtifactsRegistry.LIGHTNING_ROD); - entries.add(ArtifactsRegistry.POWERSHAKER); - entries.add(ArtifactsRegistry.UPDRAFT_TOME); + entries.add(ArtifactsRegistry.BLAST_FUNGUS.get()); + //entries.add(ArtifactsRegistry.CORRUPTED_BEACON.get()); + entries.add(ArtifactsRegistry.HARVESTER.get()); + entries.add(ArtifactsRegistry.LIGHTNING_ROD.get()); + entries.add(ArtifactsRegistry.POWERSHAKER.get()); + entries.add(ArtifactsRegistry.UPDRAFT_TOME.get()); // DEFENSIVE ARTEFACTS - entries.add(ArtifactsRegistry.ENCHANTERS_TOME); - entries.add(ArtifactsRegistry.IRON_HIDE_AMULET); - //entries.add(ArtifactsRegistry.SATCHEL_OF_ELIXIRS); - //entries.add(ArtifactsRegistry.SATCHEL_OF_SNACKS); - entries.add(ArtifactsRegistry.SOUL_HEALER); - entries.add(ArtifactsRegistry.TOTEM_OF_REGENERATION); - entries.add(ArtifactsRegistry.TOTEM_OF_SHIELDING); - entries.add(ArtifactsRegistry.TOTEM_OF_SOUL_PROTECTION); - entries.add(ArtifactsRegistry.WIND_HORN); + entries.add(ArtifactsRegistry.ENCHANTERS_TOME.get()); + entries.add(ArtifactsRegistry.IRON_HIDE_AMULET.get()); + entries.add(ArtifactsRegistry.SATCHEL_OF_ELIXERS.get()); + entries.add(ArtifactsRegistry.SATCHEL_OF_SNACKS.get()); + entries.add(ArtifactsRegistry.SOUL_HEALER.get()); + entries.add(ArtifactsRegistry.TOTEM_OF_REGENERATION.get()); + entries.add(ArtifactsRegistry.TOTEM_OF_SHIELDING.get()); + entries.add(ArtifactsRegistry.TOTEM_OF_SOUL_PROTECTION.get()); + entries.add(ArtifactsRegistry.WIND_HORN.get()); // QUIVER ARTEFACTS - entries.add(ArtifactsRegistry.FLAMING_QUIVER); - entries.add(ArtifactsRegistry.HARPOON_QUIVER); - entries.add(ArtifactsRegistry.THUNDERING_QUIVER); - entries.add(ArtifactsRegistry.TORMENT_QUIVER); + entries.add(ArtifactsRegistry.FLAMING_QUIVER.get()); + entries.add(ArtifactsRegistry.HARPOON_QUIVER.get()); + entries.add(ArtifactsRegistry.THUNDERING_QUIVER.get()); + entries.add(ArtifactsRegistry.TORMENT_QUIVER.get()); // STATUS INFLICTING ARTEFACTS - entries.add(ArtifactsRegistry.CORRUPTED_SEEDS); - entries.add(ArtifactsRegistry.GONG_OF_WEAKENING); - entries.add(ArtifactsRegistry.LOVE_MEDALLION); - entries.add(ArtifactsRegistry.SATCHEL_OF_ELEMENTS); - entries.add(ArtifactsRegistry.SHOCK_POWDER); + entries.add(ArtifactsRegistry.CORRUPTED_SEEDS.get()); + entries.add(ArtifactsRegistry.GONG_OF_WEAKENING.get()); + entries.add(ArtifactsRegistry.LOVE_MEDALLION.get()); + entries.add(ArtifactsRegistry.SATCHEL_OF_ELEMENTS.get()); + entries.add(ArtifactsRegistry.SHOCK_POWDER.get()); // SUMMONING ARTEFACTS - entries.add(ArtifactsRegistry.BUZZY_NEST); - entries.add(ArtifactsRegistry.ENCHANTED_GRASS); - entries.add(ArtifactsRegistry.GOLEM_KIT); - entries.add(ArtifactsRegistry.TASTY_BONE); - entries.add(ArtifactsRegistry.WONDERFUL_WHEAT); + entries.add(ArtifactsRegistry.BUZZY_NEST.get()); + entries.add(ArtifactsRegistry.ENCHANTED_GRASS.get()); + entries.add(ArtifactsRegistry.GOLEM_KIT.get()); + entries.add(ArtifactsRegistry.TASTY_BONE.get()); + entries.add(ArtifactsRegistry.WONDERFUL_WHEAT.get()); }) .build()); } diff --git a/common/src/main/java/dev/timefall/mcdar/registry/StatusEffectRegistry.java b/common/src/main/java/dev/timefall/mcdar/registry/StatusEffectRegistry.java index 3aa2a0e..9ba9fc4 100644 --- a/common/src/main/java/dev/timefall/mcdar/registry/StatusEffectRegistry.java +++ b/common/src/main/java/dev/timefall/mcdar/registry/StatusEffectRegistry.java @@ -1,22 +1,34 @@ package dev.timefall.mcdar.registry; +import dev.timefall.mcdar.ModConstants; import dev.timefall.mcdar.statuseffect.CharmedStatusEffect; import dev.timefall.mcdar.statuseffect.ShieldingStatusEffect; import dev.timefall.mcdar.statuseffect.SoulProtectionStatusEffect; import dev.timefall.mcdar.statuseffect.StunnedStatusEffect; +import me.fzzyhmstrs.fzzy_config.api.ConfigApiJava; +import me.fzzyhmstrs.fzzy_config.util.platform.Registrar; +import me.fzzyhmstrs.fzzy_config.util.platform.RegistrySupplier; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectCategory; +import net.minecraft.registry.Registries; public class StatusEffectRegistry { - public static StatusEffect CHARMED; - public static StatusEffect SHIELDING; - public static StatusEffect SOUL_PROTECTION; - public static StatusEffect STUNNED; - public static void register(){ - CHARMED = new CharmedStatusEffect(StatusEffectCategory.HARMFUL, 0xC7005B, "charmed"); - SHIELDING = new ShieldingStatusEffect(StatusEffectCategory.BENEFICIAL, 0x808080, "shielding"); - SOUL_PROTECTION = new SoulProtectionStatusEffect(StatusEffectCategory.BENEFICIAL, 0x2552a5, "soul_protection"); - STUNNED = new StunnedStatusEffect(StatusEffectCategory.HARMFUL, 0xFFFF00, "stunned"); + private static final Registrar STATUS_EFFECT = ConfigApiJava.platform().createRegistrar(ModConstants.MOD_ID, Registries.STATUS_EFFECT); + + public static RegistrySupplier CHARMED; + public static RegistrySupplier SHIELDING; + public static RegistrySupplier SOUL_PROTECTION; + public static RegistrySupplier STUNNED; + + protected static RegistrySupplier registerStatus(String id, StatusEffect statusEffect) { + return STATUS_EFFECT.register(id, () -> statusEffect); + } + + public static void register() { + CHARMED = registerStatus("charmed", new CharmedStatusEffect(StatusEffectCategory.HARMFUL, 0xC7005B)); + SHIELDING = registerStatus("shielding", new ShieldingStatusEffect(StatusEffectCategory.BENEFICIAL, 0x808080)); + SOUL_PROTECTION = registerStatus("soul_protection", new SoulProtectionStatusEffect(StatusEffectCategory.BENEFICIAL, 0x2552a5)); + STUNNED = registerStatus("stunned", new StunnedStatusEffect(StatusEffectCategory.HARMFUL, 0xFFFF00)); } } diff --git a/common/src/main/java/dev/timefall/mcdar/registry/SummonedEntityAttributeRegistry.java b/common/src/main/java/dev/timefall/mcdar/registry/SummonedEntityAttributeRegistry.java deleted file mode 100644 index 7c8ab92..0000000 --- a/common/src/main/java/dev/timefall/mcdar/registry/SummonedEntityAttributeRegistry.java +++ /dev/null @@ -1,22 +0,0 @@ -package dev.timefall.mcdar.registry; - -import dev.timefall.mcdar.entities.*; -import dev.timefall.mcdar.mixin.DefaultAttributeRegistryAccessor; - -public class SummonedEntityAttributeRegistry { - - private static void registerAttributes() { - DefaultAttributeRegistryAccessor.getRegistry().put(SummonedEntityType.BUZZY_NEST_BEE_ENTITY, BuzzyNestBeeEntity.createBeeAttributes().build()); - DefaultAttributeRegistryAccessor.getRegistry().put(SummonedEntityType.ENCHANTED_GRASS_GREEN_SHEEP_ENTITY, EnchantedGrassGreenSheepEntity.createEnchantedGreenSheepAttributes().build()); - DefaultAttributeRegistryAccessor.getRegistry().put(SummonedEntityType.ENCHANTED_GRASS_BLUE_SHEEP_ENTITY, EnchantedGrassBlueSheepEntity.createEnchantedBlueSheepAttributes().build()); - DefaultAttributeRegistryAccessor.getRegistry().put(SummonedEntityType.ENCHANTED_GRASS_RED_SHEEP_ENTITY, EnchantedGrassRedSheepEntity.createEnchantedRedSheepAttributes().build()); - DefaultAttributeRegistryAccessor.getRegistry().put(SummonedEntityType.GOLEM_KIT_GOLEM_ENTITY, GolemKitGolemEntity.createIronGolemAttributes().build()); - DefaultAttributeRegistryAccessor.getRegistry().put(SummonedEntityType.TASTY_BONE_WOLF_ENTITY, TastyBoneWolfEntity.createTastyBoneWolfAttributes().build()); - DefaultAttributeRegistryAccessor.getRegistry().put(SummonedEntityType.WONDERFUL_WHEAT_LLAMA_ENTITY, WonderfulWheatLlamaEntity.createWonderfulWheatLlamaAttributes().build()); - } - - public static void register() { - registerAttributes(); - } - -} diff --git a/fabric/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRegistryFabric.java b/common/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRegistry.java similarity index 54% rename from fabric/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRegistryFabric.java rename to common/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRegistry.java index 14c1257..bbca04e 100644 --- a/fabric/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRegistryFabric.java +++ b/common/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRegistry.java @@ -2,10 +2,9 @@ import com.google.common.collect.Maps; import dev.timefall.mcdar.ModConstants; -import dev.timefall.mcdar.entities.*; -import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; -import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; -import net.minecraft.entity.EntityDimensions; +import dev.timefall.mcdar.entity.*; +import me.fzzyhmstrs.fzzy_config.api.ConfigApiJava; +import me.fzzyhmstrs.fzzy_config.util.platform.Registrar; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.SpawnGroup; @@ -13,51 +12,53 @@ import net.minecraft.entity.passive.BeeEntity; import net.minecraft.entity.passive.IronGolemEntity; import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; import java.util.Map; -public class SummonedEntityRegistryFabric { +public class SummonedEntityRegistry { + + private static final Registrar> ENTITY_TYPE = ConfigApiJava.platform().createRegistrar(ModConstants.MOD_ID, Registries.ENTITY_TYPE); public static final Map, DefaultAttributeContainer> ATTRIBUTES = Maps.newHashMap(); public static final EntityType BUZZY_NEST_BEE_ENTITY = - FabricEntityTypeBuilder - .create(SpawnGroup.CREATURE, BuzzyNestBeeEntity::new) - .dimensions(EntityDimensions.fixed(1, 2)) - .build(); + EntityType.Builder + .create(BuzzyNestBeeEntity::new, SpawnGroup.CREATURE) + .dimensions(1, 2) + .build(null); public static final EntityType ENCHANTED_GRASS_GREEN_SHEEP_ENTITY = - FabricEntityTypeBuilder - .create(SpawnGroup.CREATURE, EnchantedGrassGreenSheepEntity::new) - .dimensions(EntityDimensions.fixed(1, 2)) - .build(); + EntityType.Builder + .create(EnchantedGrassGreenSheepEntity::new, SpawnGroup.CREATURE) + .dimensions(1, 2) + .build(null); public static final EntityType ENCHANTED_GRASS_BLUE_SHEEP_ENTITY = - FabricEntityTypeBuilder - .create(SpawnGroup.CREATURE, EnchantedGrassBlueSheepEntity::new) - .dimensions(EntityDimensions.fixed(1, 2)) - .build(); + EntityType.Builder + .create(EnchantedGrassBlueSheepEntity::new, SpawnGroup.CREATURE) + .dimensions(1, 2) + .build(null); public static final EntityType ENCHANTED_GRASS_RED_SHEEP_ENTITY = - FabricEntityTypeBuilder - .create(SpawnGroup.CREATURE, EnchantedGrassRedSheepEntity::new) - .dimensions(EntityDimensions.fixed(1, 2)) - .build(); + EntityType.Builder + .create(EnchantedGrassRedSheepEntity::new, SpawnGroup.CREATURE) + .dimensions(1, 2) + .build(null); public static final EntityType GOLEM_KIT_GOLEM_ENTITY = - FabricEntityTypeBuilder - .create(SpawnGroup.CREATURE, GolemKitGolemEntity::new) - .dimensions(EntityDimensions.fixed(1, 2)) - .build(); + EntityType.Builder + .create(GolemKitGolemEntity::new, SpawnGroup.CREATURE) + .dimensions(1, 2) + .build(null); public static final EntityType TASTY_BONE_WOLF_ENTITY = - FabricEntityTypeBuilder - .create(SpawnGroup.CREATURE, TastyBoneWolfEntity::new) - .dimensions(EntityDimensions.fixed(1, 2)) - .build(); + EntityType.Builder + .create(TastyBoneWolfEntity::new, SpawnGroup.CREATURE) + .dimensions(1, 2) + .build(null); public static final EntityType WONDERFUL_WHEAT_LLAMA_ENTITY = - FabricEntityTypeBuilder - .create(SpawnGroup.CREATURE, WonderfulWheatLlamaEntity::new) - .dimensions(EntityDimensions.fixed(1, 2)) - .build(); + EntityType.Builder + .create(WonderfulWheatLlamaEntity::new, SpawnGroup.CREATURE) + .dimensions(1, 2) + .build(null); - public static void register(){ + public static void register() { + ENTITY_TYPE.init(); registerEntity("buzzy_nest_bee", BeeEntity.createBeeAttributes(), BUZZY_NEST_BEE_ENTITY); registerEntity("enchanted_blue_sheep", EnchantedGrassBlueSheepEntity.createEnchantedBlueSheepAttributes(), ENCHANTED_GRASS_BLUE_SHEEP_ENTITY); registerEntity("enchanted_green_sheep", EnchantedGrassGreenSheepEntity.createEnchantedGreenSheepAttributes(), ENCHANTED_GRASS_GREEN_SHEEP_ENTITY); @@ -70,7 +71,6 @@ public static void register(){ public static void registerEntity(String name, DefaultAttributeContainer.Builder attributes, EntityType entityType){ - FabricDefaultAttributeRegistry.register(entityType, attributes); - Registry.register(Registries.ENTITY_TYPE, ModConstants.ID(name), entityType); + ENTITY_TYPE.register(name, () -> entityType); } -} \ No newline at end of file +} diff --git a/common/src/main/java/dev/timefall/mcdar/registry/tag/TagKeys.java b/common/src/main/java/dev/timefall/mcdar/registry/tag/TagKeys.java index 79a1f5d..af2bb1a 100644 --- a/common/src/main/java/dev/timefall/mcdar/registry/tag/TagKeys.java +++ b/common/src/main/java/dev/timefall/mcdar/registry/tag/TagKeys.java @@ -6,8 +6,8 @@ import net.minecraft.registry.tag.TagKey; public class TagKeys { - public static final TagKey VILLAGER_ARTIFACT = TagKey.of(RegistryKeys.ITEM, ModConstants.ID("villager_artifacts")); - public static final TagKey ILLAGER_ARTIFACT = TagKey.of(RegistryKeys.ITEM, ModConstants.ID("illager_artifacts")); - public static final TagKey ALL_ARTIFACT = TagKey.of(RegistryKeys.ITEM, ModConstants.ID("all_artifacts")); + public static final TagKey VILLAGER_ARTIFACT = TagKey.of(RegistryKeys.ITEM, ModConstants.id("villager_artifacts")); + public static final TagKey ILLAGER_ARTIFACT = TagKey.of(RegistryKeys.ITEM, ModConstants.id("illager_artifacts")); + public static final TagKey ALL_ARTIFACT = TagKey.of(RegistryKeys.ITEM, ModConstants.id("all_artifacts")); } diff --git a/common/src/main/java/dev/timefall/mcdar/statuseffect/CharmedStatusEffect.java b/common/src/main/java/dev/timefall/mcdar/statuseffect/CharmedStatusEffect.java index 854a0e2..8f3a204 100644 --- a/common/src/main/java/dev/timefall/mcdar/statuseffect/CharmedStatusEffect.java +++ b/common/src/main/java/dev/timefall/mcdar/statuseffect/CharmedStatusEffect.java @@ -1,7 +1,6 @@ package dev.timefall.mcdar.statuseffect; -import dev.timefall.mcdar.ModConstants; -import dev.timefall.mcdar.goals.LoveMedallionAttackGoal; +import dev.timefall.mcdar.goal.LoveMedallionAttackGoal; import dev.timefall.mcdar.mixin.MobEntityAccessor; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.ai.goal.Goal; @@ -10,16 +9,13 @@ import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectCategory; import net.minecraft.entity.mob.MobEntity; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.util.Identifier; public class CharmedStatusEffect extends StatusEffect { private LivingEntity entity; - public CharmedStatusEffect(StatusEffectCategory statusEffectCategory, int color, String id) { + public CharmedStatusEffect(StatusEffectCategory statusEffectCategory, int color) { super(statusEffectCategory, color); - Registry.register(Registries.STATUS_EFFECT, Identifier.of(ModConstants.MOD_ID, id), this); + //Registry.register(Registries.STATUS_EFFECT, Identifier.of(ModConstants.MOD_ID, id), this); } private static Goal inLoveIdiot; diff --git a/common/src/main/java/dev/timefall/mcdar/statuseffect/ShieldingStatusEffect.java b/common/src/main/java/dev/timefall/mcdar/statuseffect/ShieldingStatusEffect.java index 533493e..a58f41d 100644 --- a/common/src/main/java/dev/timefall/mcdar/statuseffect/ShieldingStatusEffect.java +++ b/common/src/main/java/dev/timefall/mcdar/statuseffect/ShieldingStatusEffect.java @@ -1,17 +1,13 @@ package dev.timefall.mcdar.statuseffect; -import dev.timefall.mcdar.ModConstants; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectCategory; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.util.Identifier; public class ShieldingStatusEffect extends StatusEffect { - public ShieldingStatusEffect(StatusEffectCategory type, int color, String id) { + public ShieldingStatusEffect(StatusEffectCategory type, int color) { super(type, color); - Registry.register(Registries.STATUS_EFFECT, Identifier.of(ModConstants.MOD_ID, id), this); + //Registry.register(Registries.STATUS_EFFECT, Identifier.of(ModConstants.MOD_ID, id), this); } @Override diff --git a/common/src/main/java/dev/timefall/mcdar/statuseffect/SoulProtectionStatusEffect.java b/common/src/main/java/dev/timefall/mcdar/statuseffect/SoulProtectionStatusEffect.java index 1094449..d4636c1 100644 --- a/common/src/main/java/dev/timefall/mcdar/statuseffect/SoulProtectionStatusEffect.java +++ b/common/src/main/java/dev/timefall/mcdar/statuseffect/SoulProtectionStatusEffect.java @@ -1,17 +1,13 @@ package dev.timefall.mcdar.statuseffect; -import dev.timefall.mcdar.ModConstants; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectCategory; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.util.Identifier; public class SoulProtectionStatusEffect extends StatusEffect { - public SoulProtectionStatusEffect(StatusEffectCategory type, int color, String id) { + public SoulProtectionStatusEffect(StatusEffectCategory type, int color) { super(type, color); - Registry.register(Registries.STATUS_EFFECT, Identifier.of(ModConstants.MOD_ID, id), this); + //Registry.register(Registries.STATUS_EFFECT, Identifier.of(ModConstants.MOD_ID, id), this); } @Override diff --git a/common/src/main/java/dev/timefall/mcdar/statuseffect/StunnedStatusEffect.java b/common/src/main/java/dev/timefall/mcdar/statuseffect/StunnedStatusEffect.java index 764a72c..f96eff7 100644 --- a/common/src/main/java/dev/timefall/mcdar/statuseffect/StunnedStatusEffect.java +++ b/common/src/main/java/dev/timefall/mcdar/statuseffect/StunnedStatusEffect.java @@ -1,16 +1,12 @@ package dev.timefall.mcdar.statuseffect; -import dev.timefall.mcdar.ModConstants; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectCategory; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.util.Identifier; public class StunnedStatusEffect extends StatusEffect { - public StunnedStatusEffect(StatusEffectCategory type, int color, String id) { + public StunnedStatusEffect(StatusEffectCategory type, int color) { super(type, color); - Registry.register(Registries.STATUS_EFFECT, Identifier.of(ModConstants.MOD_ID, id), this); + //Registry.register(Registries.STATUS_EFFECT, Identifier.of(ModConstants.MOD_ID, id), this); } @Override diff --git a/common/src/main/resources/mcdar.mixins.json b/common/src/main/resources/mcdar.mixins.json index a43d318..59e249c 100644 --- a/common/src/main/resources/mcdar.mixins.json +++ b/common/src/main/resources/mcdar.mixins.json @@ -6,8 +6,6 @@ "mixins": [ "BowItemMixin", "CreeperEntityAccessor", - "DefaultAttributeRegistryAccessor", - "ItemStackMixin", "LivingEntityMixin", "MobEntityAccessor", "MobEntityMixin", diff --git a/fabric/build.gradle b/fabric/build.gradle index eb48539..4c03765 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -23,9 +23,9 @@ dependencies { common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } - modImplementation "maven.modrinth:fzzy-config:${rootProject.fzzyConfigVersion}" - modImplementation("net.fabricmc:fabric-language-kotlin:1.12.1+kotlin.2.0.20") - + modImplementation "me.fzzyhmstrs:fzzy_config:${rootProject.fzzyConfigVersion}" + //modImplementation "net.fabricmc:fabric-language-kotlin:1.12.1+kotlin.2.0.20" + //modImplementation "net.peanuuutz.tomlkt:tomlkt:0.3.7" } publishMods { diff --git a/fabric/src/main/java/dev/timefall/mcdar/McdarFabric.java b/fabric/src/main/java/dev/timefall/mcdar/McdarFabric.java index 7d53307..c31e1f8 100644 --- a/fabric/src/main/java/dev/timefall/mcdar/McdarFabric.java +++ b/fabric/src/main/java/dev/timefall/mcdar/McdarFabric.java @@ -1,16 +1,17 @@ package dev.timefall.mcdar; -import dev.timefall.mcdar.registry.ItemGroupRegistryFabric; -import dev.timefall.mcdar.registry.LootRegistry; -import dev.timefall.mcdar.registry.SummonedEntityRegistryFabric; +import dev.timefall.mcdar.event.McdarFabricEvents; +import dev.timefall.mcdar.registry.DefaultAttributeRegistryFabric; +import dev.timefall.mcdar.registry.LootRegistryFabric; import net.fabricmc.api.ModInitializer; public class McdarFabric implements ModInitializer { @Override public void onInitialize() { - ItemGroupRegistryFabric.register(); - SummonedEntityRegistryFabric.register(); - LootRegistry.register(); + McdarCommon.initialize(); + DefaultAttributeRegistryFabric.registerAttributes(); + McdarFabricEvents.registerEvents(); + LootRegistryFabric.register(); } } diff --git a/fabric/src/main/java/dev/timefall/mcdar/client/McdarClientFabric.java b/fabric/src/main/java/dev/timefall/mcdar/client/McdarClientFabric.java index 94c4b39..a100e8d 100644 --- a/fabric/src/main/java/dev/timefall/mcdar/client/McdarClientFabric.java +++ b/fabric/src/main/java/dev/timefall/mcdar/client/McdarClientFabric.java @@ -1,7 +1,7 @@ package dev.timefall.mcdar.client; import dev.timefall.mcdar.ModConstants; -import dev.timefall.mcdar.registry.SummonedEntityRenderRegistryFabric; +import dev.timefall.mcdar.client.registry.SummonedEntityRenderRegistryFabric; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; diff --git a/fabric/src/main/java/dev/timefall/mcdar/client/registry/SummonedEntityRenderRegistryFabric.java b/fabric/src/main/java/dev/timefall/mcdar/client/registry/SummonedEntityRenderRegistryFabric.java new file mode 100644 index 0000000..cd201f8 --- /dev/null +++ b/fabric/src/main/java/dev/timefall/mcdar/client/registry/SummonedEntityRenderRegistryFabric.java @@ -0,0 +1,20 @@ +package dev.timefall.mcdar.client.registry; + +import dev.timefall.mcdar.entity.renderers.*; +import dev.timefall.mcdar.registry.SummonedEntityRegistry; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; + +@Environment(EnvType.CLIENT) +public class SummonedEntityRenderRegistryFabric { + public static void register(){ + EntityRendererRegistry.register(SummonedEntityRegistry.BUZZY_NEST_BEE_ENTITY, BuzzyNestBeeRenderer::new); + EntityRendererRegistry.register(SummonedEntityRegistry.ENCHANTED_GRASS_BLUE_SHEEP_ENTITY, EnchantedGrassBlueSheepRenderer::new); + EntityRendererRegistry.register(SummonedEntityRegistry.ENCHANTED_GRASS_GREEN_SHEEP_ENTITY, EnchantedGrassGreenSheepRenderer::new); + EntityRendererRegistry.register(SummonedEntityRegistry.ENCHANTED_GRASS_RED_SHEEP_ENTITY, EnchantedGrassRedSheepRenderer::new); + EntityRendererRegistry.register(SummonedEntityRegistry.GOLEM_KIT_GOLEM_ENTITY, GolemKitGolemRenderer::new); + EntityRendererRegistry.register(SummonedEntityRegistry.TASTY_BONE_WOLF_ENTITY, TastyBoneWolfRenderer::new); + EntityRendererRegistry.register(SummonedEntityRegistry.WONDERFUL_WHEAT_LLAMA_ENTITY, WonderfulWheatLlamaRenderer::new); + } +} diff --git a/fabric/src/main/java/dev/timefall/mcdar/data/providers/McdarTagProvider.java b/fabric/src/main/java/dev/timefall/mcdar/data/providers/McdarTagProvider.java index e49b2e4..91f669f 100644 --- a/fabric/src/main/java/dev/timefall/mcdar/data/providers/McdarTagProvider.java +++ b/fabric/src/main/java/dev/timefall/mcdar/data/providers/McdarTagProvider.java @@ -18,39 +18,39 @@ public McdarTagProvider(FabricDataOutput output, CompletableFuture { + if(world instanceof ServerWorld serverWorld) { + EnchantmentEffects.activateBeastBurst(playerEntity, serverWorld); + EnchantmentEffects.activateBeastSurge(playerEntity, serverWorld); + } + return TypedActionResult.pass(ItemStack.EMPTY); + }); + + // Spawns an explosion at the position of target killed with PowerShaker in the offhand; mcdar$onPowershakerExplodingKill + ServerLivingEntityEvents.AFTER_DEATH.register((livingEntity, damageSource) -> { + if (!(damageSource.getAttacker() instanceof PlayerEntity playerEntity)) return; + + if (McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().POWERSHAKER_STATS.mcdar$getIsEnabled()) + ArtifactEffects.mcdar$activatePowerShaker(playerEntity, livingEntity); + }); + + // Prevents use of items via right click; mcdar$stunnedStatusPreventItemUsage + UseItemCallback.EVENT.register(((player, world, hand) -> { + if (player.hasStatusEffect(StatusEffectRegistry.STUNNED.getEntry())) { + return TypedActionResult.fail(ItemStack.EMPTY); + } + return TypedActionResult.pass(ItemStack.EMPTY); + })); + + // Prevents use of items via left click on entities; mcdar$stunnedStatusPreventAttackEntityBlock + AttackEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> { + if (player.hasStatusEffect(StatusEffectRegistry.STUNNED.getEntry())) { + return ActionResult.FAIL; + } + return ActionResult.PASS; + }); + + // Prevents use of items via left click on blocks; mcdar$stunnedStatusPreventAttackBlock + AttackBlockCallback.EVENT.register((player, world, hand, pos, direction) -> { + if (player.hasStatusEffect(StatusEffectRegistry.STUNNED.getEntry())) { + return ActionResult.FAIL; + } + return ActionResult.PASS; + }); + } +} diff --git a/fabric/src/main/java/dev/timefall/mcdar/platform/FabricPlatformHelper.java b/fabric/src/main/java/dev/timefall/mcdar/platform/FabricPlatformHelper.java deleted file mode 100644 index 70f4ab5..0000000 --- a/fabric/src/main/java/dev/timefall/mcdar/platform/FabricPlatformHelper.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.timefall.mcdar.platform; - -import net.fabricmc.loader.api.FabricLoader; - -public class FabricPlatformHelper implements IPlatformHelper { - - @Override - public String getPlatformName() { - return "Fabric"; - } - - @Override - public boolean isModLoaded(String modId) { - return FabricLoader.getInstance().isModLoaded(modId); - } - - @Override - public boolean isDevelopmentEnvironment() { - return FabricLoader.getInstance().isDevelopmentEnvironment(); - } -} \ No newline at end of file diff --git a/fabric/src/main/java/dev/timefall/mcdar/registry/DefaultAttributeRegistryFabric.java b/fabric/src/main/java/dev/timefall/mcdar/registry/DefaultAttributeRegistryFabric.java new file mode 100644 index 0000000..b749f50 --- /dev/null +++ b/fabric/src/main/java/dev/timefall/mcdar/registry/DefaultAttributeRegistryFabric.java @@ -0,0 +1,17 @@ +package dev.timefall.mcdar.registry; + +import dev.timefall.mcdar.entity.*; +import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; + +public class DefaultAttributeRegistryFabric { + + public static void registerAttributes() { + FabricDefaultAttributeRegistry.register(SummonedEntityType.BUZZY_NEST_BEE_ENTITY, BuzzyNestBeeEntity.createBeeAttributes().build()); + FabricDefaultAttributeRegistry.register(SummonedEntityType.ENCHANTED_GRASS_GREEN_SHEEP_ENTITY, EnchantedGrassGreenSheepEntity.createEnchantedGreenSheepAttributes().build()); + FabricDefaultAttributeRegistry.register(SummonedEntityType.ENCHANTED_GRASS_BLUE_SHEEP_ENTITY, EnchantedGrassBlueSheepEntity.createEnchantedBlueSheepAttributes().build()); + FabricDefaultAttributeRegistry.register(SummonedEntityType.ENCHANTED_GRASS_RED_SHEEP_ENTITY, EnchantedGrassRedSheepEntity.createEnchantedRedSheepAttributes().build()); + FabricDefaultAttributeRegistry.register(SummonedEntityType.GOLEM_KIT_GOLEM_ENTITY, GolemKitGolemEntity.createIronGolemAttributes().build()); + FabricDefaultAttributeRegistry.register(SummonedEntityType.TASTY_BONE_WOLF_ENTITY, TastyBoneWolfEntity.createTastyBoneWolfAttributes().build()); + FabricDefaultAttributeRegistry.register(SummonedEntityType.WONDERFUL_WHEAT_LLAMA_ENTITY, WonderfulWheatLlamaEntity.createWonderfulWheatLlamaAttributes().build()); + } +} diff --git a/fabric/src/main/java/dev/timefall/mcdar/registry/ItemGroupRegistryFabric.java b/fabric/src/main/java/dev/timefall/mcdar/registry/ItemGroupRegistryFabric.java deleted file mode 100644 index f40b9b1..0000000 --- a/fabric/src/main/java/dev/timefall/mcdar/registry/ItemGroupRegistryFabric.java +++ /dev/null @@ -1,69 +0,0 @@ -package dev.timefall.mcdar.registry; - -import dev.timefall.mcdar.ModConstants; -import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.text.Text; - -public class ItemGroupRegistryFabric { - public static final RegistryKey MC_DUNGEONS_ARTIFACTS_GROUP_KEY = RegistryKey.of(RegistryKeys.ITEM_GROUP, ModConstants.ID("mc_dungeons_artifacts_group_key")); - - public static final ItemGroup MC_DUNGEONS_ARTIFACTS_ITEM_GROUP = FabricItemGroup.builder() - .icon(() -> new ItemStack(ArtifactsRegistry.LIGHTNING_ROD)) - .displayName(Text.translatable("itemGroup." + ModConstants.MOD_ID)) - .entries(((displayContext, entries) -> { - entries.add(ArtifactsRegistry.BOOTS_OF_SWIFTNESS.getDefaultStack()); - entries.add(ArtifactsRegistry.DEATH_CAP_MUSHROOM.getDefaultStack()); - entries.add(ArtifactsRegistry.GHOST_CLOAK.getDefaultStack()); - entries.add(ArtifactsRegistry.LIGHT_FEATHER.getDefaultStack()); - - // DAMAGING ARTEFACTS - entries.add(ArtifactsRegistry.BLAST_FUNGUS); - // entries.add(ArtifactsRegistry.CORRUPTED_BEACON); - entries.add(ArtifactsRegistry.HARVESTER); - entries.add(ArtifactsRegistry.LIGHTNING_ROD); - entries.add(ArtifactsRegistry.POWERSHAKER); - entries.add(ArtifactsRegistry.UPDRAFT_TOME); - - // DEFENSIVE ARTEFACTS - entries.add(ArtifactsRegistry.ENCHANTERS_TOME); - entries.add(ArtifactsRegistry.IRON_HIDE_AMULET); - //entries.add(ArtifactsRegistry.SATCHEL_OF_ELIXIRS); - entries.add(ArtifactsRegistry.SATCHEL_OF_SNACKS); - entries.add(ArtifactsRegistry.SOUL_HEALER); - entries.add(ArtifactsRegistry.TOTEM_OF_REGENERATION); - entries.add(ArtifactsRegistry.TOTEM_OF_SHIELDING); - entries.add(ArtifactsRegistry.TOTEM_OF_SOUL_PROTECTION); - entries.add(ArtifactsRegistry.WIND_HORN); - - // QUIVER ARTEFACTS - entries.add(ArtifactsRegistry.FLAMING_QUIVER); - entries.add(ArtifactsRegistry.HARPOON_QUIVER); - entries.add(ArtifactsRegistry.THUNDERING_QUIVER); - entries.add(ArtifactsRegistry.TORMENT_QUIVER); - - // STATUS INFLICTING ARTEFACTS - entries.add(ArtifactsRegistry.CORRUPTED_SEEDS); - entries.add(ArtifactsRegistry.GONG_OF_WEAKENING); - entries.add(ArtifactsRegistry.LOVE_MEDALLION); - entries.add(ArtifactsRegistry.SATCHEL_OF_ELEMENTS); - entries.add(ArtifactsRegistry.SHOCK_POWDER); - - // SUMMONING ARTEFACTS - entries.add(ArtifactsRegistry.BUZZY_NEST); - entries.add(ArtifactsRegistry.ENCHANTED_GRASS); - entries.add(ArtifactsRegistry.GOLEM_KIT); - entries.add(ArtifactsRegistry.TASTY_BONE); - entries.add(ArtifactsRegistry.WONDERFUL_WHEAT); - })) - .build(); - - public static void register() { - Registry.register(Registries.ITEM_GROUP, MC_DUNGEONS_ARTIFACTS_GROUP_KEY, MC_DUNGEONS_ARTIFACTS_ITEM_GROUP); - } -} diff --git a/fabric/src/main/java/dev/timefall/mcdar/registry/LootRegistry.java b/fabric/src/main/java/dev/timefall/mcdar/registry/LootRegistry.java deleted file mode 100644 index 9bf0946..0000000 --- a/fabric/src/main/java/dev/timefall/mcdar/registry/LootRegistry.java +++ /dev/null @@ -1,47 +0,0 @@ -package dev.timefall.mcdar.registry; - -import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; -import dev.timefall.mcdar.registry.tag.TagKeys; -import net.fabricmc.fabric.api.loot.v3.FabricLootTableBuilder; -import net.fabricmc.fabric.api.loot.v3.LootTableEvents; -import net.minecraft.item.Item; -import net.minecraft.loot.LootPool; -import net.minecraft.loot.condition.RandomChanceLootCondition; -import net.minecraft.loot.entry.LeafEntry; -import net.minecraft.loot.entry.TagEntry; -import net.minecraft.loot.provider.number.ConstantLootNumberProvider; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.Identifier; - -public class LootRegistry { - - public static void register(){ - LootTableEvents.MODIFY.register(((key, tableBuilder, source, registries) -> { - Identifier id = key.getValue(); - if (key.isOf(TagKeys.ILLAGER_ARTIFACT.registry())) - mcdar$artifactsGeneralLootBuilder(TagKeys.ILLAGER_ARTIFACT, id, tableBuilder); - if (key.isOf(TagKeys.VILLAGER_ARTIFACT.registry())) - mcdar$artifactsGeneralLootBuilder(TagKeys.VILLAGER_ARTIFACT, id, tableBuilder); - if (key.isOf(TagKeys.ALL_ARTIFACT.registry())) - mcdar$artifactsDungeonLootBuilder(TagKeys.ALL_ARTIFACT, id, tableBuilder); - })); - } - - private static void mcdar$artifactsGeneralLootBuilder(TagKey itemTagKey, Identifier id, FabricLootTableBuilder tableBuilder) { - LootPool.Builder lootPoolBuilder = LootPool.builder(); - lootPoolBuilder.rolls(ConstantLootNumberProvider.create(1)) - .conditionally(RandomChanceLootCondition.builder(McdarArtifactsStatsConfig.CONFIG.ARTIFACT_GENERAL_SPAWN_CHANCE)); - LeafEntry.Builder tagEntry = TagEntry.expandBuilder(itemTagKey); - lootPoolBuilder.with(tagEntry); - tableBuilder.pool(lootPoolBuilder.build()); - } - - private static void mcdar$artifactsDungeonLootBuilder(TagKey itemTagKey, Identifier id, FabricLootTableBuilder tableBuilder) { - LootPool.Builder lootPoolBuilder = LootPool.builder(); - lootPoolBuilder.rolls(ConstantLootNumberProvider.create(1)) - .conditionally(RandomChanceLootCondition.builder(McdarArtifactsStatsConfig.CONFIG.ARTIFACT_DUNGEON_SPAWN_CHANCE)); - LeafEntry.Builder tagEntry = TagEntry.expandBuilder(itemTagKey); - lootPoolBuilder.with(tagEntry); - tableBuilder.pool(lootPoolBuilder.build()); - } -} diff --git a/fabric/src/main/java/dev/timefall/mcdar/registry/LootRegistryFabric.java b/fabric/src/main/java/dev/timefall/mcdar/registry/LootRegistryFabric.java new file mode 100644 index 0000000..b5ddf4d --- /dev/null +++ b/fabric/src/main/java/dev/timefall/mcdar/registry/LootRegistryFabric.java @@ -0,0 +1,58 @@ +package dev.timefall.mcdar.registry; + +import dev.timefall.mcdar.artifacts.ArtifactItem; +import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; +import dev.timefall.mcdar.registry.tag.TagKeys; +import net.fabricmc.fabric.api.loot.v3.FabricLootTableBuilder; +import net.fabricmc.fabric.api.loot.v3.LootTableEvents; +import net.minecraft.item.Item; +import net.minecraft.loot.LootPool; +import net.minecraft.loot.condition.RandomChanceLootCondition; +import net.minecraft.loot.entry.ItemEntry; +import net.minecraft.loot.entry.LeafEntry; +import net.minecraft.loot.provider.number.ConstantLootNumberProvider; +import net.minecraft.registry.Registries; +import net.minecraft.registry.tag.TagKey; +import net.minecraft.util.Identifier; + +public class LootRegistryFabric { + + public static void register(){ + LootTableEvents.MODIFY.register(((key, tableBuilder, source, registries) -> { + Identifier id = key.getValue(); + if (McdarArtifactsStatsConfig.CONFIG.mcdar$getIllagerLootTables().contains(id)) + mcdar$artifactsLootBuilder(TagKeys.ILLAGER_ARTIFACT, McdarArtifactsStatsConfig.CONFIG.mcdar$getGeneralSpawnChance(), false, tableBuilder); + if (McdarArtifactsStatsConfig.CONFIG.mcdar$getVillagerLootTables().contains(id)) + mcdar$artifactsLootBuilder(TagKeys.VILLAGER_ARTIFACT, McdarArtifactsStatsConfig.CONFIG.mcdar$getGeneralSpawnChance(), false, tableBuilder); + if (McdarArtifactsStatsConfig.CONFIG.mcdar$getDungeonLootTables().contains(id)) + mcdar$artifactsLootBuilder(TagKeys.ALL_ARTIFACT, McdarArtifactsStatsConfig.CONFIG.mcdar$getDungeonSpawnChance(), true, tableBuilder); + })); + } + + /*private static void mcdar$artifactsGeneralLootBuilder(TagKey itemTagKey, int weight, FabricLootTableBuilder tableBuilder) { + LootPool.Builder lootPoolBuilder = LootPool.builder(); + lootPoolBuilder.rolls(ConstantLootNumberProvider.create(1)) + .conditionally(RandomChanceLootCondition.builder(McdarArtifactsStatsConfig.CONFIG.mcdar$getGeneralSpawnChance())); + LeafEntry.Builder tagEntry = TagEntry.expandBuilder(itemTagKey); + lootPoolBuilder.with(tagEntry); + tableBuilder.pool(lootPoolBuilder.build()); + }*/ + + private static void mcdar$artifactsLootBuilder(TagKey itemTagKey, float chance, boolean dungeon, FabricLootTableBuilder tableBuilder) { + LootPool.Builder lootPoolBuilder = LootPool.builder(); + lootPoolBuilder.rolls(ConstantLootNumberProvider.create(1)) + .conditionally(RandomChanceLootCondition.builder(chance)); + for (var regEntry : Registries.ITEM.iterateEntries(itemTagKey)) { + Item item = regEntry.value(); + if (item instanceof ArtifactItem artifactItem && artifactItem.mcdar$getStats().mcdar$getIsSpawnableInLoot()) { + LeafEntry.Builder itemEntry = ItemEntry.builder(artifactItem).weight( + dungeon + ? artifactItem.mcdar$getStats().mcdar$getDungeonArtifactSpawnWeight() + : artifactItem.mcdar$getStats().mcdar$getGeneralArtifactSpawnWeight() + ); + lootPoolBuilder.with(itemEntry); + } + } + tableBuilder.pool(lootPoolBuilder.build()); + } +} diff --git a/fabric/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRenderRegistryFabric.java b/fabric/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRenderRegistryFabric.java deleted file mode 100644 index 2a26d47..0000000 --- a/fabric/src/main/java/dev/timefall/mcdar/registry/SummonedEntityRenderRegistryFabric.java +++ /dev/null @@ -1,19 +0,0 @@ -package dev.timefall.mcdar.registry; - -import dev.timefall.mcdar.entities.renderers.*; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; - -@Environment(EnvType.CLIENT) -public class SummonedEntityRenderRegistryFabric { - public static void register(){ - EntityRendererRegistry.register(SummonedEntityRegistryFabric.BUZZY_NEST_BEE_ENTITY, BuzzyNestBeeRenderer::new); - EntityRendererRegistry.register(SummonedEntityRegistryFabric.ENCHANTED_GRASS_BLUE_SHEEP_ENTITY, EnchantedGrassBlueSheepRenderer::new); - EntityRendererRegistry.register(SummonedEntityRegistryFabric.ENCHANTED_GRASS_GREEN_SHEEP_ENTITY, EnchantedGrassGreenSheepRenderer::new); - EntityRendererRegistry.register(SummonedEntityRegistryFabric.ENCHANTED_GRASS_RED_SHEEP_ENTITY, EnchantedGrassRedSheepRenderer::new); - EntityRendererRegistry.register(SummonedEntityRegistryFabric.GOLEM_KIT_GOLEM_ENTITY, GolemKitGolemRenderer::new); - EntityRendererRegistry.register(SummonedEntityRegistryFabric.TASTY_BONE_WOLF_ENTITY, TastyBoneWolfRenderer::new); - EntityRendererRegistry.register(SummonedEntityRegistryFabric.WONDERFUL_WHEAT_LLAMA_ENTITY, WonderfulWheatLlamaRenderer::new); - } -} diff --git a/gradle.properties b/gradle.properties index ea6c558..d20beb2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,4 +14,4 @@ neoforge_version=21.0.167 yarn_mappings=9 -fzzyConfigVersion=0.5.6+1.21 \ No newline at end of file +fzzyConfigVersion=0.5.9+1.21 \ No newline at end of file diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 9e1bef0..c02b790 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -20,6 +20,10 @@ repositories { includeGroupAndSubgroups "cpw.mods" } } + + maven { + url "https://thedarkcolour.github.io/KotlinForForge/" + } } configurations { @@ -42,6 +46,8 @@ dependencies { it.mappings("net.fabricmc:yarn:${rootProject.minecraft_version}+build.${rootProject.yarn_mappings}:v2") it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$project.yarn_mappings_patch_neoforge_version") } + + modImplementation "me.fzzyhmstrs:fzzy_config:${rootProject.fzzyConfigVersion}+neoforge" } publishMods { diff --git a/neoforge/src/main/java/dev/timefall/mcdar/McdarNeoForge.java b/neoforge/src/main/java/dev/timefall/mcdar/McdarNeoForge.java index 851d2ab..6f42d24 100644 --- a/neoforge/src/main/java/dev/timefall/mcdar/McdarNeoForge.java +++ b/neoforge/src/main/java/dev/timefall/mcdar/McdarNeoForge.java @@ -1,12 +1,30 @@ package dev.timefall.mcdar; +import dev.timefall.mcdar.event.McdarForgeEventHandler; +import dev.timefall.mcdar.registry.DefaultAttributeRegistryNeoForge; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.common.NeoForge; @Mod(ModConstants.MOD_ID) public class McdarNeoForge { public McdarNeoForge(IEventBus modEventBus) { - ModConstants.LOGGER.info("Hello NeoForge!"); McdarCommon.initialize(); + + /* + * Game Event Bus Events + */ + NeoForge.EVENT_BUS.addListener(McdarForgeEventHandler::mcdar$playerFinishPotionEvent); + NeoForge.EVENT_BUS.addListener(McdarForgeEventHandler::mcdar$onPowershakerExplodingKill); + NeoForge.EVENT_BUS.addListener(McdarForgeEventHandler::mcdar$stunnedStatusPreventItemUsage); + NeoForge.EVENT_BUS.addListener(McdarForgeEventHandler::mcdar$stunnedStatusPreventAttackEntityBlock); + NeoForge.EVENT_BUS.addListener(McdarForgeEventHandler::mcdar$stunnedStatusPreventAttackBlock); + + /* + * Mod Event Bus Events + */ + modEventBus.addListener(DefaultAttributeRegistryNeoForge::registerAttributes); + + ModConstants.LOGGER.info("Hello NeoForge!"); } } diff --git a/neoforge/src/main/java/dev/timefall/mcdar/client/McdarNeoForgeClient.java b/neoforge/src/main/java/dev/timefall/mcdar/client/McdarNeoForgeClient.java new file mode 100644 index 0000000..f0bfbac --- /dev/null +++ b/neoforge/src/main/java/dev/timefall/mcdar/client/McdarNeoForgeClient.java @@ -0,0 +1,14 @@ +package dev.timefall.mcdar.client; + +import dev.timefall.mcdar.ModConstants; +import dev.timefall.mcdar.client.registry.SummonedEntityRenderRegistryNeoForge; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.common.Mod; + +@Mod(value = ModConstants.MOD_ID, dist = {Dist.CLIENT}) +public class McdarNeoForgeClient { + public McdarNeoForgeClient(IEventBus modEventBus) { + modEventBus.addListener(SummonedEntityRenderRegistryNeoForge::register); + } +} diff --git a/neoforge/src/main/java/dev/timefall/mcdar/client/registry/SummonedEntityRenderRegistryNeoForge.java b/neoforge/src/main/java/dev/timefall/mcdar/client/registry/SummonedEntityRenderRegistryNeoForge.java new file mode 100644 index 0000000..011fe26 --- /dev/null +++ b/neoforge/src/main/java/dev/timefall/mcdar/client/registry/SummonedEntityRenderRegistryNeoForge.java @@ -0,0 +1,18 @@ +package dev.timefall.mcdar.client.registry; + +import dev.timefall.mcdar.entity.renderers.*; +import dev.timefall.mcdar.registry.SummonedEntityRegistry; +import net.neoforged.neoforge.client.event.EntityRenderersEvent; + +public class SummonedEntityRenderRegistryNeoForge { + + public static void register(EntityRenderersEvent.RegisterRenderers event) { + event.registerEntityRenderer(SummonedEntityRegistry.BUZZY_NEST_BEE_ENTITY, BuzzyNestBeeRenderer::new); + event.registerEntityRenderer(SummonedEntityRegistry.ENCHANTED_GRASS_BLUE_SHEEP_ENTITY, EnchantedGrassBlueSheepRenderer::new); + event.registerEntityRenderer(SummonedEntityRegistry.ENCHANTED_GRASS_GREEN_SHEEP_ENTITY, EnchantedGrassGreenSheepRenderer::new); + event.registerEntityRenderer(SummonedEntityRegistry.ENCHANTED_GRASS_RED_SHEEP_ENTITY, EnchantedGrassRedSheepRenderer::new); + event.registerEntityRenderer(SummonedEntityRegistry.GOLEM_KIT_GOLEM_ENTITY, GolemKitGolemRenderer::new); + event.registerEntityRenderer(SummonedEntityRegistry.TASTY_BONE_WOLF_ENTITY, TastyBoneWolfRenderer::new); + event.registerEntityRenderer(SummonedEntityRegistry.WONDERFUL_WHEAT_LLAMA_ENTITY, WonderfulWheatLlamaRenderer::new); + } +} diff --git a/neoforge/src/main/java/dev/timefall/mcdar/event/McdarForgeEventHandler.java b/neoforge/src/main/java/dev/timefall/mcdar/event/McdarForgeEventHandler.java new file mode 100644 index 0000000..6820ae7 --- /dev/null +++ b/neoforge/src/main/java/dev/timefall/mcdar/event/McdarForgeEventHandler.java @@ -0,0 +1,50 @@ +package dev.timefall.mcdar.event; + +import dev.timefall.mcdar.config.McdarArtifactsStatsConfig; +import dev.timefall.mcdar.effect.ArtifactEffects; +import dev.timefall.mcdar.effect.EnchantmentEffects; +import dev.timefall.mcdar.registry.StatusEffectRegistry; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.World; +import net.neoforged.neoforge.event.entity.living.LivingDeathEvent; +import net.neoforged.neoforge.event.entity.living.LivingEntityUseItemEvent; +import net.neoforged.neoforge.event.entity.player.AttackEntityEvent; +import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; + +public class McdarForgeEventHandler { + public static void mcdar$playerFinishPotionEvent(LivingEntityUseItemEvent.Finish event) { + World world = event.getEntity().getWorld(); + LivingEntity livingEntity = event.getEntity(); + if (world instanceof ServerWorld serverWorld && livingEntity instanceof PlayerEntity playerEntity) { + EnchantmentEffects.activateBeastBurst(playerEntity, serverWorld); + EnchantmentEffects.activateBeastSurge(playerEntity, serverWorld); + } + } + + public static void mcdar$onPowershakerExplodingKill(LivingDeathEvent event) { + if (!(event.getSource().getAttacker() instanceof PlayerEntity playerEntity)) return; + + if (McdarArtifactsStatsConfig.CONFIG.mcdar$getDamagingArtifactStats().POWERSHAKER_STATS.mcdar$getIsEnabled()) + ArtifactEffects.mcdar$activatePowerShaker(playerEntity, event.getEntity()); + } + + public static void mcdar$stunnedStatusPreventItemUsage(LivingEntityUseItemEvent.Start event) { + if (event.getEntity().hasStatusEffect(StatusEffectRegistry.STUNNED.getEntry())) { + event.setCanceled(true); + } + } + + public static void mcdar$stunnedStatusPreventAttackEntityBlock(AttackEntityEvent event) { + if (event.getEntity().hasStatusEffect(StatusEffectRegistry.STUNNED.getEntry())) { + event.setCanceled(true); + } + } + + public static void mcdar$stunnedStatusPreventAttackBlock(PlayerInteractEvent.LeftClickBlock event) { + if (event.getEntity().hasStatusEffect(StatusEffectRegistry.STUNNED.getEntry())) { + event.setCanceled(true); + } + } +} diff --git a/neoforge/src/main/java/dev/timefall/mcdar/registry/DefaultAttributeRegistryNeoForge.java b/neoforge/src/main/java/dev/timefall/mcdar/registry/DefaultAttributeRegistryNeoForge.java new file mode 100644 index 0000000..c095b4c --- /dev/null +++ b/neoforge/src/main/java/dev/timefall/mcdar/registry/DefaultAttributeRegistryNeoForge.java @@ -0,0 +1,17 @@ +package dev.timefall.mcdar.registry; + +import dev.timefall.mcdar.entity.*; +import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent; + +public class DefaultAttributeRegistryNeoForge { + + public static void registerAttributes(EntityAttributeCreationEvent event) { + event.put(SummonedEntityType.BUZZY_NEST_BEE_ENTITY, BuzzyNestBeeEntity.createBeeAttributes().build()); + event.put(SummonedEntityType.ENCHANTED_GRASS_GREEN_SHEEP_ENTITY, EnchantedGrassGreenSheepEntity.createEnchantedGreenSheepAttributes().build()); + event.put(SummonedEntityType.ENCHANTED_GRASS_BLUE_SHEEP_ENTITY, EnchantedGrassBlueSheepEntity.createEnchantedBlueSheepAttributes().build()); + event.put(SummonedEntityType.ENCHANTED_GRASS_RED_SHEEP_ENTITY, EnchantedGrassRedSheepEntity.createEnchantedRedSheepAttributes().build()); + event.put(SummonedEntityType.GOLEM_KIT_GOLEM_ENTITY, GolemKitGolemEntity.createIronGolemAttributes().build()); + event.put(SummonedEntityType.TASTY_BONE_WOLF_ENTITY, TastyBoneWolfEntity.createTastyBoneWolfAttributes().build()); + event.put(SummonedEntityType.WONDERFUL_WHEAT_LLAMA_ENTITY, WonderfulWheatLlamaEntity.createWonderfulWheatLlamaAttributes().build()); + } +} diff --git a/neoforge/src/main/java/dev/timefall/mcdar/services/ForgePlatformHelper.java b/neoforge/src/main/java/dev/timefall/mcdar/services/ForgePlatformHelper.java deleted file mode 100644 index 623471a..0000000 --- a/neoforge/src/main/java/dev/timefall/mcdar/services/ForgePlatformHelper.java +++ /dev/null @@ -1,23 +0,0 @@ -package dev.timefall.mcdar.services; - -import dev.timefall.mcdar.platform.IPlatformHelper; -import net.neoforged.fml.ModList; -import net.neoforged.fml.loading.FMLLoader; - -public class ForgePlatformHelper implements IPlatformHelper { - - @Override - public String getPlatformName() { - return "Forge"; - } - - @Override - public boolean isModLoaded(String modId) { - return ModList.get().isLoaded(modId); - } - - @Override - public boolean isDevelopmentEnvironment() { - return !FMLLoader.isProduction(); - } -} \ No newline at end of file