Skip to content

Commit

Permalink
update flight lib & add elytra boost option
Browse files Browse the repository at this point in the history
  • Loading branch information
PssbleTrngle committed May 19, 2023
1 parent 588637c commit 112aa15
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
CHANGELOG: ${{ github.event.release.body }}
CI: true

- name: Upload to github releases
if: ${{ github.event_name == 'release' }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.MAVEN_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
CI: true
14 changes: 10 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ val release_type: String by extra
val modrinth_project_id: String by extra
val curseforge_project_id: String by extra
val curios_version: String by extra
val caelus_version: String by extra
val elytra_slot_version: String by extra

val localEnv = file(".env").takeIf { it.exists() }?.readLines()?.associate {
val (key, value) = it.split("=")
key to value
} ?: emptyMap()
} ?: emptyMap()

val env = System.getenv() + localEnv
val isCI = env["CI"] == "true"

buildscript {
dependencies {
Expand Down Expand Up @@ -192,10 +195,13 @@ dependencies {
implementation(fg.deobf("curse.maven:create-328085:${create_version}"))
implementation(fg.deobf("com.jozufozu.flywheel:flywheel-forge-${mc_version}:${flywheel_version}"))

// Only here to test jetpack+elytra combination behaviour
implementation(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}"))
//runtimeOnly fg.deobf("top.theillusivec4.caelus:caelus-forge:1.18.1-3.0.0.2")
//runtimeOnly fg.deobf("curse.maven:elytra-slot-317716:3601975")

if (!isCI) {
// Only here to test jetpack+elytra combination behaviour
runtimeOnly(fg.deobf("top.theillusivec4.caelus:caelus-forge:${caelus_version}"))
runtimeOnly(fg.deobf("curse.maven:elytra-slot-317716:${elytra_slot_version}"))
}

compileOnly(fg.deobf("com.possible_triangle:flightlib-api:${flightlib_version}"))
compileOnly(fg.deobf("com.possible_triangle:flightlib-forge-api:${flightlib_version}"))
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ jei_version=
flywheel_version=0.6.8-13
create_version=4371809
registrate_version=MC1.19-1.1.5
flightlib_version=1.0.1
flightlib_version=1.0.3

curios_version=1.19.2-5.1.4.1
caelus_version=1.19.2-3.0.0.6
elytra_slot_version=4519258

repository=pssbletrngle/createjetpack
modrinth_project_id=UbFnAd4l
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.possible_triangle.create_jetpack.config

import net.minecraft.core.Registry
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.enchantment.Enchantment
import net.minecraftforge.common.ForgeConfigSpec
import net.minecraftforge.registries.ForgeRegistries

interface IServerConfig {
val usesPerTank: Int
Expand All @@ -13,6 +13,7 @@ interface IServerConfig {
val acceleration: Double
val hoverSpeed: Double
val swimModifier: Double
val elytraBoostEnabled: Boolean
fun isAllowed(ench: Enchantment): Boolean
}

Expand All @@ -24,6 +25,7 @@ data class SyncedConfig(
override val acceleration: Double,
override val hoverSpeed: Double,
override val swimModifier: Double,
override val elytraBoostEnabled: Boolean,
) : IServerConfig {
override fun isAllowed(ench: Enchantment) = true
}
Expand Down Expand Up @@ -52,10 +54,13 @@ class ServerConfig(builder: ForgeConfigSpec.Builder) : IServerConfig {
private val swimModifierValue = builder.defineInRange("speed.swim_modifier", 1.8, 0.0, 100.0)
override val swimModifier get() = swimModifierValue.get()!!

private val elytraBoostEnabledValue = builder.define("features.elytra_boost", true)
override val elytraBoostEnabled get() = elytraBoostEnabledValue.get()!!

private val enchantmentsList = builder.defineList("enchantments.list", emptyList<String>()) { true }
private val enchantmentsIsBlacklist = builder.define("enchantments.is_blacklist", true)
override fun isAllowed(ench: Enchantment): Boolean {
val key = Registry.ENCHANTMENT.getKey(ench) ?: return true
val key = ForgeRegistries.ENCHANTMENTS.getKey(ench) ?: return true
val contained = enchantmentsList.get().map(::ResourceLocation).any { key == it }
return contained != enchantmentsIsBlacklist.get()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class SyncConfigMessage (private val config: IServerConfig) {
acceleration = buf.readDouble(),
hoverSpeed = buf.readDouble(),
swimModifier = buf.readDouble(),
elytraBoostEnabled = buf.readBoolean(),
)
return SyncConfigMessage(config)
}
Expand All @@ -32,6 +33,7 @@ class SyncConfigMessage (private val config: IServerConfig) {
buf.writeDouble(config.acceleration)
buf.writeDouble(config.hoverSpeed)
buf.writeDouble(config.swimModifier)
buf.writeBoolean(config.elytraBoostEnabled)
}

fun handle(context: Supplier<Context>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class BrassJetpack(properties: Properties, blockItem: ItemEntry<CopperBacktankBl
return Configs.SERVER.swimModifier
}

override fun boostsElytra(): Boolean {
return Configs.SERVER.elytraBoostEnabled
}

private val thrusters = listOf(-0.35, 0.35).map { offset ->
Vec3(offset, 0.7, -0.5)
}
Expand Down

0 comments on commit 112aa15

Please sign in to comment.