Skip to content

Commit

Permalink
switch to caelus for flight (closes #88)
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Apr 22, 2024
1 parent 73bbb1b commit f47b436
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 95 deletions.
9 changes: 9 additions & 0 deletions NeoForge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ if(usingJarJar) {
}
jar.finalizedBy('reobfJar')

repositories {
maven {
name = "TheIllusiveC4"
url = "https://maven.theillusivec4.top"
}
}

dependencies {
minecraft neoforge.neoforge.get()
compileOnly project(":Common")
Expand All @@ -24,6 +31,8 @@ dependencies {

implementation fg.deobf(neoforge.curios.get())

implementation fg.deobf(neoforge.caelus.get())

compileOnly fg.deobf(neoforge.cameraoverhaul.get())
// NOT UPDATED YET!
// runtimeOnly fg.deobf(neoforge.cameraoverhaul.get())
Expand Down
4 changes: 4 additions & 0 deletions NeoForge/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ neoforge = "1.20.1-47.1.104"

curios = "5266541"

caelus = "3.2.0+1.20.1"

cameraoverhaul = "4057605"

[libraries]
neoforge = { module = "net.neoforged:forge", version.ref = "neoforge" }

curios = { module = "curse.maven:curios-309927", version.ref = "curios" }

caelus = { module = "top.theillusivec4.caelus:caelus-forge", version.ref = "caelus" }

cameraoverhaul = { module = "curse.maven:camera-overhaul-forge-443034", version.ref = "cameraoverhaul" }

[plugins]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,50 @@
import dev.cammiescorner.icarus.client.IcarusClient;
import dev.cammiescorner.icarus.util.IcarusHelper;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import top.theillusivec4.caelus.api.CaelusApi;

import java.util.UUID;

@Mod.EventBusSubscriber(modid = Icarus.MODID)
public class EventHandler {

public static final UUID WINGS_FLIGHT_MODIFIER_ID = UUID.fromString("4b6eac76-f013-4382-8b22-5d43bc37939c");
public static final AttributeModifier WINGS_FLIGHT = new AttributeModifier(WINGS_FLIGHT_MODIFIER_ID, "icarus_wings", 1.0D, AttributeModifier.Operation.ADDITION);

@SuppressWarnings("UnreachableCode")
@SubscribeEvent
public static void onPlayerTick(TickEvent.PlayerTickEvent event) {
if(event.phase == TickEvent.Phase.START) {
if(event.side.isServer()) {
IcarusHelper.onPlayerTick(event.player);
var attributeInstance = event.player.getAttribute(CaelusApi.getInstance().getFlightAttribute());

if(attributeInstance != null) {
if (attributeInstance.hasModifier(WINGS_FLIGHT)) {
if(event.player.isFallFlying()) {
if (!IcarusHelper.onFallFlyingTick(event.player, IcarusHelper.getEquippedWings.apply(event.player), true)) {
attributeInstance.removeModifier(WINGS_FLIGHT);
}
}
else {
if(!IcarusHelper.hasWings.test(event.player)) {
attributeInstance.removeModifier(WINGS_FLIGHT);
}
}
}
else {
if (IcarusHelper.hasWings.test(event.player)) {
attributeInstance.addTransientModifier(WINGS_FLIGHT);
}
}
}
else {

if (event.side.isServer()) {
IcarusHelper.onPlayerTick(event.player);
} else {
IcarusClient.onPlayerTick(event.player);
}
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions NeoForge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ config = "${mod_id}.neoforge.mixins.json"
{ modId = "forge", mandatory = true, versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { ignore = true } },
{ modId = "minecraft", mandatory = true, versionRange = "[${minecraft_version}]", ordering = "NONE", side = "BOTH" },
{ modId = "curios", mandatory = true, versionRange = "[5.8.0,)", ordering = "NONE", side = "BOTH", mc-publish = { curseforge = "309927", modrinth = "vvuO3ImH" } },
{ modId = "caelus", mandatory = true, versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { curseforge = "308989", modrinth = "40FYwb4z" } },
{ modId = "resourcefulconfig", mandatory = true, versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { curseforge = "714059", modrinth = "M1953qlQ" } },
{ modId = "commonnetworking", mandatory = true, versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { curseforge = "806044", modrinth = "HIuqnQpi" } }
]
Expand Down
3 changes: 0 additions & 3 deletions NeoForge/src/main/resources/icarus.neoforge.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
"refmap": "${mod_id}.refmap.json",
"compatibilityLevel": "JAVA_17",
"mixins": [
"LivingEntityMixin",
"PlayerMixin",
"WingItemMixin"
],
"injectors": {
"defaultRequire": 1
},
"client": [
"client.LocalPlayerMixin"
]
}

0 comments on commit f47b436

Please sign in to comment.