Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soothing Lantern: Polymer Edition #71

Merged
merged 6 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 16 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,10 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven {
name = 'Ladysnake Mods'
url = 'https://ladysnake.jfrog.io/artifactory/mods'
}

maven { url "https://ladysnake.jfrog.io/artifactory/mods" }
maven { url "https://maven.shedaniel.me/" }

maven {
url "https://maven.terraformersmc.com/"
}

maven { url "https://maven.terraformersmc.com/" }
maven { url "https://maven.nucleoid.xyz" }
}

dependencies {
Expand All @@ -35,24 +28,25 @@ dependencies {
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"


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

modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cardinal_version}"
modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cardinal_version}"
include "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cardinal_version}"
include "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cardinal_version}"

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
// Cardinal Components
modImplementation include("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cardinal_version}")
modImplementation include("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cardinal_version}")

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
modApi("me.shedaniel.cloth:cloth-config-fabric:${project.config_version}") {
exclude(group: 'net.fabricmc.fabric-api')
}
// Cloth Config
modApi("me.shedaniel.cloth:cloth-config-fabric:${project.config_version}") { exclude(group: 'net.fabricmc.fabric-api') }

// Mod Menu
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"

// Polymer
modImplementation include("eu.pb4:polymer:${project.polymer_version}")
modImplementation include("eu.pb4:polymer-blocks:${project.polymer_blocks_version}")

// Server Translation API
modImplementation include("fr.catcore:server-translations-api:${project.server_translation_api_version}")
}

processResources {
Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.jvmargs=-Xmx4G

# Fabric Properties
# check these on https://fabricmc.net/develop
Expand All @@ -18,3 +18,6 @@ org.gradle.jvmargs=-Xmx1G
cardinal_version=5.0.2
modmenu_version=4.0.6
config_version=8.2.88
polymer_version=0.2.18+1.19.2
polymer_blocks_version=0.1.0-alpha.9+1.19.2
server_translation_api_version=1.4.18+1.19.2
68 changes: 37 additions & 31 deletions src/main/java/net/hyper_pigeon/eldritch_mobs/EldritchMobsMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.fabricmc.api.ModInitializer;
import net.hyper_pigeon.eldritch_mobs.ability.Ability;
import net.hyper_pigeon.eldritch_mobs.ability.AbilityHelper;
import net.hyper_pigeon.eldritch_mobs.ability.data.CustomAbilityManager;
import net.hyper_pigeon.eldritch_mobs.component.interfaces.ModifierComponent;
import net.hyper_pigeon.eldritch_mobs.config.EldritchMobsConfig;
import net.hyper_pigeon.eldritch_mobs.rank.MobRank;
Expand All @@ -23,35 +22,42 @@
import java.util.List;

public class EldritchMobsMod implements ModInitializer {
// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LoggerFactory.getLogger("eldritch_mobs");

public static final EldritchMobsConfig ELDRITCH_MOBS_CONFIG = AutoConfig.register(EldritchMobsConfig.class, JanksonConfigSerializer::new).getConfig();

public static final ComponentKey<ModifierComponent> ELDRITCH_MODIFIERS =
ComponentRegistry.getOrCreate(new Identifier("eldritch_mobs:eldritch_modifiers"), ModifierComponent.class);

@Override
public void onInitialize() {
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.
LOGGER.info("Channelling eldritch energies...");
EldritchMobsEventListeners.init();
EldritchMobsCommands.init();
EldritchMobsDataRegistry.init();
EldritchMobsBlocks.init();
AbilityHelper.removeDisabledAbilities();
}

public static List<Ability> getModifiers(ComponentProvider componentProvider){
return ELDRITCH_MODIFIERS.get(componentProvider).getModifiers();
}

public static MobRank getRank(ComponentProvider componentProvider){
return ELDRITCH_MODIFIERS.get(componentProvider).getRank();
}

public static final String MOD_NAME = "Eldritch Mobs";
public static final String MOD_ID = "eldritch_mobs";
public static Identifier id(String path) {
return new Identifier(MOD_ID, path);
}

// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_NAME);

public static final EldritchMobsConfig ELDRITCH_MOBS_CONFIG = AutoConfig.register(EldritchMobsConfig.class, JanksonConfigSerializer::new).getConfig();

public static final ComponentKey<ModifierComponent> ELDRITCH_MODIFIERS =
ComponentRegistry.getOrCreate(id("eldritch_modifiers"), ModifierComponent.class);

@Override
public void onInitialize() {
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.
LOGGER.info("Channelling eldritch energies...");

EldritchMobsEventListeners.init();
EldritchMobsCommands.init();
EldritchMobsDataRegistry.init();
EldritchMobsBlocks.init();
AbilityHelper.removeDisabledAbilities();
}

public static List<Ability> getModifiers(ComponentProvider componentProvider) {
return ELDRITCH_MODIFIERS.get(componentProvider).getModifiers();
}

public static MobRank getRank(ComponentProvider componentProvider) {
return ELDRITCH_MODIFIERS.get(componentProvider).getRank();
}
}
43 changes: 32 additions & 11 deletions src/main/java/net/hyper_pigeon/eldritch_mobs/ability/Ability.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,40 @@
public interface Ability {

String getName();

static String getConfig() { return null; }

AbilityType getAbilityType();

AbilitySubType getAbilitySubType();

default long getCooldown(){return 0;}
default boolean canUseAbilty(MobEntity mobEntity){return false;}
default void onAbilityUse(MobEntity mobEntity){};
default void passiveApply(MobEntity mobEntity){};
default void onDamaged(LivingEntity entity, DamageSource source, float amount){};
default boolean dealsSelfDamage(){return false;}
default boolean negatesProjectileDamage(){return false;}
default void onAttack(LivingEntity attacker, LivingEntity entity){};
default void onDamageToTarget(LivingEntity attacker, LivingEntity target, DamageSource source, float amount){};
default void onDeath(LivingEntity livingEntity,DamageSource damageSource){};
default void onRangedAttack(LivingEntity owner, PersistentProjectileEntity projectile){};
default long getCooldown() {
return 0;
}

default boolean canUseAbility(MobEntity mobEntity) {
return false;
}

default void onAbilityUse(MobEntity mobEntity) {}

default void passiveApply(MobEntity mobEntity) {}

default void onDamaged(LivingEntity entity, DamageSource source, float amount) {}

default boolean dealsSelfDamage() {
return false;
}

default boolean negatesProjectileDamage() {
return false;
}

default void onAttack(LivingEntity attacker, LivingEntity entity) {}

default void onDamageToTarget(LivingEntity attacker, LivingEntity target, DamageSource source, float amount) {}

default void onDeath(LivingEntity livingEntity, DamageSource damageSource) {}

default void onRangedAttack(LivingEntity owner, PersistentProjectileEntity projectile) {}
}
Loading