Skip to content

Commit

Permalink
Config Rewrite, Stats Config II, Tags, Licence Update, Version Constr…
Browse files Browse the repository at this point in the history
…aints, Optimised Imports

 - Added `buzzy_nest_bee` to `beehive_inhabitors` tag (Fixed #31)
 - Added configurable `loottables` and values for artifacts (Fixed #37)
 - Confirmed Golem Crash no longer happening (Fixed #38)
 - Will be uploading to Modrinth (Fixed #39)
 - Constrained Minecraft Dependency to crash on 1.20.2+
 - Updated Licence to TDL 1.2
 - Refactored LootRegistry
  • Loading branch information
chronosacaria committed Jan 23, 2024
1 parent ea0229d commit 50f31c4
Show file tree
Hide file tree
Showing 15 changed files with 458 additions and 349 deletions.
9 changes: 6 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Timefall Development License 1.1
Timefall Development License 1.2

Copyright (c) 2020-2023 Chronosacaria, Kluzzio, Timefall Development. All Rights Reserved.
Copyright (c) 2020-2024 Chronosacaria, Kluzzio, Timefall Development. All Rights Reserved.

Permissions are hereby granted, below, to any person having a copy of this software and/or its associated files:

Expand All @@ -12,6 +12,9 @@ Distributing - You may not distribute this software.
Sublicensing - You may not sublicense this software.
Selling - You may not sell this software, any part of this software, or restrict its access behind any paywall to monetised link.

Special Cases and Commercial Usage Clarification:
In the cases of special or commercial use, including, but not limited to the production of other Minecraft mods, any member of Timefall Development who are noted as the copyright holders of this software may provide written consent to grant you a non-exclusive, non-transferable, world-wide license usage of any aspect of this software. This consent can be revoked at any time by any member of Timefall Development.

Modpack Clarification:
Permission is granted for Modpacks to include this software as long as the copy of this software in the pack is done via a manifest which would download this software from its respective CurseForge or Modrinth page. In the case of explicit written permission by a copyright holder, this software may permitted to be used as an override, allowing for the direct integration with the Modpack in question. In the case of a resource pack, it may be added directly to a modpack's download.

Expand All @@ -29,4 +32,4 @@ Content Creator, in this license, means anyone who creates content on YouTube or

The above copyright notice and these permission notices shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
84 changes: 0 additions & 84 deletions src/main/java/chronosacaria/mcdar/api/CleanlinessHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,90 +136,6 @@ public static boolean isCoolingDown(PlayerEntity player, Item item) {
return ActionResult.SUCCESS;
}

public static float mcdar$artifactIDToGeneralSpawnChance(Item artifactItem) {
if (artifactItem instanceof IArtifactItem) {
for (AgilityArtifactID agilityArtifactID : AgilityArtifactID.values())
if (artifactItem.asItem() == agilityArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.AGILITY_ARTIFACT_STATS.get(agilityArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.AGILITY_ARTIFACT_STATS.get(agilityArtifactID)
.mcdar$getGeneralArtifactSpawnRate();
for (DamagingArtifactID damagingArtifactID : DamagingArtifactID.values())
if (artifactItem.asItem() == damagingArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.DAMAGING_ARTIFACT_STATS.get(damagingArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.DAMAGING_ARTIFACT_STATS.get(damagingArtifactID)
.mcdar$getGeneralArtifactSpawnRate();
for (DefensiveArtifactID defensiveArtifactID : DefensiveArtifactID.values())
if (artifactItem.asItem() == defensiveArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.DEFENSIVE_ARTIFACT_STATS.get(defensiveArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.DEFENSIVE_ARTIFACT_STATS.get(defensiveArtifactID)
.mcdar$getGeneralArtifactSpawnRate();
for (QuiverArtifactID quiverArtifactID : QuiverArtifactID.values())
if (artifactItem.asItem() == quiverArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.QUIVER_ARTIFACT_STATS.get(quiverArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.QUIVER_ARTIFACT_STATS.get(quiverArtifactID)
.mcdar$getGeneralArtifactSpawnRate();
for (StatusInflictingArtifactID statusInflictingArtifactID : StatusInflictingArtifactID.values())
if (artifactItem.asItem() == statusInflictingArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.STATUS_INFLICTING_ARTIFACT_STATS.get(statusInflictingArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.STATUS_INFLICTING_ARTIFACT_STATS.get(statusInflictingArtifactID)
.mcdar$getGeneralArtifactSpawnRate();
for (SummoningArtifactID summoningArtifactID : SummoningArtifactID.values())
if (artifactItem.asItem() == summoningArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.SUMMONING_ARTIFACT_STATS.get(summoningArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.SUMMONING_ARTIFACT_STATS.get(summoningArtifactID)
.mcdar$getGeneralArtifactSpawnRate();
}
return 0.0f;
}
public static float mcdar$artifactIDToDungeonSpawnChance(Item artifactItem) {
if (artifactItem instanceof IArtifactItem) {
for (AgilityArtifactID agilityArtifactID : AgilityArtifactID.values())
if (artifactItem.asItem() == agilityArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.AGILITY_ARTIFACT_STATS.get(agilityArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.AGILITY_ARTIFACT_STATS.get(agilityArtifactID)
.mcdar$getDungeonArtifactSpawnRate();
for (DamagingArtifactID damagingArtifactID : DamagingArtifactID.values())
if (artifactItem.asItem() == damagingArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.DAMAGING_ARTIFACT_STATS.get(damagingArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.DAMAGING_ARTIFACT_STATS.get(damagingArtifactID)
.mcdar$getDungeonArtifactSpawnRate();
for (DefensiveArtifactID defensiveArtifactID : DefensiveArtifactID.values())
if (artifactItem.asItem() == defensiveArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.DEFENSIVE_ARTIFACT_STATS.get(defensiveArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.DEFENSIVE_ARTIFACT_STATS.get(defensiveArtifactID)
.mcdar$getDungeonArtifactSpawnRate();
for (QuiverArtifactID quiverArtifactID : QuiverArtifactID.values())
if (artifactItem.asItem() == quiverArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.QUIVER_ARTIFACT_STATS.get(quiverArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.QUIVER_ARTIFACT_STATS.get(quiverArtifactID)
.mcdar$getDungeonArtifactSpawnRate();
for (StatusInflictingArtifactID statusInflictingArtifactID : StatusInflictingArtifactID.values())
if (artifactItem.asItem() == statusInflictingArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.STATUS_INFLICTING_ARTIFACT_STATS.get(statusInflictingArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.STATUS_INFLICTING_ARTIFACT_STATS.get(statusInflictingArtifactID)
.mcdar$getDungeonArtifactSpawnRate();
for (SummoningArtifactID summoningArtifactID : SummoningArtifactID.values())
if (artifactItem.asItem() == summoningArtifactID.mcdar$getItem()
&& Mcdar.CONFIG.mcdarArtifactsStatsConfig.SUMMONING_ARTIFACT_STATS.get(summoningArtifactID)
.mcdar$getIsEnabled())
return Mcdar.CONFIG.mcdarArtifactsStatsConfig.SUMMONING_ARTIFACT_STATS.get(summoningArtifactID)
.mcdar$getDungeonArtifactSpawnRate();
}
return 0.0f;
}


private static int mcdar$artifactIDToItemCooldownTime(Item artifactItem) {
int cooldownLevel = net.minecraft.enchantment.EnchantmentHelper.getLevel(EnchantsRegistry.COOLDOWN, artifactItem.getDefaultStack());
if (artifactItem instanceof IArtifactItem) {
Expand Down
92 changes: 92 additions & 0 deletions src/main/java/chronosacaria/mcdar/api/GroupedObjectsHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package chronosacaria.mcdar.api;

import chronosacaria.mcdar.enums.*;
import net.minecraft.loot.LootTables;
import net.minecraft.util.Identifier;

import java.util.List;
import java.util.Set;

public class GroupedObjectsHelper {
public static final Set<Identifier> ILLAGER_ARTIFACT_GENERAL_LOOT_TABLES =
Set.of(LootTables.WOODLAND_MANSION_CHEST, LootTables.PILLAGER_OUTPOST_CHEST);

public static final Set<Identifier> VILLAGER_ARTIFACT_GENERAL_LOOT_TABLES =
Set.of(LootTables.VILLAGE_ARMORER_CHEST, LootTables.VILLAGE_BUTCHER_CHEST,
LootTables.VILLAGE_CARTOGRAPHER_CHEST, LootTables.VILLAGE_FISHER_CHEST,
LootTables.VILLAGE_FLETCHER_CHEST, LootTables.VILLAGE_DESERT_HOUSE_CHEST,
LootTables.VILLAGE_MASON_CHEST, LootTables.VILLAGE_PLAINS_CHEST,
LootTables.VILLAGE_SAVANNA_HOUSE_CHEST, LootTables.VILLAGE_SHEPARD_CHEST,
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<Identifier> 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,15 +1,18 @@
package chronosacaria.mcdar.config;

import java.util.List;
import java.util.Set;

public class ArtifactStatsConfigHelper {

List<String> comment;
boolean isEnabled = true;
int durability;
int maxCooldownEnchantmentTime;
float generalSpawnRate;
float dungeonSpawnRate;
int generalSpawnWeight;
int dungeonSpawnWeight;
Set<String> generalLootTables;
Set<String> dungeonLootTables;

public boolean mcdar$getIsEnabled() {
return isEnabled;
Expand All @@ -23,31 +26,42 @@ public class ArtifactStatsConfigHelper {
return maxCooldownEnchantmentTime;
}

public float mcdar$getGeneralArtifactSpawnRate() {
return generalSpawnRate;
public int mcdar$getGeneralArtifactSpawnWeight() {
return generalSpawnWeight;
}

public float mcdar$getDungeonArtifactSpawnRate() {
return dungeonSpawnRate;
public int mcdar$getDungeonArtifactSpawnWeight() {
return dungeonSpawnWeight;
}
public Set<String> mcdar$getGeneralLootTables() {
return generalLootTables;
}

public Set<String> mcdar$getDungeonLootTables() {
return dungeonLootTables;
}

@SuppressWarnings("unused")
public ArtifactStatsConfigHelper() {
}

public ArtifactStatsConfigHelper(boolean isEnabled, int durability, int maxCooldownEnchantmentTime, float generalSpawnRate, float dungeonSpawnRate) {
public ArtifactStatsConfigHelper(boolean isEnabled, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight, Set<String> generalLootTables, Set<String> dungeonLootTables) {
this.isEnabled = isEnabled;
this.durability = durability;
this.maxCooldownEnchantmentTime = maxCooldownEnchantmentTime;
this.generalSpawnRate = generalSpawnRate;
this.dungeonSpawnRate = dungeonSpawnRate;
this.generalSpawnWeight = generalSpawnWeight;
this.dungeonSpawnWeight = dungeonSpawnWeight;
this.generalLootTables = generalLootTables;
this.dungeonLootTables = dungeonLootTables;
}
public ArtifactStatsConfigHelper(List<String> comment, boolean isEnabled, int durability, int maxCooldownEnchantmentTime, float generalSpawnRate, float dungeonSpawnRate) {
public ArtifactStatsConfigHelper(List<String> comment, boolean isEnabled, int durability, int maxCooldownEnchantmentTime, int generalSpawnWeight, int dungeonSpawnWeight, Set<String> generalLootTables, Set<String> dungeonLootTables) {
this.comment = comment;
this.isEnabled = isEnabled;
this.durability = durability;
this.maxCooldownEnchantmentTime = maxCooldownEnchantmentTime;
this.generalSpawnRate = generalSpawnRate;
this.dungeonSpawnRate = dungeonSpawnRate;
this.generalSpawnWeight = generalSpawnWeight;
this.dungeonSpawnWeight = dungeonSpawnWeight;
this.generalLootTables = generalLootTables;
this.dungeonLootTables = dungeonLootTables;
}
}
Loading

0 comments on commit 50f31c4

Please sign in to comment.