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

Update Porting-Lib to newer versions & fix Maven deps to fix crashes on launch with newer versions of Porting Lib #12

Open
wants to merge 4 commits into
base: 1.20.x
Choose a base branch
from
Open
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
23 changes: 20 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ group = project.maven_group
repositories {
mavenCentral()
maven { url "https://maven.parchmentmc.org" }
maven { url "https://mvn.devos.one/snapshots/" }
maven { url "https://mvn.devos.one/releases/" }
maven { url "https://jitpack.io" }
maven { url "https://ladysnake.jfrog.io/artifactory/mods" }
maven { url "https://maven.ladysnake.org/releases" }
maven { url "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" }
maven { url "https://maven.blamejared.com/" }
maven { url "https://modmaven.dev" }
maven { url "https://maven.terraformersmc.com/" }
maven { url "https://maven.vram.io/" }
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.jamieswhiteshirt.com/libs-release" }
}

dependencies {
Expand All @@ -32,7 +33,23 @@ dependencies {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${project.parchment_version}@zip")
}
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:Porting-Lib:${project.portinglib_version}"))

// Manual include of reach-entity-attributes because Porting-Lib:base depends on it but can't find it at its current Maven URL
modImplementation(include("com.jamieswhiteshirt:reach-entity-attributes:2.4.0"))
// Porting-Lib has now broken out into smaller submodules to keep the package light
// These are each of the specific required includes for this project. Full list here:
// https://github.com/Fabricators-of-Create/Porting-Lib?tab=readme-ov-file#modules
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:base:${project.portinglib_version}"))
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:client_events:${project.portinglib_version}"))
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:common:${project.portinglib_version}"))
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:core:${project.portinglib_version}"))
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:data:${project.portinglib_version}"))
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:entity:${project.portinglib_version}"))
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:items:${project.portinglib_version}"))
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:loot:${project.portinglib_version}"))
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:tags:${project.portinglib_version}"))
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:transfer:${project.portinglib_version}"))
modImplementation(include("io.github.fabricators_of_create.Porting-Lib:utility:${project.portinglib_version}"))
modImplementation(include("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cc_version}"))
modImplementation(include("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cc_version}"))
modImplementation "fuzs.forgeconfigapiport:forgeconfigapiport-fabric:${project.configapi_version}"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ org.gradle.parallel=true
loader_version=0.14.21
mod_version = 1.2.1-fabric
maven_group = java.elucent
archives_base_name = rootsclassic-1.20
archives_base_name = rootsclassic-1.20-portinglibfix
fabric_version=0.85.0+1.20.1
portinglib_version=2.1.1087+1.20
portinglib_version=2.3.4+1.20.1
cc_version=5.2.1
configapi_version=8.0.0
nightconfig_version=3.6.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected int getStackLimit(int slot, @NotNull ItemVariant stack) {
}

@Override
public boolean isItemValid(int slot, ItemVariant stack) {
public boolean isItemValid(int slot, ItemVariant stack, int count) {
if (slot == 0) {
return stack.toStack().is(Tags.Items.RODS_WOODEN);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package elucent.rootsclassic.entity.skeleton;

import elucent.rootsclassic.registry.RootsEntities;
import io.github.fabricators_of_create.porting_lib.fake_players.FakePlayer;
import net.fabricmc.fabric.api.entity.FakePlayer;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
Expand Down
27 changes: 14 additions & 13 deletions src/main/java/elucent/rootsclassic/event/ComponentSpellsEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import elucent.rootsclassic.capability.RootsCapabilityManager;
import elucent.rootsclassic.registry.RootsRegistry;
import elucent.rootsclassic.util.RootsUtil;
import io.github.fabricators_of_create.porting_lib.entity.events.living.LivingEntityDamageEvents;
import io.github.fabricators_of_create.porting_lib.entity.events.living.LivingEntityEvents;
import io.github.fabricators_of_create.porting_lib.entity.events.LivingEntityEvents;
import io.github.fabricators_of_create.porting_lib.entity.events.living.LivingHurtEvent;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EquipmentSlot;
Expand All @@ -23,7 +23,8 @@ public static void registerEvents() {
}

private static void onLivingTick() {
LivingEntityEvents.TICK.register(livingEntity -> {
LivingEntityEvents.LivingTickEvent.TICK.register(listener -> {
LivingEntity livingEntity = listener.getEntity();
if(livingEntity instanceof Player) {
// armor regen if full set
wildwoodArmorRegenFullset((Player)livingEntity);
Expand Down Expand Up @@ -78,16 +79,16 @@ public void onLivingXP(LivingExperienceDropEvent event) {
*/

private static void onLivingDamage() {
LivingEntityDamageEvents.HURT.register((event) -> {
LivingEntity entityLiving = event.damaged;
DamageSource damageSource = event.damageSource;
LivingHurtEvent.HURT.register((event) -> {
LivingEntity entityLiving = event.getEntity();
DamageSource damageSource = event.getSource();

CompoundTag persistentData = entityLiving.getCustomData();
if (persistentData.contains(Const.NBT_VULN)) {
event.damageAmount = (float) (event.damageAmount * (1.0 + persistentData.getDouble(Const.NBT_VULN)));
event.setAmount((float) (event.getAmount() * (1.0 + persistentData.getDouble(Const.NBT_VULN))));
persistentData.remove(Const.NBT_VULN);
}
if (persistentData.contains(Const.NBT_THORNS) && event.damageSource.getEntity() instanceof LivingEntity) {
if (persistentData.contains(Const.NBT_THORNS) && event.getSource().getEntity() instanceof LivingEntity) {
((LivingEntity) damageSource.getEntity()).hurt(entityLiving.damageSources().cactus(), persistentData.getFloat(Const.NBT_THORNS));
persistentData.remove(Const.NBT_THORNS);
RootsUtil.decrementTickTracking(entityLiving);
Expand All @@ -99,7 +100,7 @@ private static void onLivingDamage() {
int stepLvl = sword.getTag().getInt("shadowstep");
double chance = stepLvl * 12.5;
if (player.getCommandSenderWorld().random.nextInt(100) < chance) {
event.setCancelled(true);
event.setCanceled(true);
}
}
}
Expand All @@ -119,14 +120,14 @@ private static void onLivingDamage() {
if ((tag.contains("holy")) && entityLiving.getMobType() == MobType.UNDEAD) {
int holyLvl = tag.getInt("holy");
float amount = holyLvl * 1.5f;
float currentAmount = event.damageAmount;
event.damageAmount = (currentAmount + amount);
float currentAmount = event.getAmount();
event.setAmount(currentAmount + amount);
}
if (tag.contains("spikes")) {
int spikeLvl = tag.getInt("spikes");
float amount = spikeLvl;
float currentAmount = event.damageAmount;
event.damageAmount = (currentAmount + amount);
float currentAmount = event.getAmount();
event.setAmount(currentAmount + amount);
}
}
}
Expand Down
Loading