Androids don't need to breathe oxygen
This commit is contained in:
parent
312795df93
commit
594e6c9fbf
@ -185,6 +185,7 @@ dependencies {
|
|||||||
val deps_mc_version: String by project
|
val deps_mc_version: String by project
|
||||||
val jei_mc_version: String by project
|
val jei_mc_version: String by project
|
||||||
val curios_mc_version: String by project
|
val curios_mc_version: String by project
|
||||||
|
val ad_astra_id: String by project
|
||||||
|
|
||||||
implementation(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_mc_version}-${curios_version}"))
|
implementation(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_mc_version}-${curios_version}"))
|
||||||
implementation(fg.deobf("curse.maven:cosmetic-armor-reworked-237307:$cosmetic_armor_reworked_id"))
|
implementation(fg.deobf("curse.maven:cosmetic-armor-reworked-237307:$cosmetic_armor_reworked_id"))
|
||||||
@ -196,6 +197,11 @@ dependencies {
|
|||||||
runtimeOnly(fg.deobf("curse.maven:jade-324717:${jade_id}"))
|
runtimeOnly(fg.deobf("curse.maven:jade-324717:${jade_id}"))
|
||||||
runtimeOnly(fg.deobf("curse.maven:configured-457570:${configured_id}"))
|
runtimeOnly(fg.deobf("curse.maven:configured-457570:${configured_id}"))
|
||||||
|
|
||||||
|
implementation(fg.deobf("curse.maven:ad-astra-635042:${ad_astra_id}"))
|
||||||
|
implementation(fg.deobf("curse.maven:resourceful-lib-570073:4378849"))
|
||||||
|
implementation(fg.deobf("curse.maven:resourceful-config-714059:4394154"))
|
||||||
|
implementation(fg.deobf("curse.maven:botarium-704113:4416456"))
|
||||||
|
|
||||||
// runtimeOnly(fg.deobf("curse.maven:worldedit-225608:${worldedit_fileid}"))
|
// runtimeOnly(fg.deobf("curse.maven:worldedit-225608:${worldedit_fileid}"))
|
||||||
// runtimeOnly(fg.deobf("at.ridgo8.moreoverlays:MoreOverlays-updated:${more_overlays_version}"))
|
// runtimeOnly(fg.deobf("at.ridgo8.moreoverlays:MoreOverlays-updated:${more_overlays_version}"))
|
||||||
|
|
||||||
@ -256,8 +262,6 @@ minecraft {
|
|||||||
} else {
|
} else {
|
||||||
args("--username", "Dev_${System.getProperty("user.name")}")
|
args("--username", "Dev_${System.getProperty("user.name")}")
|
||||||
}
|
}
|
||||||
|
|
||||||
args("-mixin.config=$mod_id.mixins.json")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create("server") {
|
create("server") {
|
||||||
@ -267,7 +271,7 @@ minecraft {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
args("nogui", "-mixin.config=$mod_id.mixins.json")
|
args("nogui")
|
||||||
}
|
}
|
||||||
|
|
||||||
create("data") {
|
create("data") {
|
||||||
@ -287,6 +291,7 @@ minecraft {
|
|||||||
mixin {
|
mixin {
|
||||||
add(sourceSets.main.get(), "$mod_id.refmap.json")
|
add(sourceSets.main.get(), "$mod_id.refmap.json")
|
||||||
config("$mod_id.mixins.json")
|
config("$mod_id.mixins.json")
|
||||||
|
config("$mod_id.ad_astra.mixins.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft.runs.all {
|
minecraft.runs.all {
|
||||||
|
@ -29,6 +29,7 @@ jupiter_version=5.8.2
|
|||||||
mekanism_version=10.3.5.homebaked
|
mekanism_version=10.3.5.homebaked
|
||||||
curios_version=5.1.4.0
|
curios_version=5.1.4.0
|
||||||
cosmetic_armor_reworked_id=4145717
|
cosmetic_armor_reworked_id=4145717
|
||||||
|
ad_astra_id=4390126
|
||||||
jade_id=4330163
|
jade_id=4330163
|
||||||
configured_id=4166861
|
configured_id=4166861
|
||||||
worldedit_fileid=3922622
|
worldedit_fileid=3922622
|
||||||
|
@ -33,12 +33,14 @@ import ru.dbotthepony.mc.otm.client.model.TritaniumArmorModel;
|
|||||||
import ru.dbotthepony.mc.otm.client.render.ShockwaveRenderer;
|
import ru.dbotthepony.mc.otm.client.render.ShockwaveRenderer;
|
||||||
import ru.dbotthepony.mc.otm.client.render.blockentity.BatteryBankRenderer;
|
import ru.dbotthepony.mc.otm.client.render.blockentity.BatteryBankRenderer;
|
||||||
import ru.dbotthepony.mc.otm.client.render.blockentity.MatterBatteryBankRenderer;
|
import ru.dbotthepony.mc.otm.client.render.blockentity.MatterBatteryBankRenderer;
|
||||||
|
import ru.dbotthepony.mc.otm.compat.adastra.AdAstraCompatKt;
|
||||||
import ru.dbotthepony.mc.otm.compat.mekanism.QIOKt;
|
import ru.dbotthepony.mc.otm.compat.mekanism.QIOKt;
|
||||||
import ru.dbotthepony.mc.otm.compat.mekanism.TooltipsKt;
|
import ru.dbotthepony.mc.otm.compat.mekanism.TooltipsKt;
|
||||||
import ru.dbotthepony.mc.otm.config.AndroidConfig;
|
import ru.dbotthepony.mc.otm.config.AndroidConfig;
|
||||||
import ru.dbotthepony.mc.otm.config.ClientConfig;
|
import ru.dbotthepony.mc.otm.config.ClientConfig;
|
||||||
import ru.dbotthepony.mc.otm.config.ItemsConfig;
|
import ru.dbotthepony.mc.otm.config.ItemsConfig;
|
||||||
import ru.dbotthepony.mc.otm.config.MachinesConfig;
|
import ru.dbotthepony.mc.otm.config.MachinesConfig;
|
||||||
|
import ru.dbotthepony.mc.otm.config.ServerCompatConfig;
|
||||||
import ru.dbotthepony.mc.otm.config.ServerConfig;
|
import ru.dbotthepony.mc.otm.config.ServerConfig;
|
||||||
import ru.dbotthepony.mc.otm.config.ToolsConfig;
|
import ru.dbotthepony.mc.otm.config.ToolsConfig;
|
||||||
import ru.dbotthepony.mc.otm.core.math.Decimal;
|
import ru.dbotthepony.mc.otm.core.math.Decimal;
|
||||||
@ -130,6 +132,7 @@ public final class OverdriveThatMatters {
|
|||||||
|
|
||||||
ClientConfig.INSTANCE.register();
|
ClientConfig.INSTANCE.register();
|
||||||
ServerConfig.INSTANCE.register();
|
ServerConfig.INSTANCE.register();
|
||||||
|
ServerCompatConfig.INSTANCE.register();
|
||||||
AndroidConfig.INSTANCE.register();
|
AndroidConfig.INSTANCE.register();
|
||||||
ItemsConfig.INSTANCE.register();
|
ItemsConfig.INSTANCE.register();
|
||||||
MachinesConfig.INSTANCE.register();
|
MachinesConfig.INSTANCE.register();
|
||||||
@ -195,6 +198,10 @@ public final class OverdriveThatMatters {
|
|||||||
if (ModList.get().isLoaded("mekanism")) {
|
if (ModList.get().isLoaded("mekanism")) {
|
||||||
EVENT_BUS.addGenericListener(BlockEntity.class, EventPriority.NORMAL, QIOKt::attachCapabilities);
|
EVENT_BUS.addGenericListener(BlockEntity.class, EventPriority.NORMAL, QIOKt::attachCapabilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AdAstraCompatKt.isAdAstraLoaded()) {
|
||||||
|
EVENT_BUS.addListener(EventPriority.NORMAL, AdAstraCompatKt::onDamageEvent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupClient(final FMLClientSetupEvent event) {
|
private void setupClient(final FMLClientSetupEvent event) {
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.mixin.compat.ad_astra;
|
||||||
|
|
||||||
|
import earth.terrarium.ad_astra.common.entity.system.EntityOxygenSystem;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import ru.dbotthepony.mc.otm.capability.MatteryCapability;
|
||||||
|
import ru.dbotthepony.mc.otm.config.ServerCompatConfig;
|
||||||
|
|
||||||
|
@Mixin(EntityOxygenSystem.class)
|
||||||
|
public class EntityOxygenSystemMixin {
|
||||||
|
@Inject(
|
||||||
|
method = "oxygenTick()V",
|
||||||
|
at = @At("HEAD"),
|
||||||
|
cancellable = true,
|
||||||
|
remap = false
|
||||||
|
)
|
||||||
|
private static void oxygenTick(LivingEntity entity, ServerLevel level, CallbackInfo hook) {
|
||||||
|
if (entity instanceof Player && ServerCompatConfig.AdAstra.INSTANCE.getANDROIDS_DO_NOT_NEED_OXYGEN()) {
|
||||||
|
entity.getCapability(MatteryCapability.MATTERY_PLAYER).ifPresent(it -> {
|
||||||
|
if (it.isAndroid()) {
|
||||||
|
hook.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.mixin.compat.ad_astra;
|
||||||
|
|
||||||
|
import earth.terrarium.ad_astra.common.util.OxygenUtils;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
import ru.dbotthepony.mc.otm.capability.MatteryCapability;
|
||||||
|
import ru.dbotthepony.mc.otm.config.ServerCompatConfig;
|
||||||
|
|
||||||
|
@Mixin(OxygenUtils.class)
|
||||||
|
public class OxygenUtilsMixin {
|
||||||
|
@Inject(
|
||||||
|
method = "entityHasOxygen()Z",
|
||||||
|
at = @At("HEAD"),
|
||||||
|
cancellable = true,
|
||||||
|
remap = false
|
||||||
|
)
|
||||||
|
private static void entityHasOxygen(Level level, LivingEntity entity, CallbackInfoReturnable<Boolean> hook) {
|
||||||
|
if (entity instanceof Player && ServerCompatConfig.AdAstra.INSTANCE.getANDROIDS_DO_NOT_NEED_OXYGEN()) {
|
||||||
|
entity.getCapability(MatteryCapability.MATTERY_PLAYER).ifPresent(it -> {
|
||||||
|
if (it.isAndroid()) {
|
||||||
|
hook.setReturnValue(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.compat.adastra
|
||||||
|
|
||||||
|
import earth.terrarium.ad_astra.AdAstra
|
||||||
|
import earth.terrarium.ad_astra.common.registry.ModDamageSource
|
||||||
|
import net.minecraft.world.entity.player.Player
|
||||||
|
import net.minecraftforge.event.entity.living.LivingHurtEvent
|
||||||
|
import net.minecraftforge.fml.ModList
|
||||||
|
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||||
|
import ru.dbotthepony.mc.otm.config.ServerCompatConfig
|
||||||
|
|
||||||
|
val isAdAstraLoaded by lazy {
|
||||||
|
ModList.get().isLoaded(AdAstra.MOD_ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// для надёжности
|
||||||
|
fun onDamageEvent(event: LivingHurtEvent) {
|
||||||
|
check(isAdAstraLoaded) { "Ad Astra is not loaded!" }
|
||||||
|
val ply = event.entity as? Player ?: return
|
||||||
|
|
||||||
|
if (ServerCompatConfig.AdAstra.ANDROIDS_DO_NOT_NEED_OXYGEN) {
|
||||||
|
if (ply.matteryPlayer?.isAndroid != true) return
|
||||||
|
|
||||||
|
if (event.source === ModDamageSource.OXYGEN) {
|
||||||
|
event.amount = 0f
|
||||||
|
event.isCanceled = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.config
|
||||||
|
|
||||||
|
object ServerCompatConfig : AbstractConfig("compat-server") {
|
||||||
|
object AdAstra {
|
||||||
|
init {
|
||||||
|
builder.push("AD_ASTRA")
|
||||||
|
}
|
||||||
|
|
||||||
|
val ANDROIDS_DO_NOT_NEED_OXYGEN: Boolean by builder
|
||||||
|
.comment("Android do not need oxygen in space")
|
||||||
|
.define("ANDROIDS_DO_NOT_NEED_OXYGEN", true)
|
||||||
|
|
||||||
|
init {
|
||||||
|
builder.pop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
AdAstra
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
{
|
||||||
|
"required": false,
|
||||||
|
"package": "ru.dbotthepony.mc.otm.mixin.compat.ad_astra",
|
||||||
|
"compatibilityLevel": "JAVA_17",
|
||||||
|
"minVersion": "0.8",
|
||||||
|
"refmap": "overdrive_that_matters.refmap.json",
|
||||||
|
"mixins": [
|
||||||
|
"EntityOxygenSystemMixin",
|
||||||
|
"OxygenUtilsMixin"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user