1.20 backport

This commit is contained in:
craisinlord committed 2026-10-14 17:39:56 -05:00
1 parent f7e7bebac3
commit d54264c6c8
4681 files changed
+61551 -78441

No files matched your search

@@ -183,7 +183,6 @@ public final class AntarchyConfigCatalog {
|| name.startsWith("nightmareSword")
|| name.startsWith("basiliskDagger")
|| name.startsWith("squidzooka")
|| name.equals("invertProjectilesFromInvertedPlayers")
|| name.startsWith("gravityGun")
|| name.startsWith("critterCage")
|| name.equals("potentNyxiteInvertedDurationSeconds")
@@ -156,7 +156,6 @@ public final class AntarchySettings {
private static double rpoLauncherExplosionDamage = 34.0D;
private static double rpoLauncherExplosionRadius = 14.0D;
private static double sizeRayCooldownSeconds = 1.0D;
private static boolean invertProjectilesFromInvertedPlayers = false;
private static boolean gravityGunEnabled = true;
private static boolean gravityGunBlocksEnabled = true;
private static boolean gravityGunEntitiesEnabled = true;
@@ -1211,10 +1210,6 @@ public final class AntarchySettings {
return sizeRayCooldownSeconds;
}
public static boolean invertProjectilesFromInvertedPlayers() {
return invertProjectilesFromInvertedPlayers;
}
public static boolean gravityGunEnabled() {
return gravityGunEnabled;
}
@@ -1814,10 +1809,6 @@ public final class AntarchySettings {
sizeRayCooldownSeconds = value;
}
public static void setInvertProjectilesFromInvertedPlayers(boolean value) {
invertProjectilesFromInvertedPlayers = value;
}
public static void setGravityGunEnabled(boolean value) {
gravityGunEnabled = value;
}
@@ -76,6 +76,8 @@ public final class AntarchyTags {
public static final TagKey<EntityType<?>> SIZE_CHANGING_IMMUNE = TagKey.create(Registries.ENTITY_TYPE, id("size_changing_immune"));
public static final TagKey<EntityType<?>> CRITTER_CAGE_BLACKLIST = TagKey.create(Registries.ENTITY_TYPE, id("critter_cage_blacklist"));
public static final TagKey<EntityType<?>> PARALYSIS_IMMUNE = TagKey.create(Registries.ENTITY_TYPE, id("paralysis_immune"));
public static final TagKey<EntityType<?>> UNDERSIDE_CEILING_SPAWNERS = TagKey.create(Registries.ENTITY_TYPE, id("underside_ceiling_spawners"));
public static final TagKey<EntityType<?>> UNDERSIDE_CEILING_SHORT_GAP = TagKey.create(Registries.ENTITY_TYPE, id("underside_ceiling_short_gap"));
public static final TagKey<EntityType<?>> HUSHWEED_TARGETS = TagKey.create(Registries.ENTITY_TYPE, id("hushweed_targets"));
public static final TagKey<EntityType<?>> FLYTRAP_PREY = TagKey.create(Registries.ENTITY_TYPE, id("flytrap_prey"));
public static final TagKey<EntityType<?>> STINKY_REPELLED_HOSTILES = TagKey.create(Registries.ENTITY_TYPE, id("stinky_repelled_hostiles"));
@@ -650,7 +650,7 @@ public final class CreativeTabContents {
for (String potionPath : ANTARCHY_POTION_FAMILIES) {
acceptPotionFamily(output, potionPath);
}
for (String diskId : List.of("antarchy:introduction", "antarchy:toreterror_arena", "antarchy:high_fructose_corn_syrup",
for (String diskId : List.of("antarchy:toreterror_arena", "antarchy:high_fructose_corn_syrup",
"antarchy:elythia", "antarchy:flying_squirrel", "antarchy:brutalfly", "antarchy:rainbow_ant", "antarchy:kraken", "antarchy:cavaryn", "antarchy:hercules_beetle", "antarchy:thoraxis", "antarchy:temporal_fields", "antarchy:bloodglass", "antarchy:vortex")) {
ItemStack disk = new ItemStack(com.craisinlord.antos.content.AntOSObjects.FLOPPY_DISK.get());
disk.set(com.craisinlord.antos.content.AntOSObjects.FLOPPY_DISK_COMPONENT.get(), ResourceLocation.parse(diskId));
@@ -167,7 +167,7 @@ public class EmperorScorpionEntity extends Monster implements GeoEntity {
public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty,
MobSpawnType spawnReason, @Nullable net.minecraft.world.entity.SpawnGroupData spawnData) {
ConfiguredMobSpawnUtil.applyConfiguredHealth(this, AntarchySettings.emperorScorpionHealth());
if (ThoraxisUndersideManager.shouldSpawnInvertedOnDreamSand(level, this.blockPosition())) {
if (ThoraxisUndersideManager.isUndersideCeilingSpot(level, this.blockPosition(), this.getType())) {
ThoraxisUndersideManager.applyUndersideInversion(this);
}
return super.finalizeSpawn(level, difficulty, spawnReason, spawnData);
@@ -245,18 +245,12 @@ public class EmperorScorpionEntity extends Monster implements GeoEntity {
if (level.getDifficulty() == Difficulty.PEACEFUL) {
return false;
}
if (ThoraxisUndersideManager.shouldSpawnInvertedOnDreamSand(level, pos)) {
if (ThoraxisUndersideManager.isUndersideCeilingSpawn(entityType, level, pos)) {
return true;
}
// Dream Dunes can use Dream Sandstone as the ceiling surface too. Keep
// the Emperor restricted to a supported underside position, but do
// not require the surface to be the narrower Dream Sand variant.
if (pos.getY() < 0 && level.getBiome(pos).is(DREAM_DUNES) && level.isEmptyBlock(pos)) {
BlockState below = level.getBlockState(pos.below());
BlockState above = level.getBlockState(pos.above());
boolean floorSupport = !below.is(Blocks.BEDROCK) && below.isFaceSturdy(level, pos.below(), Direction.UP);
boolean ceilingSupport = !above.is(Blocks.BEDROCK) && above.isFaceSturdy(level, pos.above(), Direction.DOWN);
return floorSupport || ceilingSupport;
return !below.is(Blocks.BEDROCK) && below.isFaceSturdy(level, pos.below(), Direction.UP);
}
return Monster.checkMonsterSpawnRules(entityType, level, spawnReason, pos, random);
}
@@ -112,15 +112,15 @@ public class ManticoreEntity extends Monster implements GeoEntity {
|| spawnReason == MobSpawnType.MOB_SUMMONED) {
return true;
}
if (pos.getY() >= 0) {
if (pos.getY() >= 0 || level.getDifficulty() == Difficulty.PEACEFUL) {
return false;
}
if (ThoraxisUndersideManager.isUndersideCeilingSpawn(type, level, pos)) {
return true;
}
BlockState below = level.getBlockState(pos.below());
BlockState above = level.getBlockState(pos.above());
boolean floorSupport = !below.is(Blocks.BEDROCK) && below.isFaceSturdy(level, pos.below(), Direction.UP);
boolean ceilingSupport = !above.is(Blocks.BEDROCK) && above.isFaceSturdy(level, pos.above(), Direction.DOWN);
return level.getDifficulty() != Difficulty.PEACEFUL
&& (floorSupport || ceilingSupport)
return floorSupport
&& level.isEmptyBlock(pos)
&& Monster.checkMonsterSpawnRules(type, level, spawnReason, pos, random);
}
@@ -117,7 +117,7 @@ public class ScorpionEntity extends Monster implements GeoEntity {
if (pos.getY() >= 0 && level.getBiome(pos).is(DREAM_DUNES) && random.nextBoolean()) {
return false;
}
if (ThoraxisUndersideManager.shouldSpawnInvertedOnDreamSand(level, pos)) {
if (ThoraxisUndersideManager.isUndersideCeilingSpawn(entityType, level, pos)) {
return level.getDifficulty() != Difficulty.PEACEFUL;
}
return level.getDifficulty() != Difficulty.PEACEFUL
@@ -146,7 +146,7 @@ public class ScorpionEntity extends Monster implements GeoEntity {
public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) {
this.assignRandomTextureVariant();
ConfiguredMobSpawnUtil.applyConfiguredHealth(this, AntarchySettings.scorpionHealth());
if (ThoraxisUndersideManager.shouldSpawnInvertedOnDreamSand(level, this.blockPosition())) {
if (ThoraxisUndersideManager.isUndersideCeilingSpot(level, this.blockPosition(), this.getType())) {
ThoraxisUndersideManager.applyUndersideInversion(this);
}
return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData);
@@ -25,7 +25,7 @@ public final class ComputerScientistTradeManager extends SimpleJsonResourceReloa
private static final Gson GSON = new Gson();
private static final String DIRECTORY = "computer_scientist_trades";
private static final List<ResourceLocation> GENERAL_DISKS = List.of(
id("introduction"), id("high_fructose_corn_syrup"),
id("high_fructose_corn_syrup"),
id("elythia"), id("flying_squirrel"), id("rainbow_ant"), id("kraken"), id("cavaryn"), id("thoraxis"),
id("temporal_fields"), id("bloodglass"), id("vortex"));
private static volatile List<TradeEntry> loadedTrades = List.of();
@@ -2,8 +2,8 @@ package com.craisinlord.antarchy.content.worldgen.thoraxis;
import com.craisinlord.antarchy.Antarchy;
import com.craisinlord.antarchy.content.AntarchyObjects;
import com.craisinlord.antarchy.content.AntarchyTags;
import com.craisinlord.antarchy.content.advancement.AntarchyAdvancementTriggers;
import com.craisinlord.antarchy.content.block.DreamSandBlock;
import com.craisinlord.anthology.gravity.GravityApi;
import com.craisinlord.anthology.gravity.GravityDirection;
import com.craisinlord.anthology.gravity.GravityTransition;
@@ -20,11 +20,13 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.NaturalSpawner;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
@@ -52,6 +54,8 @@ public final class ThoraxisUndersideManager {
private static final int UNDERSIDE_ENTRY_BORDER_Y = GRAVITY_FLIP_Y - 7;
private static final int FRESH_ENTRY_DELAY_TICKS = 20;
private static final int ENTRY_SLOW_FALL_DURATION_TICKS = 300;
private static final double CEILING_SPAWN_GAP = 1.75D;
private static final double SHORT_CEILING_SPAWN_GAP = 1.25D;
private static final Map<ServerLevel, TrackingState> STATES = new WeakHashMap<>();
private ThoraxisUndersideManager() {
@@ -346,25 +350,38 @@ public final class ThoraxisUndersideManager {
}
}
public static boolean shouldSpawnInvertedOnDreamSand(ServerLevelAccessor level, BlockPos pos) {
public static boolean isUndersideCeilingSpawn(EntityType<?> type, ServerLevelAccessor level, BlockPos pos) {
return type.is(AntarchyTags.Entities.UNDERSIDE_CEILING_SPAWNERS) && isUndersideCeilingSpot(level, pos, type);
}
public static boolean isUndersideCeilingSpot(ServerLevelAccessor level, BlockPos pos, EntityType<?> type) {
if (!isThoraxis(level.getLevel()) || pos.getY() >= GRAVITY_FLIP_Y) {
return false;
}
BlockState bodyState = level.getBlockState(pos);
if (!bodyState.isAir() && !bodyState.getCollisionShape(level, pos).isEmpty()) {
BlockPos belowPos = pos.below();
BlockState belowState = level.getBlockState(belowPos);
if (!NaturalSpawner.isValidEmptySpawnBlock(level, pos, bodyState, bodyState.getFluidState(), type)
|| !NaturalSpawner.isValidEmptySpawnBlock(level, belowPos, belowState, belowState.getFluidState(), type)
|| belowState.isFaceSturdy(level, belowPos, Direction.UP)) {
return false;
}
BlockPos supportPos = pos.above();
BlockState supportState = level.getBlockState(supportPos);
if (!(supportState.getBlock() instanceof DreamSandBlock)) {
return false;
}
BlockPos ceilingPos = pos.above();
BlockState ceilingState = level.getBlockState(ceilingPos);
return ceilingState.isFaceSturdy(level, ceilingPos, Direction.DOWN)
&& ceilingState.isValidSpawn(level, ceilingPos, type);
}
return supportState.isFaceSturdy(level, supportPos, Direction.DOWN)
&& level.getFluidState(pos).isEmpty()
&& level.isEmptyBlock(pos.below());
public static double ceilingSpawnFeetY(EntityType<?> type, BlockPos pos, double height) {
double gap = type.is(AntarchyTags.Entities.UNDERSIDE_CEILING_SHORT_GAP) ? SHORT_CEILING_SPAWN_GAP : CEILING_SPAWN_GAP;
return pos.getY() + 1.0D - gap - height;
}
public static AABB ceilingSpawnBounds(EntityType<?> type, BlockPos pos) {
double feetY = ceilingSpawnFeetY(type, pos, type.getHeight());
return type.getSpawnAABB(pos.getX() + 0.5D, feetY, pos.getZ() + 0.5D).setMaxY(pos.getY() + 1.0D);
}
public static boolean isThoraxis(Level level) {
@@ -0,0 +1,58 @@
package com.craisinlord.antarchy.mixins;
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisUndersideManager;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.NaturalSpawner;
import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.phys.AABB;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(NaturalSpawner.class)
public abstract class ThoraxisCeilingSpawnMixin {
@WrapOperation(
method = "isValidSpawnPostitionForType",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/SpawnPlacements;isSpawnPositionOk(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/LevelReader;Lnet/minecraft/core/BlockPos;)Z")
)
private static boolean antarchy$allowCeilingPlacement(EntityType<?> type, LevelReader level, BlockPos pos, Operation<Boolean> original) {
if (level instanceof ServerLevel serverLevel && ThoraxisUndersideManager.isUndersideCeilingSpawn(type, serverLevel, pos)) {
return true;
}
return original.call(type, level, pos);
}
@WrapOperation(
method = "isValidSpawnPostitionForType",
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;noCollision(Lnet/minecraft/world/phys/AABB;)Z")
)
private static boolean antarchy$checkCeilingSpawnBounds(ServerLevel level, AABB bounds, Operation<Boolean> original,
@Local(argsOnly = true) MobSpawnSettings.SpawnerData spawnerData,
@Local(argsOnly = true) BlockPos.MutableBlockPos pos) {
if (ThoraxisUndersideManager.isUndersideCeilingSpawn(spawnerData.type, level, pos)) {
return original.call(level, ThoraxisUndersideManager.ceilingSpawnBounds(spawnerData.type, pos));
}
return original.call(level, bounds);
}
@WrapOperation(
method = "spawnCategoryForPosition(Lnet/minecraft/world/entity/MobCategory;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkAccess;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/NaturalSpawner$SpawnPredicate;Lnet/minecraft/world/level/NaturalSpawner$AfterSpawnCallback;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Mob;moveTo(DDDFF)V")
)
private static void antarchy$placeCeilingSpawn(Mob mob, double x, double y, double z, float yRot, float xRot, Operation<Void> original,
@Local(argsOnly = true) ServerLevel level) {
BlockPos pos = BlockPos.containing(x, y, z);
if (ThoraxisUndersideManager.isUndersideCeilingSpawn(mob.getType(), level, pos)) {
original.call(mob, x, ThoraxisUndersideManager.ceilingSpawnFeetY(mob.getType(), pos, mob.getBbHeight()), z, yRot, xRot);
ThoraxisUndersideManager.applyUndersideInversion(mob);
return;
}
original.call(mob, x, y, z, yRot, xRot);
}
}