mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Merge branch '1.20.1' into 1.20.2
This commit is contained in:
commit
a67935c634
6 changed files with 34 additions and 31 deletions
|
@ -65,7 +65,7 @@ public class UnicopiaClient implements ClientModInitializer {
|
||||||
private ZapAppleStageStore.Stage zapAppleStage = ZapAppleStageStore.Stage.HIBERNATING;
|
private ZapAppleStageStore.Stage zapAppleStage = ZapAppleStageStore.Stage.HIBERNATING;
|
||||||
|
|
||||||
public static Optional<PlayerCamera> getCamera() {
|
public static Optional<PlayerCamera> getCamera() {
|
||||||
return Optional.of(getNullableCamera());
|
return Optional.ofNullable(getNullableCamera());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.minelittlepony.unicopia.compat.ad_astra;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public interface OxygenApi {
|
||||||
|
AtomicReference<OxygenApi> API = new AtomicReference<>((world, pos) -> false);
|
||||||
|
|
||||||
|
boolean hasOxygen(World world, BlockPos pos);
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
package com.minelittlepony.unicopia.compat.ad_astra;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
|
|
||||||
public final class OxygenUtils {
|
|
||||||
public static OxygenApi API = entity -> false;
|
|
||||||
|
|
||||||
public interface OxygenApi {
|
|
||||||
boolean hasOxygen(Entity entity);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,7 +12,7 @@ import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
||||||
import com.minelittlepony.unicopia.advancement.UCriteria;
|
import com.minelittlepony.unicopia.advancement.UCriteria;
|
||||||
import com.minelittlepony.unicopia.client.minelittlepony.MineLPDelegate;
|
import com.minelittlepony.unicopia.client.minelittlepony.MineLPDelegate;
|
||||||
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
||||||
import com.minelittlepony.unicopia.compat.ad_astra.OxygenUtils;
|
import com.minelittlepony.unicopia.compat.ad_astra.OxygenApi;
|
||||||
import com.minelittlepony.unicopia.entity.*;
|
import com.minelittlepony.unicopia.entity.*;
|
||||||
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||||
import com.minelittlepony.unicopia.entity.duck.LivingEntityDuck;
|
import com.minelittlepony.unicopia.entity.duck.LivingEntityDuck;
|
||||||
|
@ -200,7 +200,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
|
|
||||||
if ((RegistryUtils.isIn(entity.getWorld(), dimension, RegistryKeys.DIMENSION_TYPE, UTags.DimensionTypes.HAS_NO_ATMOSPHERE)
|
if ((RegistryUtils.isIn(entity.getWorld(), dimension, RegistryKeys.DIMENSION_TYPE, UTags.DimensionTypes.HAS_NO_ATMOSPHERE)
|
||||||
|| Unicopia.getConfig().dimensionsWithoutAtmosphere.get().contains(RegistryUtils.getId(entity.getWorld(), dimension, RegistryKeys.DIMENSION_TYPE).toString()))
|
|| Unicopia.getConfig().dimensionsWithoutAtmosphere.get().contains(RegistryUtils.getId(entity.getWorld(), dimension, RegistryKeys.DIMENSION_TYPE).toString()))
|
||||||
&& !OxygenUtils.API.hasOxygen(entity)) {
|
&& !OxygenApi.API.get().hasOxygen(entity.getWorld(), entity.getBlockPos())) {
|
||||||
return FlightType.NONE;
|
return FlightType.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,31 @@
|
||||||
package com.minelittlepony.unicopia.mixin.ad_astra;
|
package com.minelittlepony.unicopia.mixin.ad_astra;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Dynamic;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Pseudo;
|
import org.spongepowered.asm.mixin.Pseudo;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Coerce;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.compat.ad_astra.OxygenUtils;
|
import com.minelittlepony.unicopia.compat.ad_astra.OxygenApi;
|
||||||
|
|
||||||
@Pseudo
|
@Pseudo
|
||||||
@Mixin(
|
@Mixin(
|
||||||
targets = { "earth.terrarium.adastra.api.systems.OxygenApi" },
|
targets = { "earth.terrarium.adastra.api.systems.OxygenApi" },
|
||||||
remap = false
|
remap = false
|
||||||
)
|
)
|
||||||
public interface MixinOxygenUtils extends OxygenUtils.OxygenApi {
|
interface MixinOxygenApi extends OxygenApi {
|
||||||
@Accessor("API")
|
}
|
||||||
@Coerce
|
|
||||||
static Object getAPI() {
|
|
||||||
throw new AbstractMethodError("stub");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Dynamic("Compiler-generated class-init() method")
|
@Pseudo
|
||||||
@Inject(method = "<clinit>()V", at = @At("RETURN"), remap = false)
|
@Mixin(
|
||||||
private static void classInit() {
|
targets = { "earth.terrarium.adastra.api.ApiHelper" },
|
||||||
OxygenUtils.API = (OxygenUtils.OxygenApi)getAPI();
|
remap = false
|
||||||
|
)
|
||||||
|
abstract class MixinApiHelper {
|
||||||
|
@Inject(method = "load", at = @At("RETURN"), require = 0)
|
||||||
|
private static <T> void onLoad(Class<T> clazz, CallbackInfoReturnable<T> info) {
|
||||||
|
if (info.getReturnValue() instanceof OxygenApi api) {
|
||||||
|
OxygenApi.API.set(api);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -71,7 +71,8 @@
|
||||||
"trinkets.MixinTrinketInventory",
|
"trinkets.MixinTrinketInventory",
|
||||||
"trinkets.MixinScreenHandler",
|
"trinkets.MixinScreenHandler",
|
||||||
"seasons.MixinFertilizableUtil",
|
"seasons.MixinFertilizableUtil",
|
||||||
"ad_astra.MixinOxygenUtils",
|
"ad_astra.MixinApiHelper",
|
||||||
|
"ad_astra.MixinOxygenApi",
|
||||||
"forgified.MixinIForgeBoat"
|
"forgified.MixinIForgeBoat"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
|
|
Loading…
Reference in a new issue