Skip to content

Commit

Permalink
Backport to 1.18.2 for Create 0.5.1 using FlightLib
Browse files Browse the repository at this point in the history
  • Loading branch information
PssbleTrngle committed Jun 1, 2023
1 parent 793b7a5 commit 644a122
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Analyze
on:
push:
branches: [1.19.x]
branches: [1.18.x]

jobs:
build:
Expand Down
50 changes: 12 additions & 38 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,51 +75,15 @@ minecraft {
runs {
create("client") {
workingDirectory(project.file("run"))

property("forge.logging.console.level", "debug")

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

mods {
create(mod_id) {
source(sourceSets.main.get())
}
}
}

create("server") {
workingDirectory(project.file("run/server"))

property("forge.logging.console.level", "debug")

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

mods {
create(mod_id) {
source(sourceSets.main.get())
}
}
}

create("data") {
workingDirectory(project.file("run"))

property("forge.logging.console.level", "debug")

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

args(
"--mod",
mod_id,
Expand All @@ -129,8 +93,18 @@ minecraft {
"--existing",
file("src/main/resources")
)
}

forEach {
it.property("forge.logging.console.level", "debug")

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")

mods {
it.mods {
create(mod_id) {
source(sourceSets.main.get())
}
Expand Down Expand Up @@ -201,7 +175,7 @@ dependencies {
implementation(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}"))

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

// Only here to test jetpack+elytra combination behaviour
runtimeOnly(fg.deobf("top.theillusivec4.caelus:caelus-forge:${caelus_version}"))
Expand Down
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ kotlin.code.style=official
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mc_version=1.19.2
mc_version=1.18.2
mappings_channel=official
forge_version=43.2.3
forge_version=40.2.4

mod_id=create_jetpack
mod_version=0.0.0-dev
release_type=release
mod_name=Create Jetpack
mod_author=possible_triangle

jei_version=11.6.0.1015
flywheel_version=0.6.8-13
jei_version=9.7.0.209
flywheel_version=0.6.8.a-99
create_version=4547147
registrate_version=MC1.19-1.1.5
flightlib_version=1.0.4
registrate_version=MC1.18.2-1.1.3
flightlib_version=0.1.0

curios_version=1.19.2-5.1.4.1
caelus_version=1.19.2-3.0.0.6
elytra_slot_version=4519258
curios_version=1.18.2-5.0.9.0
caelus_version=1.18.1-3.0.0.2
elytra_slot_version=3601975

repository=pssbletrngle/createjetpack
modrinth_project_id=UbFnAd4l
Expand Down
10 changes: 2 additions & 8 deletions src/main/kotlin/com/possible_triangle/create_jetpack/Content.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import com.simibubi.create.foundation.item.TooltipModifier
import com.tterrag.registrate.builders.BlockEntityBuilder
import com.tterrag.registrate.util.entry.ItemEntry
import com.tterrag.registrate.util.nullness.NonNullFunction
import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.RenderType
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
import net.minecraft.resources.ResourceLocation
Expand All @@ -36,11 +35,11 @@ import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction
import net.minecraft.world.level.storage.loot.predicates.ExplosionCondition
import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue
import net.minecraftforge.client.event.EntityRenderersEvent
import net.minecraftforge.common.capabilities.ICapabilityProvider
import net.minecraftforge.event.AttachCapabilitiesEvent
import net.minecraftforge.eventbus.api.IEventBus
import net.minecraftforge.fml.config.ModConfig
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
import thedarkcolour.kotlinforforge.forge.FORGE_BUS
import thedarkcolour.kotlinforforge.forge.LOADING_CONTEXT
import java.util.function.BiConsumer
Expand Down Expand Up @@ -127,12 +126,7 @@ object Content {

Configs.Network.register()

modBus.addListener { _: EntityRenderersEvent.AddLayers ->
val dispatcher = Minecraft.getInstance().entityRenderDispatcher
//JetpackArmorLayer.registerOnAll(dispatcher)
}

modBus.addListener(ControlsDisplay::register)
modBus.addListener { _: FMLClientSetupEvent -> ControlsDisplay.register() }

FORGE_BUS.addListener(Configs::syncConfig)
FORGE_BUS.addGenericListener(ItemStack::class.java) { event: AttachCapabilitiesEvent<ItemStack> ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ import com.possible_triangle.flightlib.api.IJetpack
import com.simibubi.create.content.equipment.armor.BacktankUtil
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiComponent
import net.minecraft.network.chat.Component
import net.minecraft.network.chat.TranslatableComponent
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.phys.Vec2
import net.minecraftforge.client.event.RegisterGuiOverlaysEvent
import net.minecraftforge.client.gui.overlay.ForgeGui
import net.minecraftforge.client.gui.overlay.IGuiOverlay
import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay
import net.minecraftforge.client.gui.ForgeIngameGui
import net.minecraftforge.client.gui.IIngameOverlay
import net.minecraftforge.client.gui.OverlayRegistry
import kotlin.math.ceil


object ControlsDisplay : IGuiOverlay {
object ControlsDisplay : IIngameOverlay {

private val controls = ResourceLocation(MOD_ID, "textures/gui/controls.png")
private val airIndicator = ResourceLocation(MOD_ID, "textures/gui/air_indicator.png")
Expand All @@ -38,11 +37,11 @@ object ControlsDisplay : IGuiOverlay {
FlightKey.TOGGLE_HOVER to { it.jetpack.hoverType(it) },
)

fun register(event: RegisterGuiOverlaysEvent) {
event.registerAbove(VanillaGuiOverlay.HOTBAR.id(), "jetpack_controls", this)
fun register() {
OverlayRegistry.registerOverlayAbove(ForgeIngameGui.HOTBAR_ELEMENT, "jetpack_controls", this)
}

override fun render(gui: ForgeGui, poseStack: PoseStack, partialTick: Float, width: Int, height: Int) {
override fun render(gui: ForgeIngameGui, poseStack: PoseStack, partialTick: Float, width: Int, height: Int) {
val mc = Minecraft.getInstance()
if (!Configs.CLIENT.SHOW_OVERLAY.get()) return
if (mc.options.hideGui) return
Expand Down Expand Up @@ -83,7 +82,7 @@ object ControlsDisplay : IGuiOverlay {
val textScale = 0.5F
poseStack.scale(textScale, textScale, textScale)
val textMargin = (startX + 8 + spriteWidth * index) * (1 / textScale)
val text = Component.translatable("overlay.flightlib.control.${key.name.lowercase()}")
val text = TranslatableComponent("overlay.flightlib.control.${key.name.lowercase()}")
val color = if (active) 0xFFFFFF else 0xBBBBBB
GuiComponent.drawCenteredString(
poseStack, gui.font, text, textMargin.toInt(), startY * 2 + 36, color
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[43,)"
loaderVersion = "[40,)"
license = "https://github.com/${repository}/blob/1.19.x/LICENSE.txt"
issueTrackerURL = "https://github.com/${repository}/issues"

Expand All @@ -13,14 +13,14 @@ description = '''Upgrade your backtank and utilize the pressurized air to fly'''
[[dependencies.${mod_id}]]
modId = "forge"
mandatory = true
versionRange = "[43,)"
versionRange = "[40,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.${mod_id}]]
modId = "minecraft"
mandatory = true
versionRange = "[1.19.2,)"
versionRange = "[1.18.2,)"
ordering = "NONE"
side = "BOTH"

Expand Down

0 comments on commit 644a122

Please sign in to comment.