Skip to content

Commit

Permalink
1.21 Update 1
Browse files Browse the repository at this point in the history
- Updated Gradle to allow for multiloader support
- Moved functioning code over to common directory
- Moved from Cloth Config to Fzzy Config
- Started setting up new configs
- Renamed packages from `java.chronosacaria` to `java.dev.timefall`
- Started adding more configurability for various artifacts
  • Loading branch information
chronosacaria committed Oct 7, 2024
1 parent 9d2eae4 commit d812ff5
Show file tree
Hide file tree
Showing 347 changed files with 3,724 additions and 2,684 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ gradle-app.setting
**/build/

# Common working directory
run/
fabric/run/

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
120 changes: 63 additions & 57 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,77 +1,83 @@
//file:noinspection GroovyAssignabilityCheck
//file:noinspection GroovyAssignabilityCheck
//file:noinspection GroovyAssignabilityCheck
//file:noinspection GrUnresolvedAccess
//file:noinspection GrUnresolvedAccess
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'maven-publish'
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "me.modmuss50.mod-publish-plugin" version "0.3.4" apply false
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

repositories {
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/"}
architectury {
minecraft = rootProject.minecraft_version
}

dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
subprojects {
apply plugin: "dev.architectury.loom"
apply plugin: "me.modmuss50.mod-publish-plugin"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
base.archivesName = "${rootProject.archives_base_name}-${project.name}"

modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
// mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
if (project.name != "neoforge") {
mappings "net.fabricmc:yarn:${rootProject.minecraft_version}+build.${rootProject.yarn_mappings}:v2"
}
}

}
processResources {
inputs.property "version", project.version
//if (project.name != "common") {
// publishMods {
// file = remapJar.archiveFile
// changelog = file('../CHANGELOG.md').text
// type = project.mod_version.contains("alpha") ? ALPHA :
// project.mod_version.contains("beta") ? BETA : STABLE

filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
// modrinth {
// accessToken = providers.environmentVariable("MODRINTH_API_KEY")
// projectId = "xweQBqAC"
// minecraftVersions.add(rootProject.minecraft_version)
// }

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
// curseforge {
// accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
// projectId = "476788"
// minecraftVersions.add(rootProject.minecraft_version)
// }
// }
//}
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
version = "${rootProject.mod_version}+mc${rootProject.minecraft_version}"
group = rootProject.maven_group

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
repositories {
maven {
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/"
}
maven {
name = "QuiltMC"
url = "https://maven.quiltmc.org/repository/release/"
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = 21
}

java {
withSourcesJar()
}
}
30 changes: 30 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
architectury {
common(rootProject.enabled_platforms.split(","))
}


dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
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")


}

publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}
19 changes: 19 additions & 0 deletions common/src/main/java/dev/timefall/mcdar/McdarCommon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package dev.timefall.mcdar;

import dev.timefall.mcdar.registries.ArtifactsRegistry;
import dev.timefall.mcdar.registries.ItemGroupRegistry;
import dev.timefall.mcdar.registries.StatusEffectRegistry;
import dev.timefall.mcdar.registries.SummonedEntityAttributeRegistry;

public class McdarCommon {

public static void initialize() {
//CONFIG = AutoConfig.getConfigHolder(McdarConfig.class).getConfig();
ArtifactsRegistry.register();
ItemGroupRegistry.register();
//EnchantsRegistry.register();
StatusEffectRegistry.register();
SummonedEntityAttributeRegistry.register();
//SummonedEntityRegistry.register();
}
}
20 changes: 20 additions & 0 deletions common/src/main/java/dev/timefall/mcdar/ModConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package dev.timefall.mcdar;

