Skip to content

Commit

Permalink
backport curio slot config & create 0.5.1.c support
Browse files Browse the repository at this point in the history
  • Loading branch information
PssbleTrngle committed Jul 8, 2023
1 parent 644a122 commit 1fe316d
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 82 deletions.
11 changes: 1 addition & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import com.modrinth.minotaur.TaskModrinthSyncBody
import net.darkhax.curseforgegradle.TaskPublishCurseForge
import org.spongepowered.asm.gradle.plugins.MixinExtension
import java.time.LocalDateTime

val mod_id: String by extra
Expand Down Expand Up @@ -50,11 +49,6 @@ apply(plugin = "net.minecraftforge.gradle")
apply(plugin = "kotlin")
apply(plugin = "org.spongepowered.mixin")

configure<MixinExtension> {
add(sourceSets.main.get(), "${mod_id}.refmap.json")
config("${mod_id}.mixins.json")
}

val artifactGroup = "com.possible_triangle"
base {
archivesName.set("$mod_id-$mod_version")
Expand All @@ -70,7 +64,6 @@ java {

minecraft {
mappings(mappings_channel, mc_version)
accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg"))

runs {
create("client") {
Expand Down Expand Up @@ -100,7 +93,6 @@ minecraft {

it.arg("-mixin.config=create.mixins.json")
it.arg("-mixin.config=flywheel.mixins.json")
it.arg("-mixin.config=${mod_id}.mixins.json")
it.property("mixin.env.remapRefMap", "true")
it.property("mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg")

Expand Down Expand Up @@ -172,12 +164,12 @@ dependencies {
implementation(fg.deobf("curse.maven:create-328085:${create_version}"))
implementation(fg.deobf("com.jozufozu.flywheel:flywheel-forge-${mc_version}:${flywheel_version}"))

implementation(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}"))

if (!isCI) {
runtimeOnly(fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}"))

// Only here to test jetpack+elytra combination behaviour
runtimeOnly(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}"))
runtimeOnly(fg.deobf("top.theillusivec4.caelus:caelus-forge:${caelus_version}"))
runtimeOnly(fg.deobf("curse.maven:elytra-slot-317716:${elytra_slot_version}"))
}
Expand Down Expand Up @@ -207,7 +199,6 @@ tasks.withType<Jar> {
"Implementation-Version" to mod_version,
"Implementation-Vendor" to "examplemodsareus",
"Implementation-Timestamp" to LocalDateTime.now().toString(),
"MixinConfigs" to "${mod_id}.mixins.json",
)
)
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ mod_name=Create Jetpack
mod_author=possible_triangle

jei_version=9.7.0.209
flywheel_version=0.6.8.a-99
create_version=4547147
flywheel_version=0.6.9-101
create_version=4625533
registrate_version=MC1.18.2-1.1.3
flightlib_version=0.1.0

Expand Down
Empty file.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiComponent
import net.minecraft.network.chat.TranslatableComponent
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.ItemStack
import net.minecraft.world.phys.Vec2
import net.minecraftforge.client.gui.ForgeIngameGui
import net.minecraftforge.client.gui.IIngameOverlay
Expand Down Expand Up @@ -114,7 +115,7 @@ object ControlsDisplay : IIngameOverlay {
}

val blink = player.level.gameTime % 20 < 5
val airSource = BacktankUtil.get(player)
val airSource = BacktankUtil.getAllWithAir(player).firstOrNull() ?: ItemStack.EMPTY
val maxAir = BacktankUtil.maxAir(airSource)
val air = BacktankUtil.getAir(airSource)
val barHeight = ceil(air / maxAir * 14).toInt()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface IServerConfig {
val swimModifier: Double
val elytraBoostEnabled: Boolean
fun isAllowed(ench: Enchantment): Boolean
val curioSlots: Collection<String>
}

data class SyncedConfig(
Expand All @@ -26,6 +27,7 @@ data class SyncedConfig(
override val hoverSpeed: Double,
override val swimModifier: Double,
override val elytraBoostEnabled: Boolean,
override val curioSlots: Collection<String>,
) : IServerConfig {
override fun isAllowed(ench: Enchantment) = true
}
Expand Down Expand Up @@ -64,4 +66,7 @@ class ServerConfig(builder: ForgeConfigSpec.Builder) : IServerConfig {
val contained = enchantmentsList.get().map(::ResourceLocation).any { key == it }
return contained != enchantmentsIsBlacklist.get()
}

private val curiosSlotList = builder.defineList("curios.allowed_slots", listOf("back")) { true }
override val curioSlots: List<String> get() = curiosSlotList.get()
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class SyncConfigMessage (private val config: IServerConfig) {
hoverSpeed = buf.readDouble(),
swimModifier = buf.readDouble(),
elytraBoostEnabled = buf.readBoolean(),
curioSlots = buf.readList(FriendlyByteBuf::readUtf)
)
return SyncConfigMessage(config)
}
Expand All @@ -34,6 +35,7 @@ class SyncConfigMessage (private val config: IServerConfig) {
buf.writeDouble(config.hoverSpeed)
buf.writeDouble(config.swimModifier)
buf.writeBoolean(config.elytraBoostEnabled)
buf.writeCollection(config.curioSlots, FriendlyByteBuf::writeUtf)
}

fun handle(context: Supplier<Context>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,14 @@ class BrassJetpack(properties: Properties, blockItem: ItemEntry<BacktankBlockIte
override fun isValid(context: Context): Boolean {
return when (val source = context.source) {
is EquipmentSource -> source.slot == EquipmentSlot.CHEST
is CuriosSource -> source.slot == "back"
is CuriosSource -> Configs.SERVER.curioSlots.contains(source.slot)
else -> false
}
}

override fun isUsable(context: Context): Boolean {
val tank = BacktankUtil.get(context.entity)
if (tank.isEmpty) return false
val tank = BacktankUtil.getAllWithAir(context.entity).firstOrNull() ?: return false
val air = BacktankUtil.getAir(tank)
if (air <= 0F) return false
val cost = BacktankUtil.maxAirWithoutEnchants().toFloat() / usesPerTank(context)
return air >= cost
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/META-INF/accesstransformer.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ side = "BOTH"
[[dependencies.${mod_id}]]
modId = "create"
mandatory = true
versionRange = "[0.5.1.a,)"
versionRange = "[0.5.1.c,)"
ordering = "NONE"
side = "BOTH"
13 changes: 0 additions & 13 deletions src/main/resources/create_jetpack.mixins.json

This file was deleted.

0 comments on commit 1fe316d

Please sign in to comment.