Skip to content

Commit

Permalink
merge 1.19.x
Browse files Browse the repository at this point in the history
  • Loading branch information
PssbleTrngle committed Feb 27, 2024
2 parents f8eaf84 + 805ed69 commit bfde10d
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 11 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ withKotlin()

fabric {
dataGen()
enableMixins()
includesMod("com.possible-triangle:flightlib-fabric:${flightlib_version}")
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jei_version=15.2.0.27
emi_version=1.0.19+1.20.1
create_version=0.5.1-d-build.1161+mc1.20.1
night_config_version=3.6.7
flightlib_version=2.0.3
flightlib_version=2.1.0
kotlin_fabric_version=1.9.6+kotlin.1.8.22
trinkets_version=3.7.1
cca_version=5.2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.possible_triangle.create_jetpack.mixin;

import com.simibubi.create.content.equipment.armor.NetheriteDivingHandler;
import com.tterrag.registrate.util.entry.ItemEntry;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterials;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.Slice;

@Mixin(NetheriteDivingHandler.class)
public class NetheriteDivingHandlerMixin {

@Redirect(
method = "onLivingEquipmentChange(Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/entity/EquipmentSlot;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemStack;)V",
at = @At(
value = "INVOKE",
target = "Lcom/tterrag/registrate/util/entry/ItemEntry;isIn(Lnet/minecraft/world/item/ItemStack;)Z"
),
slice = @Slice(
from = @At(
value = "FIELD",
target = "Lnet/minecraft/world/entity/EquipmentSlot;CHEST:Lnet/minecraft/world/entity/EquipmentSlot;"
),
to = @At("TAIL")
)
)
private static boolean modifyNetheritePredicate(ItemEntry instance, ItemStack stack) {
return stack.getItem() instanceof ArmorItem armor && armor.getMaterial() == ArmorMaterials.NETHERITE;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface IServerConfig {
val acceleration: Double
val hoverSpeed: Double
val swimModifier: Double
val elytraBoostEnabled: Boolean
val elytraBoost: Double
}

data class SyncedConfig(
Expand All @@ -21,7 +21,7 @@ data class SyncedConfig(
override val acceleration: Double,
override val hoverSpeed: Double,
override val swimModifier: Double,
override val elytraBoostEnabled: Boolean,
override val elytraBoost: Double,
) : IServerConfig

class ServerConfig(builder: ForgeConfigSpec.Builder) : IServerConfig {
Expand All @@ -48,7 +48,7 @@ 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 elytraBoostValue = builder.defineInRange("features.elytra_boost", 1.25, 1.0, 100.0)
override val elytraBoost get() = elytraBoostValue.get()!!

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SyncConfigMessage(private val config: IServerConfig) {
acceleration = buf.readDouble(),
hoverSpeed = buf.readDouble(),
swimModifier = buf.readDouble(),
elytraBoostEnabled = buf.readBoolean(),
elytraBoost = buf.readDouble(),
)
return SyncConfigMessage(config)
}
Expand All @@ -30,7 +30,7 @@ class SyncConfigMessage(private val config: IServerConfig) {
buf.writeDouble(config.acceleration)
buf.writeDouble(config.hoverSpeed)
buf.writeDouble(config.swimModifier)
buf.writeBoolean(config.elytraBoostEnabled)
buf.writeDouble(config.elytraBoost)
}

fun handle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import com.possible_triangle.create_jetpack.config.Configs
import com.possible_triangle.flightlib.api.ControlType
import com.possible_triangle.flightlib.api.IJetpack
import com.possible_triangle.flightlib.api.IJetpack.Context
import com.possible_triangle.flightlib.api.sources.CuriosSource
import com.possible_triangle.flightlib.api.sources.EquipmentSource
import com.possible_triangle.flightlib.api.sources.TrinketsSource
import com.simibubi.create.content.equipment.armor.BacktankItem
import com.simibubi.create.content.equipment.armor.BacktankUtil
import com.simibubi.create.foundation.item.LayeredArmorItem
Expand Down Expand Up @@ -62,8 +62,8 @@ open class JetpackItem(
return Configs.SERVER.swimModifier
}

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

private val thrusters = listOf(-0.35, 0.35).map { offset ->
Expand All @@ -84,7 +84,7 @@ open class JetpackItem(
override fun isValid(context: Context): Boolean {
return when (val source = context.source) {
is EquipmentSource -> source.slot == EquipmentSlot.CHEST
is CuriosSource -> true
is TrinketsSource -> true
else -> false
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/main/resources/create_jetpack.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"required": true,
"minVersion": "0.8",
"package": "com.possible_triangle.create_jetpack.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "${mod_id}.refmap.json",
"mixins": ["NetheriteDivingHandlerMixin"],
"injectors": {
"defaultRequire": 1
}
}
3 changes: 3 additions & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"com.possible_triangle.create_jetpack.CreateJetpackMod"
]
},
"mixins": [
"${mod_id}.mixins.json"
],
"depends": {
"fabricloader": ">=0.14",
"fabric": "*",
Expand Down

0 comments on commit bfde10d

Please sign in to comment.