import net.minecraft.item.ItemGroup;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class ModConstants {

public static final String MOD_ID = "mcdar";
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 Logger LOGGER = LogManager.getLogger(MOD_ID);

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package chronosacaria.mcdar.api;
package dev.timefall.mcdar.api;

import net.minecraft.entity.AreaEffectCloudEntity;
import net.minecraft.entity.LivingEntity;
Expand All @@ -17,10 +17,10 @@ public static void spawnExplosionCloud(LivingEntity attacker, LivingEntity victi
attacker.getWorld().spawnEntity(areaEffectCloudEntity);
}

public static void spawnStatusEffectCloud(LivingEntity owner, BlockPos blockPos, int duration, StatusEffectInstance... statusEffectInstances) {
public static void spawnStatusEffectCloud(LivingEntity owner, BlockPos blockPos, float radius, int duration, StatusEffectInstance... statusEffectInstances) {
AreaEffectCloudEntity aoeCloudEntity = new AreaEffectCloudEntity(owner.getWorld(), blockPos.getX(), blockPos.getY() + 1, blockPos.getZ());
aoeCloudEntity.setOwner(owner);
aoeCloudEntity.setRadius(5.0f);
aoeCloudEntity.setRadius(radius);
aoeCloudEntity.setRadiusOnUse(-0.5f);
aoeCloudEntity.setWaitTime(10);
aoeCloudEntity.setDuration(duration);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package chronosacaria.mcdar.api;
package dev.timefall.mcdar.api;

import chronosacaria.mcdar.mixin.CreeperEntityAccessor;
import chronosacaria.mcdar.registries.StatusEffectInit;
import dev.timefall.mcdar.mixin.CreeperEntityAccessor;
import dev.timefall.mcdar.registries.StatusEffectRegistry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LightningEntity;
Expand All @@ -16,6 +16,7 @@
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
Expand All @@ -42,8 +43,8 @@ public static List<? extends LivingEntity> getEntitiesByPredicate(Class<? extend
);
}

public static void afflictNearbyEntities(LivingEntity user, StatusEffectInstance... statusEffectInstances) {
for (LivingEntity nearbyEntity : getEntitiesByPredicate(user, 5,
public static void afflictNearbyEntities(LivingEntity user, float range, StatusEffectInstance... statusEffectInstances) {
for (LivingEntity nearbyEntity : getEntitiesByPredicate(user, range,
(nearbyEntity) -> nearbyEntity != user && !AbilityHelper.isPetOf(nearbyEntity, user) && nearbyEntity.isAlive())){
for (StatusEffectInstance instance : statusEffectInstances)
nearbyEntity.addStatusEffect(instance);
Expand Down Expand Up @@ -143,25 +144,28 @@ public static void knockbackNearbyEnemies(PlayerEntity user, LivingEntity nearby
nearbyEntity.takeKnockback(0.4F * knockbackMultiplier, xRatio, zRatio);
}

public static void satchelOfElementsEffects(PlayerEntity user) {
public static void satchelOfElementsEffects(PlayerEntity user, float damage, float range, int duration, int amplifier, int amplifier2, int amplifier3) {
int effectInt = (CleanlinessHelper.RANDOM.nextInt(3));

if (effectInt == 0){ // BURNING
for (LivingEntity nearbyEntity : getEntitiesByPredicate(user, 5,
for (LivingEntity nearbyEntity : getEntitiesByPredicate(user, range,
(nearbyEntity) -> nearbyEntity != user && !AbilityHelper.isPetOf(nearbyEntity, user) && nearbyEntity.isAlive())){
nearbyEntity.setOnFireFor(3);
}
}
if (effectInt == 1) { // FROZEN
afflictNearbyEntities(user, new StatusEffectInstance(StatusEffectInit.STUNNED, 100),
new StatusEffectInstance(StatusEffects.NAUSEA, 100),
new StatusEffectInstance(StatusEffects.SLOWNESS, 100, 4));
afflictNearbyEntities(
user,
range,
new StatusEffectInstance(RegistryEntry.of(StatusEffectRegistry.STUNNED), duration, amplifier),
new StatusEffectInstance(StatusEffects.NAUSEA, duration, amplifier2),
new StatusEffectInstance(StatusEffects.SLOWNESS, duration, amplifier3)
);
}
if (effectInt == 2){ // LIGHTNING STRIKE
for (LivingEntity nearbyEntity : getEntitiesByPredicate(user, 5,
for (LivingEntity nearbyEntity : getEntitiesByPredicate(user, range,
(nearbyEntity) -> nearbyEntity != user && !AbilityHelper.isPetOf(nearbyEntity, user) && nearbyEntity.isAlive())){
summonLightningBoltOnEntity(nearbyEntity);
nearbyEntity.damage(nearbyEntity.getWorld().getDamageSources().lightningBolt(), 5.0f);
AOEHelper.electrocute(nearbyEntity, damage);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package chronosacaria.mcdar.api;
package dev.timefall.mcdar.api;

import net.minecraft.component.type.PotionContentsComponent;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.Tameable;
import net.minecraft.entity.passive.IronGolemEntity;
Expand All @@ -8,7 +9,6 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.PotionUtil;
import net.minecraft.potion.Potions;

import java.util.Arrays;
Expand Down Expand Up @@ -56,9 +56,9 @@ private static boolean isUnaffectedByAoe(LivingEntity entity) {
}

public static final List<ItemStack> SATCHEL_OF_ELIXIRS_LIST = List.of(
PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.STRENGTH),
PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.SWIFTNESS),
PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.INVISIBILITY));
PotionContentsComponent.createStack(Items.POTION, Potions.STRENGTH),
PotionContentsComponent.createStack(Items.POTION, Potions.SWIFTNESS),
PotionContentsComponent.createStack(Items.POTION, Potions.INVISIBILITY));

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,
Expand Down
Loading

0 comments on commit d812ff5

Please sign in to comment.