Skip to content

Commit

Permalink
1.21 Update 3
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
chronosacaria committed Dec 15, 2024
1 parent e889a9d commit 30f2972
Show file tree
Hide file tree
Showing 134 changed files with 1,144 additions and 1,330 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ allprojects {
includeGroup "maven.modrinth"
}
}
maven {
name = "FzzyMaven"
url = "https://maven.fzzyhmstrs.me/"
}
}

tasks.withType(JavaCompile).configureEach {
Expand Down
5 changes: 1 addition & 4 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions common/src/main/java/dev/timefall/mcdar/McdarCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
4 changes: 2 additions & 2 deletions common/src/main/java/dev/timefall/mcdar/ModConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<ItemGroup> ARTIFACTS = RegistryKey.of(RegistryKeys.ITEM_GROUP, ModConstants.ID("artifacts"));
public static final RegistryKey<ItemGroup> ARTIFACTS = RegistryKey.of(RegistryKeys.ITEM_GROUP, ModConstants.id("artifacts"));

public static final Logger LOGGER = LogManager.getLogger(MOD_ID);

Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/dev/timefall/mcdar/api/AOEHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -55,11 +56,13 @@ private static boolean isUnaffectedByAoe(LivingEntity entity) {
return false;
}

//Recommend making into a tag
public static final List<ItemStack> 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<Item> 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,
Expand Down
56 changes: 11 additions & 45 deletions common/src/main/java/dev/timefall/mcdar/api/CleanlinessHelper.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
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;
import net.minecraft.entity.ItemEntity;
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;
Expand Down Expand Up @@ -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<StatusEffectInstance> potionEffects) {
return potionEffects.stream().filter(
(instance) -> instance.getEffectType()
== StatusEffects.INSTANT_HEALTH
|| instance.getEffectType()
== StatusEffects.REGENERATION
).toList().size() > 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<RegistryKey<LootTable>> ALL_ARTIFACTS_DUNGEON_LOOT_TABLES =
Set.of(LootTables.ABANDONED_MINESHAFT_CHEST, LootTables.SIMPLE_DUNGEON_CHEST, LootTables.SHIPWRECK_TREASURE_CHEST);

/*
public static final List<IArtifactItem> 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<IArtifactItem> 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<IArtifactItem> 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);
*/
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<ItemStack> 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);
Expand Down
Loading

0 comments on commit 30f2972

Please sign in to comment.