fixed missing tags

added many underside structures
tweaked king and queen AI
fixed undervault and UndertrialSpawnerBlock
This commit is contained in:
craisinlord committed 2026-09-12 16:57:48 -05:00
1 parent 8812938d79
commit 377f3785af
76 files changed
+1503 -1000

No files matched your search

@@ -0,0 +1,186 @@
package com.craisinlord.antarchy.config;
import net.minecraft.resources.ResourceKey;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public final class AntarchyConfigCatalog {
public enum Section {
MOBS,
TOOLS,
MISC
}
public enum ValueType {
BOOLEAN,
INTEGER,
DOUBLE,
FLOAT,
STRING
}
public record Definition(
String name,
Section section,
ValueType valueType,
Class<?> setterType,
Method getter,
Method setter
) {
}
private static final List<Definition> DEFINITIONS = buildDefinitions();
private AntarchyConfigCatalog() {
}
public static List<Definition> definitions() {
return DEFINITIONS;
}
public static Map<String, Definition> definitionsByName() {
Map<String, Definition> result = new LinkedHashMap<>();
for (Definition definition : DEFINITIONS) {
result.put(definition.name(), definition);
}
return Map.copyOf(result);
}
private static List<Definition> buildDefinitions() {
Map<String, Method> getters = Arrays.stream(AntarchySettings.class.getMethods())
.filter(AntarchyConfigCatalog::isPublicStatic)
.filter(method -> method.getParameterCount() == 0)
.filter(method -> method.getReturnType() != Void.TYPE)
.collect(java.util.stream.Collectors.toMap(
Method::getName,
method -> method,
(first, ignored) -> first,
LinkedHashMap::new));
return Arrays.stream(AntarchySettings.class.getMethods())
.filter(AntarchyConfigCatalog::isPublicStatic)
.filter(method -> method.getName().startsWith("set"))
.filter(method -> method.getParameterCount() == 1)
.sorted(java.util.Comparator.comparing(Method::getName))
.map(setter -> definitionFor(setter, getters))
.filter(java.util.Objects::nonNull)
.toList();
}
private static Definition definitionFor(Method setter, Map<String, Method> getters) {
String name = decapitalize(setter.getName().substring(3));
Method getter = getters.get(name);
if (getter == null) {
return null;
}
Class<?> setterType = setter.getParameterTypes()[0];
ValueType valueType = valueTypeFor(setterType, getter.getReturnType());
if (valueType == null) {
return null;
}
return new Definition(name, sectionFor(name), valueType, setterType, getter, setter);
}
private static ValueType valueTypeFor(Class<?> setterType, Class<?> getterType) {
if (setterType == boolean.class && getterType == boolean.class) {
return ValueType.BOOLEAN;
}
if (setterType == int.class && getterType == int.class) {
return ValueType.INTEGER;
}
if (setterType == double.class && getterType == double.class) {
return ValueType.DOUBLE;
}
if (setterType == float.class && getterType == float.class) {
return ValueType.FLOAT;
}
if (setterType == String.class && ResourceKey.class.isAssignableFrom(getterType)) {
return ValueType.STRING;
}
return null;
}
private static boolean isPublicStatic(Method method) {
int modifiers = method.getModifiers();
return Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers);
}
private static String decapitalize(String value) {
if (value.isEmpty()) {
return value;
}
return Character.toLowerCase(value.charAt(0)) + value.substring(1);
}
private static Section sectionFor(String name) {
if (isMiscSetting(name)) {
return Section.MISC;
}
if (isToolSetting(name)) {
return Section.TOOLS;
}
return Section.MOBS;
}
private static boolean isMiscSetting(String name) {
return name.equals("disableInfinityBookPortalCreation")
|| name.equals("rainbowAntsLeadToInfinityDimensions")
|| name.equals("permanentPortalsEnabled")
|| name.equals("permanentPortalsFlintAndSteelEnabled")
|| name.equals("elythiaPortalEnabled")
|| name.equals("thoraxisPortalEnabled")
|| name.equals("cavarynPortalEnabled")
|| name.equals("hushweedSporeLifetimeSeconds")
|| name.equals("elythiaFireflyParticlesEnabled")
|| name.equals("duplicatorTreeEnabled")
|| name.equals("glowVinesUnderLeaves")
|| name.equals("swingThroughGrassEnabled")
|| name.equals("fabricKeybindingConflictFixEnabled")
|| name.equals("experimentalSettingsPopupDisabled")
|| name.equals("entitySpecificFireOverlayEnabled")
|| name.equals("dreamSandEnabled")
|| name.startsWith("dreamSand")
|| name.equals("ichorWitherEnabled")
|| name.startsWith("diamondMinecart")
|| name.startsWith("hoverboard");
}
private static boolean isToolSetting(String name) {
return name.equals("sizeChangingRaysEnabled")
|| name.startsWith("sizeRay")
|| name.equals("shrinkingPotionDelta")
|| name.equals("growthPotionDelta")
|| name.startsWith("ultimate")
|| name.startsWith("battleAxe")
|| name.startsWith("bigBertha")
|| name.startsWith("attitudeAdjuster")
|| name.startsWith("scorpionWhip")
|| name.startsWith("bloodCrystal")
|| name.startsWith("nightmareHelmet")
|| name.startsWith("nightmareChestplate")
|| name.startsWith("nightmareLeggings")
|| name.startsWith("nightmareBoots")
|| name.startsWith("nightmareArmorDreadAura")
|| name.startsWith("primordialArmor")
|| name.startsWith("nightmareSword")
|| name.startsWith("basiliskDagger")
|| name.startsWith("squidzooka")
|| name.equals("invertProjectilesFromInvertedPlayers")
|| name.startsWith("gravityGun")
|| name.startsWith("critterCage")
|| name.startsWith("minersDream")
|| name.equals("potentNyxiteInvertedDurationSeconds")
|| name.equals("corneaEarNightVisionSeconds")
|| name.startsWith("american")
|| name.startsWith("mogglesVision")
|| name.equals("ductTapeRepairPercentPerUse")
|| name.startsWith("fallenKingCrown");
}
}
@@ -12,25 +12,26 @@ public final class ConfigResetGuard {
private ConfigResetGuard() {
}
public static void wipeIfNeeded(Path configDir, Path... configFiles) {
public static void migrateIfNeeded(Path configDir, Path... configFiles) {
Path markerPath = configDir.resolve(MARKER_FILE_NAME);
if (readGeneration(markerPath) >= RESET_GENERATION) {
return;
}
for (Path configFile : configFiles) {
try {
if (Files.deleteIfExists(configFile)) {
Antarchy.LOGGER.info("Reset config file {} to defaults (config generation {})", configFile, RESET_GENERATION);
}
} catch (IOException e) {
Antarchy.LOGGER.warn("Failed to delete config file {} during config reset", configFile, e);
if (Files.exists(configFile)) {
Antarchy.LOGGER.info("Preserving config file {} during config migration (config generation {})", configFile, RESET_GENERATION);
}
}
writeGeneration(markerPath);
}
@Deprecated
public static void wipeIfNeeded(Path configDir, Path... configFiles) {
migrateIfNeeded(configDir, configFiles);
}
private static int readGeneration(Path markerPath) {
if (!Files.exists(markerPath)) {
return 0;
@@ -64,13 +64,10 @@ public final class UndertrialSpawnerBlock extends BaseEntityBlock {
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) {
if (this.blockEntityType == null || blockEntityType != this.blockEntityType.get()) {
return null;
}
if (level.isClientSide) {
return (BlockEntityTicker<T>) (BlockEntityTicker<UndertrialSpawnerBlockEntity>) UndertrialSpawnerBlockEntity::clientTick;
return createTickerHelper(blockEntityType, this.blockEntityType.get(), UndertrialSpawnerBlockEntity::clientTick);
}
return (BlockEntityTicker<T>) (BlockEntityTicker<UndertrialSpawnerBlockEntity>) ((tickLevel, tickPos, tickState, blockEntity) -> {
return createTickerHelper(blockEntityType, this.blockEntityType.get(), (tickLevel, tickPos, tickState, blockEntity) -> {
if (tickLevel instanceof net.minecraft.server.level.ServerLevel serverLevel) {
UndertrialSpawnerBlockEntity.serverTick(serverLevel, tickPos, tickState, blockEntity);
}
@@ -58,9 +58,16 @@ public final class QueenTrailSpawnMarkerBlockEntity extends BlockEntity {
}
boolean nearbyPlayer = level.players().stream().anyMatch(player -> !player.isSpectator()
&& player.distanceToSqr(marker.spawnPos.getX() + 0.5D, marker.spawnPos.getY() + 0.5D, marker.spawnPos.getZ() + 0.5D) <= ACTIVATION_DISTANCE_SQUARED);
if (!nearbyPlayer || !level.hasChunkAt(marker.spawnPos)) {
if (!nearbyPlayer) {
return;
}
// The Queen is large enough to span several chunks. Ensure the area around
// the arrival point is available before checking its collision box.
for (int chunkX = (marker.spawnPos.getX() - 16) >> 4; chunkX <= (marker.spawnPos.getX() + 16) >> 4; chunkX++) {
for (int chunkZ = (marker.spawnPos.getZ() - 16) >> 4; chunkZ <= (marker.spawnPos.getZ() + 16) >> 4; chunkZ++) {
level.getChunk(chunkX, chunkZ);
}
}
QueenEntity queen = QueenEntity.spawnFromUndersideTrail(level, marker.spawnPos, marker.homePos, marker.siteId, marker.yaw);
if (queen != null) {
marker.consumed = true;
@@ -37,7 +37,7 @@ public final class UnderVaultBlockEntity extends BlockEntity {
private static VaultConfig createConfig() {
return new VaultConfig(ResourceKey.create(net.minecraft.core.registries.Registries.LOOT_TABLE,
ResourceLocation.withDefaultNamespace("chests/trial_chambers/reward")), 4.0D, 4.0D,
ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "chests/undertrial_vault")), 4.0D, 4.0D,
new ItemStack(BuiltInRegistries.ITEM.get(ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "undertrial_key"))),
Optional.empty());
}
@@ -5,23 +5,33 @@ import com.craisinlord.antarchy.content.block.UndertrialSpawnerBlock;
import com.craisinlord.antarchy.Antarchy;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.core.Direction;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtOps;
import net.minecraft.nbt.Tag;
import net.minecraft.resources.RegistryOps;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.trialspawner.TrialSpawner;
import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerConfig;
import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerState;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraft.util.random.SimpleWeightedRandomList;
import java.util.HashSet;
import java.util.Set;
@@ -35,11 +45,16 @@ public final class UndertrialSpawnerBlockEntity extends BlockEntity implements T
private TrialSpawnerState previousClientState;
private double clientSpin;
private double clientOldSpin;
private SimpleWeightedRandomList<ResourceKey<LootTable>> normalLootTables = SimpleWeightedRandomList.empty();
private SimpleWeightedRandomList<ResourceKey<LootTable>> ominousLootTables = SimpleWeightedRandomList.empty();
private Tag normalLootTablesTag;
private Tag ominousLootTablesTag;
public UndertrialSpawnerBlockEntity(BlockPos pos, BlockState state, Supplier<? extends net.minecraft.world.level.block.entity.BlockEntityType<UndertrialSpawnerBlockEntity>> type) {
super(type.get(), pos, state);
this.trialSpawner = new TrialSpawner(this, net.minecraft.world.level.block.entity.trialspawner.PlayerDetector.INCLUDING_CREATIVE_PLAYERS,
net.minecraft.world.level.block.entity.trialspawner.PlayerDetector.EntitySelector.SELECT_FROM_LEVEL);
this.trialSpawner.overridePeacefulAndMobSpawnRule();
this.previousClientState = state.getValue(UndertrialSpawnerBlock.STATE);
}
@@ -48,7 +63,14 @@ public final class UndertrialSpawnerBlockEntity extends BlockEntity implements T
for (Mob mob : level.getEntitiesOfClass(Mob.class, new AABB(pos).inflate(16.0D))) {
before.add(mob.getUUID());
}
blockEntity.trialSpawner.tickServer(level, pos, state.getValue(UndertrialSpawnerBlock.OMINOUS));
TrialSpawnerState previousState = blockEntity.getState();
boolean ominous = state.getValue(UndertrialSpawnerBlock.OMINOUS);
boolean rewardReady = previousState == TrialSpawnerState.EJECTING_REWARD
&& blockEntity.trialSpawner.getData().isReadyToEjectItems(level, 30.0F, blockEntity.trialSpawner.getTargetCooldownLength());
blockEntity.trialSpawner.tickServer(level, pos, ominous);
if (rewardReady && blockEntity.getState() == TrialSpawnerState.EJECTING_REWARD) {
blockEntity.ejectReward(level, pos, ominous);
}
for (Mob mob : level.getEntitiesOfClass(Mob.class, new AABB(pos).inflate(16.0D))) {
if (!before.contains(mob.getUUID())) {
blockEntity.applyUndertrialEffects(mob);
@@ -102,18 +124,35 @@ public final class UndertrialSpawnerBlockEntity extends BlockEntity implements T
@Override
protected void loadAdditional(CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) {
super.loadAdditional(tag, registries);
if (tag.contains(SPAWNER_TAG)) {
trialSpawner.codec().parse(RegistryOps.create(NbtOps.INSTANCE, registries), tag.get(SPAWNER_TAG)).result().ifPresent(decoded -> {
trialSpawner = decoded;
});
}
net.minecraft.nbt.Tag spawnerTag = tag.contains(SPAWNER_TAG) ? tag.get(SPAWNER_TAG) : tag;
trialSpawner.codec().parse(RegistryOps.create(NbtOps.INSTANCE, registries), spawnerTag).result().ifPresent(decoded -> {
captureLootTables(decoded, spawnerTag);
trialSpawner = createRewardlessSpawner(decoded);
});
}
@Override
public CompoundTag getUpdateTag(net.minecraft.core.HolderLookup.Provider registries) {
CompoundTag tag = new CompoundTag();
saveAdditional(tag, registries);
return tag;
}
@Override
protected void saveAdditional(CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) {
super.saveAdditional(tag, registries);
trialSpawner.codec().encodeStart(RegistryOps.create(NbtOps.INSTANCE, registries), trialSpawner).result()
.ifPresent(encoded -> tag.put(SPAWNER_TAG, encoded));
.ifPresent(encoded -> {
if (encoded instanceof CompoundTag spawnerTag) {
if (normalLootTablesTag != null) {
spawnerTag.getCompound("normal_config").put("loot_tables_to_eject", normalLootTablesTag.copy());
}
if (ominousLootTablesTag != null) {
spawnerTag.getCompound("ominous_config").put("loot_tables_to_eject", ominousLootTablesTag.copy());
}
tag.put(SPAWNER_TAG, spawnerTag);
}
});
}
@Override
@@ -141,4 +180,42 @@ public final class UndertrialSpawnerBlockEntity extends BlockEntity implements T
public double getClientSpin(float partialTick) {
return this.clientOldSpin + (this.clientSpin - this.clientOldSpin) * partialTick;
}
private void captureLootTables(TrialSpawner source, Tag spawnerTag) {
normalLootTables = source.getNormalConfig().lootTablesToEject();
ominousLootTables = source.getOminousConfig().lootTablesToEject();
if (spawnerTag instanceof CompoundTag compound) {
CompoundTag normalConfig = compound.getCompound("normal_config");
CompoundTag ominousConfig = compound.getCompound("ominous_config");
normalLootTablesTag = normalConfig.get("loot_tables_to_eject");
ominousLootTablesTag = ominousConfig.get("loot_tables_to_eject");
}
}
private TrialSpawner createRewardlessSpawner(TrialSpawner source) {
TrialSpawner rewardless = new TrialSpawner(withoutLootTables(source.getNormalConfig()), withoutLootTables(source.getOminousConfig()),
source.getData(), source.getRequiredPlayerRange(), source.getTargetCooldownLength(), this,
source.getPlayerDetector(), source.getEntitySelector());
rewardless.overridePeacefulAndMobSpawnRule();
return rewardless;
}
private static TrialSpawnerConfig withoutLootTables(TrialSpawnerConfig config) {
return new TrialSpawnerConfig(config.spawnRange(), config.totalMobs(), config.simultaneousMobs(),
config.totalMobsAddedPerPlayer(), config.simultaneousMobsAddedPerPlayer(), config.ticksBetweenSpawn(),
config.spawnPotentialsDefinition(), SimpleWeightedRandomList.empty(), config.itemsToDropWhenOminous());
}
private void ejectReward(ServerLevel level, BlockPos pos, boolean ominous) {
SimpleWeightedRandomList<ResourceKey<LootTable>> lootTables = ominous ? ominousLootTables : normalLootTables;
lootTables.getRandomValue(level.getRandom()).ifPresent(key -> {
LootTable lootTable = level.getServer().reloadableRegistries().getLootTable(key);
LootParams params = new LootParams.Builder(level).create(LootContextParamSets.EMPTY);
for (ItemStack stack : lootTable.getRandomItems(params)) {
DefaultDispenseItemBehavior.spawnItem(level, stack, 2, Direction.DOWN,
Vec3.atBottomCenterOf(pos).relative(Direction.DOWN, 1.2D));
}
level.levelEvent(3014, pos, 0);
});
}
}
@@ -1,46 +0,0 @@
package com.craisinlord.antarchy.content.client;
import com.craisinlord.antarchy.content.weather.ThoraxisWeatherKind;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.Level;
public final class ThoraxisWeatherClientState {
private static final Map<ResourceLocation, ThoraxisWeatherState> STATES = new HashMap<>();
private ThoraxisWeatherClientState() {
}
public static void apply(ResourceLocation dimension, ThoraxisWeatherKind kind, long expiresAt, int anchorX, int anchorY, int anchorZ) {
if (kind == ThoraxisWeatherKind.NONE) {
STATES.remove(dimension);
return;
}
STATES.put(dimension, new ThoraxisWeatherState(kind, expiresAt, new BlockPos(anchorX, anchorY, anchorZ)));
}
public static ThoraxisWeatherState current(Level level) {
if (level == null) {
return null;
}
ThoraxisWeatherState state = STATES.get(level.dimension().location());
if (state == null) {
return null;
}
long now = level.getGameTime();
if (state.expiresAt > 0L && now > state.expiresAt) {
STATES.remove(level.dimension().location());
return null;
}
return state;
}
public record ThoraxisWeatherState(ThoraxisWeatherKind kind, long expiresAt, BlockPos anchor) {
}
}
@@ -50,7 +50,9 @@ public class RoyalBossModel extends GeoModel<RoyalBossEntity> {
Vec3 beamEnd = animatable.getRoyalBeamEndPosition(slot);
if (!animatable.isFiringRoyalBeam(slot) || beamEnd == null) continue;
Vec3 origin = animatable.getRoyalBeamShootFrom(slot, partialTick);
Vec3 direction = beamEnd.subtract(origin);
Vec3 direction = com.craisinlord.antarchy.content.gravity.AntarchyGravityRotationUtil.vecWorldToPlayer(
beamEnd.subtract(origin),
com.craisinlord.antarchy.content.gravity.AntarchyGravityApi.getGravityDirection(animatable));
double horizontal = Math.sqrt(direction.x * direction.x + direction.z * direction.z);
if (direction.lengthSqr() < 1.0E-6D || horizontal < 1.0E-4D) continue;
@@ -65,8 +67,8 @@ public class RoyalBossModel extends GeoModel<RoyalBossEntity> {
float pitchPerBone = pitch / chain.length;
for (String boneName : chain) {
this.getBone(boneName).ifPresent(bone -> {
bone.setRotY(bone.getRotY() + yawPerBone);
bone.setRotX(bone.getRotX() + pitchPerBone);
bone.setRotY(yawPerBone);
bone.setRotX(pitchPerBone);
});
}
}
@@ -13,6 +13,8 @@ import net.minecraft.commands.Commands;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Style;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
@@ -67,11 +69,16 @@ public final class QueenLocateCommand {
}
BlockPos spawn = marker.getSpawnPos();
int distance = Mth.floor(Math.sqrt(distanceSquared(originX, originZ, site)));
source.sendSuccess(() -> Component.literal(
"Nearest Queen spawn in antarchy:thoraxis: ["
+ spawn.getX() + ", " + spawn.getY() + ", " + spawn.getZ()
+ "] (" + distance + " blocks away)"
), false);
String coordinates = "[" + spawn.getX() + ", " + spawn.getY() + ", " + spawn.getZ() + "]";
String teleportCommand = "/execute in " + THORAXIS.location() + " run tp @s "
+ spawn.getX() + " " + spawn.getY() + " " + spawn.getZ();
source.sendSuccess(() -> Component.literal("Nearest Queen spawn in " + THORAXIS.location() + ": ")
.append(Component.literal(coordinates)
.withStyle(Style.EMPTY
.withColor(net.minecraft.ChatFormatting.AQUA)
.withUnderlined(true)
.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, teleportCommand))))
.append(Component.literal(" (" + distance + " blocks away)")), false);
return distance;
}
@@ -117,7 +117,8 @@ public class BedBugEntity extends Animal implements GeoEntity {
}
public static boolean canSpawn(EntityType<BedBugEntity> entityType, ServerLevelAccessor level, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
if (spawnReason == MobSpawnType.SPAWN_EGG || spawnReason == MobSpawnType.SPAWNER || spawnReason == MobSpawnType.COMMAND) {
if (spawnReason == MobSpawnType.SPAWN_EGG || spawnReason == MobSpawnType.SPAWNER
|| spawnReason == MobSpawnType.TRIAL_SPAWNER || spawnReason == MobSpawnType.COMMAND) {
return true;
}
@@ -100,8 +100,8 @@ public class ManticoreEntity extends Monster implements GeoEntity {
public static AttributeSupplier.Builder createAttributes() {
return Mob.createMobAttributes()
.add(Attributes.MAX_HEALTH, AntarchySettings.manticoreHealth())
.add(Attributes.MOVEMENT_SPEED, 0.3D)
.add(Attributes.FLYING_SPEED, 1.2D)
.add(Attributes.MOVEMENT_SPEED, 0.45D)
.add(Attributes.FLYING_SPEED, 2.0D)
.add(Attributes.ATTACK_DAMAGE, AntarchySettings.manticoreAttackDamage())
.add(Attributes.FOLLOW_RANGE, 28.0D)
.add(Attributes.KNOCKBACK_RESISTANCE, 0.2D);
@@ -109,7 +109,8 @@ public class ManticoreEntity extends Monster implements GeoEntity {
public static boolean canSpawn(EntityType<ManticoreEntity> type, ServerLevelAccessor level, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
if (spawnReason == MobSpawnType.SPAWN_EGG || spawnReason == MobSpawnType.SPAWNER
|| spawnReason == MobSpawnType.COMMAND || spawnReason == MobSpawnType.MOB_SUMMONED) {
|| spawnReason == MobSpawnType.TRIAL_SPAWNER || spawnReason == MobSpawnType.COMMAND
|| spawnReason == MobSpawnType.MOB_SUMMONED) {
return true;
}
if (pos.getY() >= 0) {
@@ -486,7 +487,7 @@ public class ManticoreEntity extends Monster implements GeoEntity {
private final ManticoreEntity manticore;
ManticoreAttackGoal(ManticoreEntity manticore) {
super(manticore, 1.1D, true);
super(manticore, 1.6D, true);
this.manticore = manticore;
}
@@ -107,6 +107,7 @@ public class ScorpionEntity extends Monster implements GeoEntity {
MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
if (spawnReason == MobSpawnType.SPAWN_EGG
|| spawnReason == MobSpawnType.SPAWNER
|| spawnReason == MobSpawnType.TRIAL_SPAWNER
|| spawnReason == MobSpawnType.COMMAND) {
return true;
}
@@ -114,6 +114,9 @@ public class LucidEntity extends Monster implements GeoEntity {
public static boolean canSpawn(EntityType<LucidEntity> entityType, ServerLevelAccessor level,
MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
if (spawnReason == MobSpawnType.TRIAL_SPAWNER) {
return level.getDifficulty() != Difficulty.PEACEFUL;
}
return level.getDifficulty() != Difficulty.PEACEFUL
&& pos.getY() <= 250
&& level.isEmptyBlock(pos)
@@ -571,4 +574,3 @@ public class LucidEntity extends Monster implements GeoEntity {
@@ -35,9 +35,7 @@ public class LucidEyeProjectileEntity extends ThrowableItemProjectile {
@Override
protected double getDefaultGravity() {
// Gravity is expressed in the projectile's local frame, so the generic
// Underside hook mirrors this pearl's special rising arc below Y=0.
return -0.03D;
return 0.03D;
}
@Override
@@ -260,6 +260,9 @@ public class NightmareEntity extends Monster implements GeoEntity {
}
public static boolean canSpawn(EntityType<NightmareEntity> entityType, ServerLevelAccessor level, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
if (spawnReason == MobSpawnType.TRIAL_SPAWNER) {
return level.getDifficulty() != Difficulty.PEACEFUL;
}
boolean posEmpty = level.isEmptyBlock(pos);
boolean floorSpawn = level.getBlockState(pos.below()).isFaceSturdy(level, pos.below(), Direction.UP) && level.isEmptyBlock(pos.above());
boolean ceilingSpawn = level.getBlockState(pos.above()).isFaceSturdy(level, pos.above(), Direction.DOWN) && level.isEmptyBlock(pos.below());
@@ -275,7 +275,7 @@ public class DimensionalTearEntity extends Entity implements GeoEntity {
if (target != null && target.isAlive()) {
manticore.setTarget(target);
}
manticore.setDeltaMovement(this.getViewVector(1.0F).scale(0.2D).add(0.0D, 0.08D, 0.0D));
manticore.setDeltaMovement(this.getViewVector(1.0F).scale(0.7D).add(0.0D, 0.18D, 0.0D));
manticore.setNoGravity(false);
level.addFreshEntity(manticore);
}
@@ -868,8 +868,6 @@ public class KingEntity extends RoyalBossEntity {
new com.craisinlord.antarchy.content.entity.royal.attack.RoyalAttackScheduler.Action() {
@Override public void onStart() {
KingEntity.this.triggerAnim(RoyalHead.Slot.LEFT.controllerName(), "shoot");
KingEntity.this.playRoyalSound(SoundEvents.FIRECHARGE_USE, 0.8F);
KingEntity.this.playRoyalSound(SoundEvents.GHAST_WARN, 1.2F);
}
@Override public void onActive(int elapsedTicks) {
Vec3 origin = KingEntity.this.headAnchor(KingEntity.this.royalHead(RoyalHead.Slot.LEFT));
@@ -59,6 +59,7 @@ public class QueenEntity extends RoyalBossEntity {
private static final int MOMENTUM_LOCK_COOLDOWN = 420;
private static final int MOMENTUM_LOCK_DURATION = 90;
private static final double MOMENTUM_LOCK_RADIUS = 26.0D;
private static final float MOMENTUM_LOCK_EARLY_HEALTH_THRESHOLD = 0.80F;
private static final int CRUSHING_GRAVITY_COOLDOWN = 360;
private static final int CRUSHING_GRAVITY_DURATION = 120;
private static final double CRUSHING_GRAVITY_RADIUS = 18.0D;
@@ -252,8 +253,6 @@ public class QueenEntity extends RoyalBossEntity {
@Override public void onStart() {
head.startShoot();
QueenEntity.this.triggerAnim(slot.controllerName(), "shoot");
QueenEntity.this.playRoyalSound(net.minecraft.sounds.SoundEvents.FIRECHARGE_USE, 0.75F);
QueenEntity.this.playRoyalSound(net.minecraft.sounds.SoundEvents.GHAST_WARN, 1.35F);
}
@Override public void onActive(int elapsedTicks) {
Vec3 origin = QueenEntity.this.headAnchor(head);
@@ -381,11 +380,21 @@ public class QueenEntity extends RoyalBossEntity {
private int spawnManticoreTears(ServerLevel level, LivingEntity target, int count) {
int pairs = Math.max(1, Math.min(3, (count + 1) / 2));
int created = 0;
Vec3 towardTarget = target.position().subtract(this.position()).multiply(1.0D, 0.0D, 1.0D);
if (towardTarget.lengthSqr() < 1.0E-4D) {
towardTarget = this.getViewVector(1.0F).multiply(1.0D, 0.0D, 1.0D);
}
towardTarget = towardTarget.normalize();
Vec3 behindTarget = target.position().add(towardTarget.scale(8.0D));
Vec3 lateral = new Vec3(-towardTarget.z, 0.0D, towardTarget.x);
double vertical = AntarchyGravityApi.isGravityInverted(this) ? -2.0D : 2.0D;
for (int i = 0; i < pairs; i++) {
double angle = this.random.nextDouble() * Mth.TWO_PI;
double distance = Math.max(8.0D, AntarchySettings.queenManticoreSummonRange() * 0.65D);
Vec3 firstPos = this.position().add(Math.cos(angle) * distance, 1.0D, Math.sin(angle) * distance);
Vec3 secondPos = this.position().add(Math.cos(angle + Math.PI) * distance, 1.0D, Math.sin(angle + Math.PI) * distance);
double spread = (i - (pairs - 1) * 0.5D) * 5.0D;
Vec3 pairCenter = behindTarget.add(lateral.scale(spread)).add(0.0D, vertical, 0.0D);
Vec3 firstPos = pairCenter.add(lateral.scale(3.0D));
Vec3 secondPos = pairCenter.add(lateral.scale(-3.0D));
DimensionalTearEntity first = DimensionalTearEntity.createQueenManticoreTear(level, firstPos,
(float) Math.toDegrees(angle), 240, this.getUUID(), Math.min(3, count));
DimensionalTearEntity second = DimensionalTearEntity.createQueenManticoreTear(level, secondPos,
@@ -417,7 +426,7 @@ public class QueenEntity extends RoyalBossEntity {
Phase phase = this.phase();
boolean majorBusy = this.royalEffects.active("momentum_lock") || this.royalEffects.active("crushing_gravity");
boolean allowOverlap = phase != Phase.ONE;
String[] candidates = phase == Phase.ONE
String[] candidates = phase == Phase.ONE && !this.isMomentumLockAvailableEarly()
? new String[] {"gravity_stomp", "black_hole"}
: new String[] {"gravity_stomp", "black_hole", "momentum_lock", "crushing_gravity", "acceleration"};
String selected = this.attackScheduler.chooseWeighted(candidates, id -> {
@@ -490,6 +499,11 @@ public class QueenEntity extends RoyalBossEntity {
};
}
private boolean isMomentumLockAvailableEarly() {
return this.getMaxHealth() > 0.0F
&& this.getHealth() / this.getMaxHealth() <= MOMENTUM_LOCK_EARLY_HEALTH_THRESHOLD;
}
private void tickFinalAcceleration() {
if (this.phase() != Phase.THREE) {
return;
@@ -517,7 +531,7 @@ public class QueenEntity extends RoyalBossEntity {
private void castBlackHole(ServerLevel level, LivingEntity target) {
double vertical = 2.0D + this.random.nextDouble() * 2.0D;
if (AntarchyGravityApi.isGravityInverted(target)) {
if (AntarchyGravityApi.isGravityInverted(this)) {
vertical = -vertical;
}
Vec3 anchor = target.position().add(
@@ -301,7 +301,7 @@ public class RoyalBlackHoleEntity extends Entity implements GeoEntity {
}
Vec3 center = this.effectCenter();
Vec3 terrainOrigin = this.position();
Vec3 terrainOrigin = center;
double radius = this.effectRadius();
int pulledThisTick = 0;
for (int attempt = 0; attempt < BLOCK_SUCTION_ATTEMPTS && pulledThisTick < BLOCKS_PER_SUCTION
@@ -11,6 +11,7 @@ import com.craisinlord.antarchy.content.entity.royal.beam.RoyalBeamElement;
import com.craisinlord.antarchy.content.entity.royal.attack.RoyalAttackLane;
import com.craisinlord.antarchy.content.entity.royal.attack.RoyalAttackScheduler;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityRotationUtil;
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisUndersideManager;
import java.util.Arrays;
import java.util.List;
@@ -26,6 +27,7 @@ import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.Mth;
import net.minecraft.world.BossEvent;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
@@ -586,6 +588,7 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult
int index = head.slot().ordinal();
head.setBeamActive(false);
head.stopShoot();
this.stopTriggeredAnim(head.slot().controllerName(), null);
this.beamControllers[index].stop();
this.entityData.set(BEAM_ACTIVE[index], false);
this.entityData.set(BEAM_ELEMENT[index], RoyalBeamElement.GENERIC.ordinal());
@@ -874,10 +877,12 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult
double yaw = this.yBodyRot * Mth.DEG_TO_RAD;
Vec3 forward = new Vec3(-Math.sin(yaw), 0.0D, Math.cos(yaw));
Vec3 right = new Vec3(forward.z, 0.0D, -forward.x);
return new Vec3(
this.getX() + forward.x * spec.forwardOffset() + right.x * spec.lateralOffset(),
this.getY() + spec.yOffset(),
this.getZ() + forward.z * spec.forwardOffset() + right.z * spec.lateralOffset());
Vec3 localOffset = new Vec3(
forward.x * spec.forwardOffset() + right.x * spec.lateralOffset(),
spec.yOffset(),
forward.z * spec.forwardOffset() + right.z * spec.lateralOffset());
return this.position().add(AntarchyGravityRotationUtil.vecPlayerToWorld(localOffset,
AntarchyGravityApi.getGravityDirection(this)));
}
protected Vec3 beamAnchor(RoyalHead head) {
@@ -894,10 +899,12 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult
case RIGHT -> BEAM_MUZZLE_LATERAL;
};
double vertical = slot == RoyalHead.Slot.CENTER ? BEAM_MUZZLE_CENTER_Y : BEAM_MUZZLE_SIDE_Y;
return new Vec3(
x + forward.x * BEAM_MUZZLE_FORWARD + right.x * lateral,
y + vertical,
z + forward.z * BEAM_MUZZLE_FORWARD + right.z * lateral);
Vec3 localOffset = new Vec3(
forward.x * BEAM_MUZZLE_FORWARD + right.x * lateral,
vertical,
forward.z * BEAM_MUZZLE_FORWARD + right.z * lateral);
return new Vec3(x, y, z).add(AntarchyGravityRotationUtil.vecPlayerToWorld(localOffset,
AntarchyGravityApi.getGravityDirection(this)));
}
protected double royalBeamMinimumRange() {
@@ -989,6 +996,9 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult
@Override
public boolean hurt(DamageSource source, float amount) {
if (source.is(DamageTypes.GENERIC_KILL)) {
return super.hurt(source, amount);
}
float cappedAmount = (float) Math.min(amount, AntarchySettings.royalBossMaxSingleHitDamage());
return super.hurt(source, cappedAmount);
}
@@ -1,46 +0,0 @@
package com.craisinlord.antarchy.content.network;
import com.craisinlord.antarchy.Antarchy;
import com.craisinlord.antarchy.content.weather.ThoraxisWeatherKind;
import io.netty.buffer.ByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
public record ThoraxisWeatherPayload(
String dimensionId,
String weatherId,
long expiresAt,
int anchorX,
int anchorY,
int anchorZ
) implements CustomPacketPayload {
public static final Type<ThoraxisWeatherPayload> TYPE =
new Type<>(ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "thoraxis_weather"));
public static final StreamCodec<ByteBuf, ThoraxisWeatherPayload> STREAM_CODEC = StreamCodec.composite(
ByteBufCodecs.STRING_UTF8,
ThoraxisWeatherPayload::dimensionId,
ByteBufCodecs.STRING_UTF8,
ThoraxisWeatherPayload::weatherId,
ByteBufCodecs.VAR_LONG,
ThoraxisWeatherPayload::expiresAt,
ByteBufCodecs.VAR_INT,
ThoraxisWeatherPayload::anchorX,
ByteBufCodecs.VAR_INT,
ThoraxisWeatherPayload::anchorY,
ByteBufCodecs.VAR_INT,
ThoraxisWeatherPayload::anchorZ,
ThoraxisWeatherPayload::new
);
public ThoraxisWeatherPayload(ResourceLocation dimensionId, ThoraxisWeatherKind kind, long expiresAt, int anchorX, int anchorY, int anchorZ) {
this(dimensionId.toString(), kind.id(), expiresAt, anchorX, anchorY, anchorZ);
}
@Override
public Type<ThoraxisWeatherPayload> type() {
return TYPE;
}
}
@@ -153,6 +153,10 @@ public class TimeDilationFieldEntity extends Entity {
return this.entityData.get(RADIUS);
}
public double influenceRadius() {
return this.chronosphere ? this.fieldRadius() * 2.0D : this.fieldRadius();
}
public double fieldRadiusSqr() {
double radius = this.fieldRadius();
return radius * radius;
@@ -40,8 +40,23 @@ public final class TimeDilationFieldSampler {
double dy = center.y - entity.getY();
double dz = center.z - entity.getZ();
double distanceSqr = dx * dx + dy * dy + dz * dz;
if (distanceSqr < field.fieldRadiusSqr()) {
double falloff = TimeDilationMath.gaussianFalloff(Math.sqrt(distanceSqr), field.fieldRadius());
double distance = Math.sqrt(distanceSqr);
double radius = field.fieldRadius();
double falloff;
if (field.isChronosphere()) {
if (distance >= radius * 2.0D) {
continue;
}
falloff = distance <= radius
? 1.0D
: TimeDilationMath.gaussianFalloff(distance - radius, radius);
} else {
if (distanceSqr >= field.fieldRadiusSqr()) {
continue;
}
falloff = TimeDilationMath.gaussianFalloff(distance, radius);
}
if (falloff > 0.0D) {
combinedRate *= TimeDilationMath.localFieldRate(field.effectiveFieldRate(), falloff);
}
}
@@ -83,7 +83,7 @@ public final class TimeDilationManager {
private static void discoverFieldEntities(ServerLevel level, List<TimeDilationFieldEntity> fields, TrackingState tracking) {
for (TimeDilationFieldEntity field : fields) {
double radius = field.fieldRadius();
double radius = field.influenceRadius();
var center = field.position();
var area = new net.minecraft.world.phys.AABB(
center.x - radius, center.y - radius, center.z - radius,
@@ -1,43 +0,0 @@
package com.craisinlord.antarchy.content.weather;
import java.util.Optional;
public enum ThoraxisWeatherKind {
NONE("none"),
INVERSION_STORM("inversion_storm"),
BLOOD_RAIN("blood_rain"),
SANDSTORM("sandstorm");
private final String id;
ThoraxisWeatherKind(String id) {
this.id = id;
}
public String id() {
return this.id;
}
public boolean isActive() {
return this != NONE;
}
public static ThoraxisWeatherKind byId(String value) {
if (value == null) {
return NONE;
}
for (ThoraxisWeatherKind kind : values()) {
if (kind.id.equalsIgnoreCase(value)) {
return kind;
}
}
return NONE;
}
public static Optional<ThoraxisWeatherKind> parse(String value) {
ThoraxisWeatherKind kind = byId(value);
return kind == NONE ? Optional.empty() : Optional.of(kind);
}
}
@@ -1,304 +0,0 @@
package com.craisinlord.antarchy.content.weather;
import com.craisinlord.antarchy.Antarchy;
import com.craisinlord.antarchy.content.AntarchyObjects;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityDirection;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityTransition;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.BlockParticleOption;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.LightningBolt;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Blocks;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.UUID;
public final class ThoraxisWeatherManager {
private static final ResourceLocation THORAXIS_DIMENSION = ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "thoraxis");
private static final ResourceKey<Biome> THORAXIS_WASTES = ResourceKey.create(
net.minecraft.core.registries.Registries.BIOME,
ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "nightmare_wastes")
);
private static final ResourceKey<Biome> DREAM_DUNES = ResourceKey.create(
net.minecraft.core.registries.Registries.BIOME,
ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "dream_dunes")
);
private static final ResourceKey<Biome> LUCID_POOLS = ResourceKey.create(
net.minecraft.core.registries.Registries.BIOME,
ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "lucid_pools")
);
private static final int WEATHER_RECHECK_MIN_TICKS = 400;
private static final int WEATHER_RECHECK_MAX_TICKS = 900;
private static final int STORM_MIN_TICKS = 600;
private static final int STORM_MAX_TICKS = 1800;
private static final int INVERSION_STRIKE_INTERVAL = 600;
private static final int INVERSION_GRAVITY_TICKS = 220;
private static final int INVERSION_EFFECT_TICKS = 200;
private static final int WEATHER_PARTICLE_INTERVAL = 4;
private static final double WEATHER_RADIUS = 48.0D;
private static final WeakHashMap<ServerLevel, WeatherState> STATES = new WeakHashMap<>();
private ThoraxisWeatherManager() {
}
public static ThoraxisWeatherSnapshot tick(ServerLevel level) {
if (!isThoraxis(level)) {
return null;
}
WeatherState state = STATES.computeIfAbsent(level, ignored -> new WeatherState());
long now = level.getGameTime();
RandomSource random = level.getRandom();
if (state.kind.isActive()) {
runActiveWeather(level, state, now);
if (now >= state.expiresAt) {
state.clear(now + randomCooldown(random));
return snapshot(level, state);
}
return null;
}
if (now < state.nextDecisionAt) {
return null;
}
WeatherKindSelection selection = chooseWeather(level, random);
if (selection.kind == ThoraxisWeatherKind.NONE) {
state.nextDecisionAt = now + randomCooldown(random);
return null;
}
state.start(selection.kind, selection.anchor, now, now + randomDuration(random));
runActiveWeather(level, state, now);
return snapshot(level, state);
}
public static ThoraxisWeatherSnapshot snapshot(ServerLevel level) {
WeatherState state = STATES.get(level);
if (state == null) {
return new ThoraxisWeatherSnapshot(level.dimension().location(), ThoraxisWeatherKind.NONE, 0L, BlockPos.ZERO);
}
return snapshot(level, state);
}
public static ThoraxisWeatherSnapshot force(ServerLevel level, ThoraxisWeatherKind kind, BlockPos anchor, long durationTicks) {
if (!isThoraxis(level)) {
return new ThoraxisWeatherSnapshot(level.dimension().location(), ThoraxisWeatherKind.NONE, 0L, BlockPos.ZERO);
}
WeatherState state = STATES.computeIfAbsent(level, ignored -> new WeatherState());
long now = level.getGameTime();
if (kind == null || !kind.isActive()) {
state.clear(now + randomCooldown(level.getRandom()));
return snapshot(level, state);
}
long expiresAt = durationTicks <= 0L ? now + randomDuration(level.getRandom()) : now + durationTicks;
state.start(kind, anchor == null ? BlockPos.ZERO : anchor, now, expiresAt);
runActiveWeather(level, state, now);
return snapshot(level, state);
}
public static ThoraxisWeatherSnapshot clear(ServerLevel level) {
if (!isThoraxis(level)) {
return new ThoraxisWeatherSnapshot(level.dimension().location(), ThoraxisWeatherKind.NONE, 0L, BlockPos.ZERO);
}
WeatherState state = STATES.computeIfAbsent(level, ignored -> new WeatherState());
state.clear(level.getGameTime() + randomCooldown(level.getRandom()));
return snapshot(level, state);
}
private static ThoraxisWeatherSnapshot snapshot(ServerLevel level, WeatherState state) {
return new ThoraxisWeatherSnapshot(level.dimension().location(), state.kind, state.expiresAt, state.anchor);
}
private static void runActiveWeather(ServerLevel level, WeatherState state, long now) {
switch (state.kind) {
case INVERSION_STORM -> tickInversionStorm(level, state, now);
case BLOOD_RAIN -> tickBloodRain(level, state, now);
case SANDSTORM -> tickSandstorm(level, state, now);
default -> {
}
}
}
private static void tickInversionStorm(ServerLevel level, WeatherState state, long now) {
cleanupExpiredForcedInversions(level, state, now);
if (now % INVERSION_STRIKE_INTERVAL != 0L) {
return;
}
List<LivingEntity> targets = level.getEntitiesOfClass(
LivingEntity.class,
new net.minecraft.world.phys.AABB(state.anchor).inflate(WEATHER_RADIUS),
entity -> entity.isAlive() && !entity.isSpectator()
);
if (targets.isEmpty()) {
return;
}
LivingEntity target = targets.get(level.getRandom().nextInt(targets.size()));
LightningBolt bolt = EntityType.LIGHTNING_BOLT.create(level);
if (bolt != null) {
bolt.moveTo(target.getX(), target.getY() + target.getBbHeight() * 0.5D, target.getZ());
bolt.setVisualOnly(true);
level.addFreshEntity(bolt);
}
if (!AntarchyGravityApi.isGravityForced(target)) {
AntarchyGravityApi.setForcedGravityDirection(target, AntarchyGravityDirection.UP, new AntarchyGravityTransition(12));
state.forcedInversionExpiry.put(target.getUUID(), now + INVERSION_GRAVITY_TICKS);
}
target.addEffect(new MobEffectInstance(AntarchyObjects.INVERTED_EFFECT.get(), INVERSION_EFFECT_TICKS, 0, false, true, true));
}
private static void cleanupExpiredForcedInversions(ServerLevel level, WeatherState state, long now) {
Iterator<Map.Entry<UUID, Long>> iterator = state.forcedInversionExpiry.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<UUID, Long> entry = iterator.next();
if (entry.getValue() > now) {
continue;
}
LivingEntity entity = level.getEntity(entry.getKey()) instanceof LivingEntity living ? living : null;
if (entity != null && entity.isAlive() && AntarchyGravityApi.isGravityForced(entity)) {
AntarchyGravityApi.clearForcedGravity(entity);
}
iterator.remove();
}
}
private static void tickBloodRain(ServerLevel level, WeatherState state, long now) {
if (now % WEATHER_PARTICLE_INTERVAL != 0L) {
return;
}
level.sendParticles(
new BlockParticleOption(ParticleTypes.BLOCK, Blocks.RED_SAND.defaultBlockState()),
state.anchor.getX() + 0.5D,
state.anchor.getY() + 28.0D,
state.anchor.getZ() + 0.5D,
26,
18.0D,
12.0D,
18.0D,
0.12D
);
level.playSound(null, state.anchor, SoundEvents.LIGHTNING_BOLT_THUNDER, net.minecraft.sounds.SoundSource.WEATHER, 0.2F, 0.8F);
}
private static void tickSandstorm(ServerLevel level, WeatherState state, long now) {
if (now % WEATHER_PARTICLE_INTERVAL != 0L) {
return;
}
level.sendParticles(
new BlockParticleOption(ParticleTypes.BLOCK, Blocks.SAND.defaultBlockState()),
state.anchor.getX() + 0.5D,
state.anchor.getY() + 12.0D,
state.anchor.getZ() + 0.5D,
40,
14.0D,
6.0D,
14.0D,
0.10D
);
}
private static WeatherKindSelection chooseWeather(ServerLevel level, RandomSource random) {
var players = level.players();
if (players.isEmpty()) {
return WeatherKindSelection.none();
}
LivingEntity anchorEntity = players.get(random.nextInt(players.size()));
BlockPos anchor = anchorEntity.blockPosition();
var biome = level.getBiome(anchor);
if (biome.is(DREAM_DUNES)) {
return new WeatherKindSelection(ThoraxisWeatherKind.SANDSTORM, anchor);
}
if (biome.is(LUCID_POOLS)) {
return random.nextFloat() < 0.35F
? new WeatherKindSelection(ThoraxisWeatherKind.BLOOD_RAIN, anchor)
: WeatherKindSelection.none();
}
if (biome.is(THORAXIS_WASTES)) {
float roll = random.nextFloat();
if (roll < 0.58F) {
return new WeatherKindSelection(ThoraxisWeatherKind.INVERSION_STORM, anchor);
}
if (roll < 0.88F) {
return new WeatherKindSelection(ThoraxisWeatherKind.BLOOD_RAIN, anchor);
}
}
return WeatherKindSelection.none();
}
private static int randomDuration(RandomSource random) {
return STORM_MIN_TICKS + random.nextInt(STORM_MAX_TICKS - STORM_MIN_TICKS + 1);
}
private static int randomCooldown(RandomSource random) {
return WEATHER_RECHECK_MIN_TICKS + random.nextInt(WEATHER_RECHECK_MAX_TICKS - WEATHER_RECHECK_MIN_TICKS + 1);
}
private static boolean isThoraxis(ServerLevel level) {
return level.dimension().location().equals(THORAXIS_DIMENSION);
}
private record WeatherKindSelection(ThoraxisWeatherKind kind, BlockPos anchor) {
private static WeatherKindSelection none() {
return new WeatherKindSelection(ThoraxisWeatherKind.NONE, BlockPos.ZERO);
}
}
private static final class WeatherState {
private ThoraxisWeatherKind kind = ThoraxisWeatherKind.NONE;
private long expiresAt;
private long nextDecisionAt;
private long startedAt;
private BlockPos anchor = BlockPos.ZERO;
private final Map<UUID, Long> forcedInversionExpiry = new java.util.HashMap<>();
private void start(ThoraxisWeatherKind kind, BlockPos anchor, long startedAt, long expiresAt) {
this.kind = kind;
this.anchor = anchor;
this.startedAt = startedAt;
this.expiresAt = expiresAt;
this.nextDecisionAt = expiresAt;
}
private void clear(long nextDecisionAt) {
this.kind = ThoraxisWeatherKind.NONE;
this.anchor = BlockPos.ZERO;
this.expiresAt = 0L;
this.startedAt = 0L;
this.nextDecisionAt = nextDecisionAt;
this.forcedInversionExpiry.clear();
}
}
}
@@ -1,15 +0,0 @@
package com.craisinlord.antarchy.content.weather;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
public record ThoraxisWeatherSnapshot(
ResourceLocation dimension,
ThoraxisWeatherKind kind,
long expiresAt,
BlockPos anchor
) {
public boolean isActive() {
return this.kind != ThoraxisWeatherKind.NONE;
}
}
@@ -6,6 +6,7 @@ import com.craisinlord.antarchy.content.entity.royal.KingEntity;
import com.mojang.serialization.Codec;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.WorldGenLevel;
@@ -23,10 +24,14 @@ import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.WeakHashMap;
/** Places the authored King's Tree as independently generated chunk slices on a fixed world grid. */
public final class KingsTreeGridFeature extends Feature<NoneFeatureConfiguration> {
private static final Map<ServerLevel, Set<Long>> CLAIMED_TREE_KINGS = new WeakHashMap<>();
private static final int TREE_MIN_X = -191;
private static final int TREE_MAX_X = 192;
private static final int TREE_MIN_Z = -227;
@@ -110,31 +115,42 @@ public final class KingsTreeGridFeature extends Feature<NoneFeatureConfiguration
private static void spawnTreeKing(WorldGenLevel level, int centerX, int centerZ, int baseY) {
var serverLevel = level.getLevel();
Vec3 treeCenter = new Vec3(centerX + 0.5D, 0.0D, centerZ + 0.5D);
AABB searchBox = new AABB(
centerX - 512.0D, level.getMinBuildHeight(), centerZ - 512.0D,
centerX + 512.0D, level.getMaxBuildHeight(), centerZ + 512.0D);
List<KingEntity> treeKings = serverLevel.getEntitiesOfClass(KingEntity.class, searchBox,
king -> king.isAlive() && king.isTreePatrolFor(treeCenter));
if (!treeKings.isEmpty()) {
// Repair older worlds that already contain duplicate tree-bound Kings.
for (int index = 1; index < treeKings.size(); index++) {
treeKings.get(index).discard();
long treeKey = ((long) centerX << 32) ^ (centerZ & 0xffffffffL);
synchronized (serverLevel) {
synchronized (CLAIMED_TREE_KINGS) {
if (!CLAIMED_TREE_KINGS.computeIfAbsent(serverLevel, ignored -> new java.util.HashSet<>()).add(treeKey)) {
return;
}
}
return;
Vec3 treeCenter = new Vec3(centerX + 0.5D, 0.0D, centerZ + 0.5D);
AABB searchBox = new AABB(
centerX - 512.0D, level.getMinBuildHeight(), centerZ - 512.0D,
centerX + 512.0D, level.getMaxBuildHeight(), centerZ + 512.0D);
List<KingEntity> treeKings = serverLevel.getEntitiesOfClass(KingEntity.class, searchBox,
king -> king.isAlive() && king.isTreePatrolFor(treeCenter));
if (!treeKings.isEmpty()) {
// Repair older worlds that already contain duplicate tree-bound Kings.
for (int index = 1; index < treeKings.size(); index++) {
treeKings.get(index).discard();
}
return;
}
KingEntity king = AntarchyObjects.KING.get().create(serverLevel);
if (king == null) {
synchronized (CLAIMED_TREE_KINGS) {
CLAIMED_TREE_KINGS.getOrDefault(serverLevel, Set.of()).remove(treeKey);
}
return;
}
double minimumY = baseY + 24.0D;
double maximumY = baseY + 304.0D;
double spawnY = (minimumY + maximumY) * 0.5D;
// Start just outside the central trunk, inside the tree's authored footprint.
king.moveTo(centerX + 48.5D, spawnY, centerZ + 0.5D, 90.0F, 0.0F);
king.setTreePatrolHome(treeCenter, minimumY, maximumY, 0.0D);
king.setPersistenceRequired();
serverLevel.addFreshEntity(king);
}
KingEntity king = AntarchyObjects.KING.get().create(serverLevel);
if (king == null) {
return;
}
double minimumY = baseY + 24.0D;
double maximumY = baseY + 304.0D;
double spawnY = (minimumY + maximumY) * 0.5D;
// Start just outside the central trunk, inside the tree's authored footprint.
king.moveTo(centerX + 48.5D, spawnY, centerZ + 0.5D, 90.0F, 0.0F);
king.setTreePatrolHome(treeCenter, minimumY, maximumY, 0.0D);
king.setPersistenceRequired();
serverLevel.addFreshEntity(king);
}
private static ResourceLocation tileLocation(int tileX, int tileZ) {
@@ -341,21 +341,18 @@ public final class ThoraxisUndersideManager {
}
/**
* Keeps projectile gravity positional: UP below Y=0 in Thoraxis and DOWN
* everywhere else. World velocity is preserved when the gravity frame changes.
* Projectiles perform their own movement in world coordinates, so they must
* not retain an inverted entity-local movement frame. Underside gravity is
* reversed separately when gravitational acceleration is applied.
*/
public static void updateProjectileGravity(Projectile projectile) {
boolean inUnderside = isInUnderside(projectile);
AntarchyGravityDirection desiredDirection = inUnderside
? AntarchyGravityDirection.UP
: AntarchyGravityDirection.DOWN;
boolean stateMismatch = AntarchyGravityApi.getGravityDirection(projectile) != desiredDirection
|| AntarchyGravityApi.isGravityForced(projectile) != inUnderside;
public static void normalizeProjectileGravityFrame(Projectile projectile) {
boolean stateMismatch = AntarchyGravityApi.getGravityDirection(projectile) != AntarchyGravityDirection.DOWN
|| AntarchyGravityApi.isGravityForced(projectile);
if (stateMismatch) {
AntarchyGravityApi.setAirborneGravityDirection(
projectile,
desiredDirection,
inUnderside,
AntarchyGravityDirection.DOWN,
false,
AntarchyGravityTransition.INSTANT
);
}
@@ -0,0 +1,40 @@
package com.craisinlord.antarchy.mixins;
import com.craisinlord.antarchy.content.enchantment.AntarchyEnchantments;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Stream;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderLookup;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.CreativeModeTabs;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(CreativeModeTabs.class)
public abstract class CreativeModeTabsEnchantmentOrderMixin {
@Redirect(
method = {"generateEnchantmentBookTypesOnlyMaxLevel", "generateEnchantmentBookTypesAllLevels"},
at = @At(value = "INVOKE", target = "Lnet/minecraft/core/HolderLookup;listElements()Ljava/util/stream/Stream;")
)
private static Stream<Holder.Reference<Enchantment>> antarchy$orderEnchantments(HolderLookup<Enchantment> lookup) {
List<Holder.Reference<Enchantment>> enchantments = lookup.listElements().toList();
List<Holder.Reference<Enchantment>> antarchyEnchantments = enchantments.stream()
.filter(CreativeModeTabsEnchantmentOrderMixin::isAntarchyEnchantment)
.sorted(Comparator.comparingInt(CreativeModeTabsEnchantmentOrderMixin::priority))
.toList();
return Stream.concat(
antarchyEnchantments.stream(),
enchantments.stream().filter(holder -> !isAntarchyEnchantment(holder))
);
}
private static boolean isAntarchyEnchantment(Holder.Reference<Enchantment> holder) {
return holder.is(AntarchyEnchantments.FEATHER_RISING) || holder.is(AntarchyEnchantments.CHRONOSPHERE);
}
private static int priority(Holder.Reference<Enchantment> holder) {
return holder.is(AntarchyEnchantments.FEATHER_RISING) ? 0 : 1;
}
}
@@ -1,47 +0,0 @@
package com.craisinlord.antarchy.mixins.client;
import com.craisinlord.antarchy.content.client.ThoraxisWeatherClientState;
import com.craisinlord.antarchy.content.weather.ThoraxisWeatherKind;
import net.minecraft.client.renderer.entity.LightningBoltRenderer;
import net.minecraft.world.entity.LightningBolt;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
@Mixin(LightningBoltRenderer.class)
public abstract class LightningBoltRendererMixin {
@Unique
private static final ThreadLocal<Boolean> antarchy$redLightning = ThreadLocal.withInitial(() -> false);
@Inject(method = "render", at = @At("HEAD"))
private void antarchy$markRedLightning(LightningBolt bolt, float entityYaw, float partialTick, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.MultiBufferSource buffer, int packedLight, CallbackInfo ci) {
ThoraxisWeatherClientState.ThoraxisWeatherState weather = ThoraxisWeatherClientState.current(bolt.level());
antarchy$redLightning.set(weather != null
&& weather.kind() == ThoraxisWeatherKind.INVERSION_STORM
&& weather.anchor().closerToCenterThan(bolt.position(), 64.0D));
}
@Inject(method = "render", at = @At("RETURN"))
private void antarchy$clearRedLightning(LightningBolt bolt, float entityYaw, float partialTick, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.MultiBufferSource buffer, int packedLight, CallbackInfo ci) {
antarchy$redLightning.remove();
}
@ModifyArgs(
method = "quad",
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/VertexConsumer;setColor(FFFF)Lcom/mojang/blaze3d/vertex/VertexConsumer;")
)
private static void antarchy$tintLightning(Args args) {
if (!Boolean.TRUE.equals(antarchy$redLightning.get())) {
return;
}
args.set(0, 0.95F);
args.set(1, 0.12F);
args.set(2, 0.12F);
args.set(3, 0.35F);
}
}
@@ -0,0 +1,23 @@
package com.craisinlord.antarchy.mixins.client;
import com.craisinlord.antarchy.content.client.renderer.TemporalContractionAfterimageLayer;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.world.entity.LivingEntity;
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;
@Mixin(LivingEntityRenderer.class)
public abstract class TemporalContractionLivingRendererMixin<T extends LivingEntity, M extends EntityModel<T>> {
@Inject(method = "<init>", at = @At("RETURN"))
private void antarchy$addTemporalContractionLayer(EntityRendererProvider.Context context, M model,
float shadowRadius, CallbackInfo callbackInfo) {
LivingEntityRenderer<T, M> renderer = (LivingEntityRenderer<T, M>) (Object) this;
renderer.addLayer(new TemporalContractionAfterimageLayer<>(renderer));
}
}
@@ -1,19 +1,15 @@
package com.craisinlord.antarchy.mixins.gravity;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi;
import com.craisinlord.antarchy.config.AntarchySettings;
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisUndersideManager;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(AbstractArrow.class)
/*
* Flips arrow gravity for inverted shooters.
* Flips arrow gravity from the arrow's current position.
*/
public abstract class AbstractArrowGravityMixin {
@@ -21,22 +17,12 @@ public abstract class AbstractArrowGravityMixin {
value = "INVOKE",
target = "Lnet/minecraft/world/entity/projectile/AbstractArrow;applyGravity()V"))
private void antarchy$applyArrowGravityUpward(AbstractArrow self, Operation<Void> original) {
Entity owner = self.getOwner();
if (!(owner instanceof LivingEntity living)) {
if (!ThoraxisUndersideManager.isInUnderside(self)) {
original.call(self);
return;
}
if (owner instanceof net.minecraft.world.entity.player.Player && !AntarchySettings.invertProjectilesFromInvertedPlayers()) {
original.call(self);
return;
}
if (!ThoraxisUndersideManager.shouldInvertInUnderside(living)) {
original.call(self);
return;
}
// Vanilla applies gravity as -getGravity(). Negate that acceleration to
// mirror the projectile's arc for the inverted Underside gravity.
// Vanilla subtracts gravity from world Y; the Underside adds it instead.
double gravity = self.getGravity();
self.setDeltaMovement(self.getDeltaMovement().add(0.0D, -gravity, 0.0D));
self.setDeltaMovement(self.getDeltaMovement().add(0.0D, gravity, 0.0D));
}
}
@@ -5,14 +5,16 @@ import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityDirection;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityRotationUtil;
import com.craisinlord.antarchy.content.portalgun.PortalGunCollisionHelper;
import java.util.ArrayList;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import java.util.List;
import java.util.TreeSet;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.MoverType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.VoxelShape;
@@ -21,7 +23,10 @@ import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@@ -36,6 +41,8 @@ public abstract class EntityMoveMixin {
private double antarchy$lastPlayerMoveY = 0.0;
@Unique
private AABB antarchy$moveStartBox;
@Unique
private Vec3 antarchy$collideWorldMovement = Vec3.ZERO;
@Inject(method = "move", at = @At("HEAD"))
private void antarchy$captureMoveStart(MoverType type, Vec3 movement, CallbackInfo ci) {
@@ -139,105 +146,119 @@ public abstract class EntityMoveMixin {
}
}
@Inject(method = "collide", at = @At("HEAD"), cancellable = true)
private void antarchy$invertedStepUp(Vec3 movement, CallbackInfoReturnable<Vec3> cir) {
Entity entity = (Entity) (Object) this;
if (!AntarchyGravityApi.isGravityInverted(entity)) {
return;
}
AABB aabb = entity.getBoundingBox();
List<VoxelShape> entityShapes = entity.level().getEntityCollisions(entity, aabb.expandTowards(movement));
Vec3 collided = movement.lengthSqr() == 0.0 ? movement : Entity.collideBoundingBox(entity, movement, aabb, entity.level(), entityShapes);
boolean movedX = movement.x != collided.x;
boolean movedY = movement.y != collided.y;
boolean movedZ = movement.z != collided.z;
boolean pressingIntoCeiling = movedY && movement.y > 0.0D;
boolean supportedByCeiling = entity.onGround()
|| !entity.level().noCollision(entity, aabb.move(0.0D, 1.0E-5D, 0.0D));
float maxUpStep = entity.maxUpStep();
if (!(maxUpStep > 0.0F) || !(pressingIntoCeiling || supportedByCeiling) || !(movedX || movedZ)) {
cir.setReturnValue(PortalGunCollisionHelper.resolveCollision(entity, aabb, movement, collided));
return;
}
AABB steppedBox = pressingIntoCeiling ? aabb.move(0.0, collided.y, 0.0) : aabb;
AABB searchBox = steppedBox.expandTowards(movement.x, -(double) maxUpStep, movement.z);
if (!pressingIntoCeiling) {
searchBox = searchBox.expandTowards(0.0, 1.0E-5D, 0.0);
}
List<VoxelShape> stepShapes = new ArrayList<>(entityShapes);
entity.level().getBlockCollisions(entity, searchBox).forEach(stepShapes::add);
float currentStepY = (float) collided.y;
float[] candidateHeights = antarchy$collectCandidateStepDownHeights(steppedBox, stepShapes, maxUpStep, currentStepY);
for (float candidate : candidateHeights) {
Vec3 stepped = Entity.collideBoundingBox(entity, new Vec3(movement.x, -(double) candidate, movement.z), steppedBox, entity.level(), stepShapes);
if (stepped.horizontalDistanceSqr() > collided.horizontalDistanceSqr()) {
double offset = steppedBox.maxY - aabb.maxY;
cir.setReturnValue(PortalGunCollisionHelper.resolveCollision(entity, aabb, movement, stepped.add(0.0, offset, 0.0)));
return;
}
}
// Exact candidate heights can still fail for composite ceiling shapes
// (notably corner stairs). Mirror the older three-phase step routine:
// move away from the ceiling, cross the obstruction, then settle back
// toward the new ceiling surface.
Vec3 awayFromCeiling = Entity.collideBoundingBox(
entity,
new Vec3(0.0D, -(double) maxUpStep, 0.0D),
steppedBox,
entity.level(),
stepShapes
);
if (awayFromCeiling.y < -1.0E-7D) {
AABB awayBox = steppedBox.move(awayFromCeiling);
Vec3 acrossStep = Entity.collideBoundingBox(
entity,
new Vec3(movement.x, 0.0D, movement.z),
awayBox,
entity.level(),
stepShapes
);
if (acrossStep.horizontalDistanceSqr() > collided.horizontalDistanceSqr()) {
AABB acrossBox = awayBox.move(acrossStep);
Vec3 settleToCeiling = Entity.collideBoundingBox(
entity,
new Vec3(0.0D, -awayFromCeiling.y, 0.0D),
acrossBox,
entity.level(),
stepShapes
);
double initialVerticalOffset = steppedBox.maxY - aabb.maxY;
Vec3 stepped = acrossStep.add(
0.0D,
initialVerticalOffset + awayFromCeiling.y + settleToCeiling.y,
0.0D
);
cir.setReturnValue(PortalGunCollisionHelper.resolveCollision(entity, aabb, movement, stepped));
return;
}
}
cir.setReturnValue(PortalGunCollisionHelper.resolveCollision(entity, aabb, movement, collided));
@Inject(method = "collide", at = @At("HEAD"))
private void antarchy$captureCollideWorldMovement(Vec3 movement, CallbackInfoReturnable<Vec3> cir) {
this.antarchy$collideWorldMovement = movement;
}
@Unique
private static float[] antarchy$collectCandidateStepDownHeights(AABB box, List<VoxelShape> shapes, float maxStep, float currentY) {
/*
* Keep vanilla's step algorithm in player-local coordinates. Its Y tests,
* candidate heights and maxUpStep are all defined in that frame. Only the
* physical AABB operations and low-level shape collision belong in world
* coordinates.
*/
@ModifyVariable(
method = "collide",
at = @At(
value = "INVOKE_ASSIGN",
target = "Lnet/minecraft/world/level/Level;getEntityCollisions(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/AABB;)Ljava/util/List;",
ordinal = 0
),
ordinal = 0
)
private Vec3 antarchy$collideWorldToPlayer(Vec3 movement) {
Entity entity = (Entity) (Object) this;
AntarchyGravityDirection direction = AntarchyGravityApi.getGravityDirection(entity);
if (!direction.isInverted()) {
return movement;
}
return AntarchyGravityRotationUtil.vecWorldToPlayer(movement, direction);
}
@ModifyArgs(
method = "collide",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/phys/AABB;expandTowards(DDD)Lnet/minecraft/world/phys/AABB;"
)
)
private void antarchy$expandStepSearchInWorldFrame(Args args) {
Entity entity = (Entity) (Object) this;
AntarchyGravityDirection direction = AntarchyGravityApi.getGravityDirection(entity);
if (!direction.isInverted()) {
return;
}
Vec3 world = AntarchyGravityRotationUtil.vecPlayerToWorld(
new Vec3(args.get(0), args.get(1), args.get(2)), direction);
args.set(0, world.x);
args.set(1, world.y);
args.set(2, world.z);
}
@ModifyArgs(
method = "collide",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/phys/AABB;move(DDD)Lnet/minecraft/world/phys/AABB;"
)
)
private void antarchy$moveStepBoxInWorldFrame(Args args) {
Entity entity = (Entity) (Object) this;
AntarchyGravityDirection direction = AntarchyGravityApi.getGravityDirection(entity);
if (!direction.isInverted()) {
return;
}
Vec3 world = AntarchyGravityRotationUtil.vecPlayerToWorld(
new Vec3(args.get(0), args.get(1), args.get(2)), direction);
args.set(0, world.x);
args.set(1, world.y);
args.set(2, world.z);
}
@WrapOperation(
method = "collide",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/Entity;collideBoundingBox(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/phys/AABB;Lnet/minecraft/world/level/Level;Ljava/util/List;)Lnet/minecraft/world/phys/Vec3;"
)
)
private Vec3 antarchy$collideBoundingBoxInLocalFrame(
Entity collisionEntity,
Vec3 localMovement,
AABB box,
Level level,
List<VoxelShape> collisions,
Operation<Vec3> original
) {
AntarchyGravityDirection direction = AntarchyGravityApi.getGravityDirection(collisionEntity);
if (!direction.isInverted()) {
return original.call(collisionEntity, localMovement, box, level, collisions);
}
Vec3 worldMovement = AntarchyGravityRotationUtil.vecPlayerToWorld(localMovement, direction);
Vec3 worldResult = original.call(collisionEntity, worldMovement, box, level, collisions);
return AntarchyGravityRotationUtil.vecWorldToPlayer(worldResult, direction);
}
@Redirect(
method = "collide",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/Entity;collectCandidateStepUpHeights(Lnet/minecraft/world/phys/AABB;Ljava/util/List;FF)[F"
)
)
private float[] antarchy$collectGravityAwareStepHeights(
AABB box, List<VoxelShape> shapes, float maxStep, float currentY) {
Entity entity = (Entity) (Object) this;
boolean inverted = AntarchyGravityApi.isGravityInverted(entity);
TreeSet<Float> heights = new TreeSet<>();
for (VoxelShape shape : shapes) {
for (double coord : shape.getCoords(Direction.Axis.Y)) {
float height = (float) (box.maxY - coord);
float height = (float) (inverted ? box.maxY - coord : coord - box.minY);
if (height >= 0.0F && height != currentY && height <= maxStep) {
heights.add(height);
}
}
}
float[] result = new float[heights.size()];
int i = 0;
for (float height : heights) {
@@ -246,6 +267,34 @@ public abstract class EntityMoveMixin {
return result;
}
@Redirect(
method = "collide",
at = @At(value = "FIELD", target = "Lnet/minecraft/world/phys/AABB;minY:D")
)
private double antarchy$readLocalStepBase(AABB box) {
Entity entity = (Entity) (Object) this;
if (!AntarchyGravityApi.isGravityInverted(entity)) {
return box.minY;
}
return -box.maxY;
}
@Inject(method = "collide", at = @At("RETURN"), cancellable = true)
private void antarchy$collidePlayerToWorld(Vec3 movement, CallbackInfoReturnable<Vec3> cir) {
Entity entity = (Entity) (Object) this;
AntarchyGravityDirection direction = AntarchyGravityApi.getGravityDirection(entity);
if (!direction.isInverted()) {
return;
}
Vec3 worldResult = AntarchyGravityRotationUtil.vecPlayerToWorld(cir.getReturnValue(), direction);
cir.setReturnValue(PortalGunCollisionHelper.resolveCollision(
entity,
entity.getBoundingBox(),
this.antarchy$collideWorldMovement,
worldResult
));
}
@Unique
private boolean antarchy$intersectsAntiwater(Entity entity, AABB box) {
BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
@@ -0,0 +1,31 @@
package com.craisinlord.antarchy.mixins.gravity;
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisUndersideManager;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.projectile.Projectile;
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;
@Mixin(Entity.class)
/*
* Entity declares applyGravity in 1.21.1. Restrict the reversed acceleration to
* projectiles that are physically inside the Thoraxis Underside.
*/
public abstract class EntityProjectileGravityMixin {
@Inject(method = "applyGravity", at = @At("HEAD"), cancellable = true)
private void antarchy$applyProjectileGravityUpward(CallbackInfo ci) {
Entity self = (Entity) (Object) this;
if (!(self instanceof Projectile projectile)
|| !ThoraxisUndersideManager.isInUnderside(projectile)) {
return;
}
projectile.setDeltaMovement(
projectile.getDeltaMovement().add(0.0D, projectile.getGravity(), 0.0D)
);
ci.cancel();
}
}
@@ -1,8 +1,14 @@
package com.craisinlord.antarchy.mixins.gravity;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityRotationUtil;
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.world.entity.Entity;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -10,9 +16,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Projectile.class)
/*
* Gives every projectile a gravity frame based on its own position in Thoraxis.
* A shooter can influence the initial aim, but cannot leave a projectile inverted
* after it exits the Underside.
* Keeps projectile movement in world space while reversing gravity and launch
* direction only inside the Thoraxis Underside.
*/
public abstract class ProjectileGravityMixin {
@@ -26,11 +31,39 @@ public abstract class ProjectileGravityMixin {
float inaccuracy,
CallbackInfo ci
) {
ThoraxisUndersideManager.updateProjectileGravity((Projectile) (Object) this);
ThoraxisUndersideManager.normalizeProjectileGravityFrame((Projectile) (Object) this);
}
@Inject(method = "tick", at = @At("HEAD"))
private void antarchy$updateUndersideGravity(CallbackInfo ci) {
ThoraxisUndersideManager.updateProjectileGravity((Projectile) (Object) this);
private void antarchy$keepWorldMovementFrame(CallbackInfo ci) {
ThoraxisUndersideManager.normalizeProjectileGravityFrame((Projectile) (Object) this);
}
@WrapOperation(
method = "shootFromRotation",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/projectile/Projectile;shoot(DDDFF)V"
)
)
private void antarchy$rotateUndersideLaunchDirection(
Projectile projectile,
double x,
double y,
double z,
float velocity,
float inaccuracy,
Operation<Void> original,
@Local(argsOnly = true) Entity shooter
) {
Vec3 direction = new Vec3(x, y, z);
if (ThoraxisUndersideManager.shouldInvertInUnderside(shooter)) {
direction = AntarchyGravityRotationUtil.vecPlayerToWorld(
direction,
AntarchyGravityApi.getGravityDirection(shooter)
);
}
original.call(projectile, direction.x, direction.y, direction.z, velocity, inaccuracy);
}
}
@@ -1,20 +1,15 @@
package com.craisinlord.antarchy.mixins.gravity;
import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi;
import com.craisinlord.antarchy.config.AntarchySettings;
import com.craisinlord.antarchy.content.worldgen.thoraxis.ThoraxisUndersideManager;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.ThrowableProjectile;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(ThrowableProjectile.class)
/*
* Flips thrown projectile gravity for inverted shooters.
* Flips thrown projectile gravity from the projectile's current position.
*/
public abstract class ThrowableProjectileGravityMixin {
@@ -22,22 +17,12 @@ public abstract class ThrowableProjectileGravityMixin {
value = "INVOKE",
target = "Lnet/minecraft/world/entity/projectile/ThrowableProjectile;applyGravity()V"))
private void antarchy$applyThrownProjectileGravityUpward(ThrowableProjectile self, Operation<Void> original) {
Entity owner = self.getOwner();
if (!(owner instanceof LivingEntity living)) {
if (!ThoraxisUndersideManager.isInUnderside(self)) {
original.call(self);
return;
}
if (owner instanceof Player && !AntarchySettings.invertProjectilesFromInvertedPlayers()) {
original.call(self);
return;
}
if (!ThoraxisUndersideManager.shouldInvertInUnderside(living)) {
original.call(self);
return;
}
// Vanilla applies gravity as -getGravity(). Negate that acceleration to
// mirror the projectile's arc for the inverted Underside gravity.
// Vanilla subtracts gravity from world Y; the Underside adds it instead.
double gravity = self.getGravity();
self.setDeltaMovement(self.getDeltaMovement().add(0.0D, -gravity, 0.0D));
self.setDeltaMovement(self.getDeltaMovement().add(0.0D, gravity, 0.0D));
}
}
@@ -38,6 +38,7 @@
"MinecartItemMixin",
"GoopedStepSoundMixin",
"ExperimentalSettingsLevelSummaryMixin",
"CreativeModeTabsEnchantmentOrderMixin",
"NightmareSwordDamageMixin",
"NightmareArmorEffectImmunityMixin",
"PotionBrewingMixin",
@@ -63,6 +64,7 @@
"gravity.EntityGravityFrameMixin",
"gravity.EntityGravityMixin",
"gravity.EntityMoveMixin",
"gravity.EntityProjectileGravityMixin",
"gravity.ExplosionGravityMixin",
"gravity.FallingBlockEntityBlockDataMixin",
"gravity.FireworkRocketGravityMixin",
@@ -128,7 +130,6 @@
"client.InventoryScreenRotationBypassMixin",
"client.ExperimentalSettingsPopupMixin",
"client.KrakensGraspChargePoseMixin",
"client.LightningBoltRendererMixin",
"client.MountedVehicleCameraMixin",
"client.ParalyzedMouseTurnMixin",
"client.LocalPlayerPortalMixin",
@@ -140,6 +141,7 @@
"client.ThoraxisFogMixin",
"client.TigerEyeArmorHideMixin",
"client.TigerEyeNameTagHideMixin",
"client.TemporalContractionLivingRendererMixin",
"client.WolfRendererGrimMixin",
"gravity.client.CameraGravityMixin",
"gravity.client.ClientPacketListenerGravityMixin",
@@ -1,10 +1,10 @@
{
"variants": {
"trial_spawner_state=inactive": {"model": "antarchy:block/undertrial_spawner_inactive", "x": 90},
"trial_spawner_state=waiting_for_players": {"model": "antarchy:block/undertrial_spawner_inactive", "x": 90},
"trial_spawner_state=active": {"model": "antarchy:block/undertrial_spawner_active", "x": 90},
"trial_spawner_state=waiting_for_reward_ejection": {"model": "antarchy:block/undertrial_spawner_active", "x": 90},
"trial_spawner_state=ejecting_reward": {"model": "antarchy:block/undertrial_spawner_ejecting_reward", "x": 90},
"trial_spawner_state=cooldown": {"model": "antarchy:block/undertrial_spawner_inactive", "x": 90}
"trial_spawner_state=inactive": {"model": "antarchy:block/undertrial_spawner_inactive", "x": 180},
"trial_spawner_state=waiting_for_players": {"model": "antarchy:block/undertrial_spawner_inactive", "x": 180},
"trial_spawner_state=active": {"model": "antarchy:block/undertrial_spawner_active", "x": 180},
"trial_spawner_state=waiting_for_reward_ejection": {"model": "antarchy:block/undertrial_spawner_active", "x": 180},
"trial_spawner_state=ejecting_reward": {"model": "antarchy:block/undertrial_spawner_ejecting_reward", "x": 180},
"trial_spawner_state=cooldown": {"model": "antarchy:block/undertrial_spawner_inactive", "x": 180}
}
}
@@ -5,24 +5,24 @@
"vault_state=inactive,under_facing=east": {"model": "antarchy:block/undervault_off", "y": 90},
"vault_state=inactive,under_facing=west": {"model": "antarchy:block/undervault_off", "y": 270},
"vault_state=inactive,under_facing=up": {"model": "antarchy:block/undervault_off", "x": 270},
"vault_state=inactive,under_facing=down": {"model": "antarchy:block/undervault_off", "x": 90},
"vault_state=inactive,under_facing=down": {"model": "antarchy:block/undervault_off", "x": 180},
"vault_state=active,under_facing=north": {"model": "antarchy:block/undervault_on"},
"vault_state=active,under_facing=south": {"model": "antarchy:block/undervault_on", "y": 180},
"vault_state=active,under_facing=east": {"model": "antarchy:block/undervault_on", "y": 90},
"vault_state=active,under_facing=west": {"model": "antarchy:block/undervault_on", "y": 270},
"vault_state=active,under_facing=up": {"model": "antarchy:block/undervault_on", "x": 270},
"vault_state=active,under_facing=down": {"model": "antarchy:block/undervault_on", "x": 90},
"vault_state=active,under_facing=down": {"model": "antarchy:block/undervault_on", "x": 180},
"vault_state=unlocking,under_facing=north": {"model": "antarchy:block/undervault_on"},
"vault_state=unlocking,under_facing=south": {"model": "antarchy:block/undervault_on", "y": 180},
"vault_state=unlocking,under_facing=east": {"model": "antarchy:block/undervault_on", "y": 90},
"vault_state=unlocking,under_facing=west": {"model": "antarchy:block/undervault_on", "y": 270},
"vault_state=unlocking,under_facing=up": {"model": "antarchy:block/undervault_on", "x": 270},
"vault_state=unlocking,under_facing=down": {"model": "antarchy:block/undervault_on", "x": 90},
"vault_state=unlocking,under_facing=down": {"model": "antarchy:block/undervault_on", "x": 180},
"vault_state=ejecting,under_facing=north": {"model": "antarchy:block/undervault_ejecting"},
"vault_state=ejecting,under_facing=south": {"model": "antarchy:block/undervault_ejecting", "y": 180},
"vault_state=ejecting,under_facing=east": {"model": "antarchy:block/undervault_ejecting", "y": 90},
"vault_state=ejecting,under_facing=west": {"model": "antarchy:block/undervault_ejecting", "y": 270},
"vault_state=ejecting,under_facing=up": {"model": "antarchy:block/undervault_ejecting", "x": 270},
"vault_state=ejecting,under_facing=down": {"model": "antarchy:block/undervault_ejecting", "x": 90}
"vault_state=ejecting,under_facing=down": {"model": "antarchy:block/undervault_ejecting", "x": 180}
}
}
@@ -8,5 +8,7 @@
{"type":"minecraft:item","name":"antarchy:blood_crystal_shard","weight":9,"functions":[{"function":"minecraft:set_count","count":{"type":"minecraft:uniform","min":1,"max":3}}]},
{"type":"minecraft:item","name":"antarchy:blood_crystal_apple","weight":15,"functions":[{"function":"minecraft:set_count","count":{"type":"minecraft:uniform","min":1,"max":2}}]},
{"type":"minecraft:item","name":"minecraft:potion","weight":8,"functions":[{"function":"minecraft:set_potion","id":"antarchy:inversion"}]},
{"type":"minecraft:item","name":"minecraft:potion","weight":6,"functions":[{"function":"minecraft:set_potion","id":"antarchy:time_contraction"}]},
{"type":"minecraft:item","name":"minecraft:potion","weight":6,"functions":[{"function":"minecraft:set_potion","id":"antarchy:time_dilation"}]},
{"type":"minecraft:item","name":"minecraft:book","weight":6,"functions":[{"function":"minecraft:enchant_randomly","options":["minecraft:mending","minecraft:unbreaking","minecraft:efficiency"]}]}
]}],"random_sequence":"antarchy:chests/underside_ruins/generic"}
@@ -8,6 +8,7 @@
{"type":"minecraft:item","name":"minecraft:diamond_pickaxe","weight":8,"functions":[{"function":"minecraft:enchant_with_levels","levels":{"type":"minecraft:uniform","min":18,"max":30},"options":"#minecraft:on_random_loot"}]},
{"type":"minecraft:item","name":"minecraft:book","weight":10,"functions":[{"function":"minecraft:enchant_randomly","options":["minecraft:mending","minecraft:unbreaking","minecraft:efficiency","minecraft:protection","antarchy:feather_rising","antarchy:chronosphere"]}]},
{"type":"minecraft:item","name":"minecraft:tipped_arrow","weight":7,"functions":[{"function":"minecraft:set_count","count":{"type":"minecraft:uniform","min":4,"max":10}},{"function":"minecraft:set_potion","id":"antarchy:inversion"}]},
{"type":"minecraft:item","name":"minecraft:potion","weight":7,"functions":[{"function":"minecraft:set_potion","id":"antarchy:inversion"}]},
{"type":"minecraft:item","name":"minecraft:potion","weight":6,"functions":[{"function":"minecraft:set_potion","id":"antarchy:time_contraction"}]},
{"type":"minecraft:item","name":"minecraft:potion","weight":6,"functions":[{"function":"minecraft:set_potion","id":"antarchy:time_dilation"}]},
{"type":"minecraft:item","name":"antarchy:titanium_ingot","weight":1},{"type":"minecraft:item","name":"antarchy:uranium_ingot","weight":1}
]}],"random_sequence":"antarchy:chests/underside_ruins/treasure"}
@@ -0,0 +1,135 @@
{
"type": "minecraft:chest",
"pools": [
{
"rolls": {
"type": "minecraft:uniform",
"min": 4,
"max": 6
},
"entries": [
{
"type": "minecraft:item",
"name": "antarchy:ultimate_helmet",
"weight": 2
},
{
"type": "minecraft:item",
"name": "antarchy:ultimate_chestplate",
"weight": 2
},
{
"type": "minecraft:item",
"name": "antarchy:ultimate_leggings",
"weight": 2
},
{
"type": "minecraft:item",
"name": "antarchy:ultimate_boots",
"weight": 2
},
{
"type": "minecraft:item",
"name": "antarchy:ultimate_sword",
"weight": 2
},
{
"type": "minecraft:item",
"name": "antarchy:ultimate_pickaxe",
"weight": 2
},
{
"type": "minecraft:item",
"name": "antarchy:ultimate_axe",
"weight": 2
},
{
"type": "minecraft:item",
"name": "antarchy:ultimate_shovel",
"weight": 2
},
{
"type": "minecraft:item",
"name": "antarchy:ultimate_hoe",
"weight": 2
},
{
"type": "minecraft:item",
"name": "antarchy:ultimate_bow",
"weight": 2
},
{
"type": "minecraft:item",
"name": "antarchy:ultimate_crossbow",
"weight": 2
},
{
"type": "minecraft:item",
"name": "minecraft:potion",
"weight": 8,
"functions": [
{
"function": "minecraft:set_potion",
"id": "antarchy:time_contraction"
}
]
},
{
"type": "minecraft:item",
"name": "minecraft:potion",
"weight": 8,
"functions": [
{
"function": "minecraft:set_potion",
"id": "antarchy:time_dilation"
}
]
},
{
"type": "minecraft:item",
"name": "minecraft:book",
"weight": 4,
"functions": [
{
"function": "minecraft:enchant_randomly",
"options": [
"antarchy:chronosphere"
]
}
]
},
{
"type": "minecraft:item",
"name": "antarchy:queen_scale",
"weight": 1
},
{
"type": "minecraft:item",
"name": "minecraft:netherite_scrap",
"weight": 4,
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 1,
"max": 3
}
}
]
},
{
"type": "minecraft:item",
"name": "antarchy:titanium_block",
"weight": 3
},
{
"type": "minecraft:item",
"name": "antarchy:uranium_block",
"weight": 3
}
]
}
],
"random_sequence": "antarchy:chests/undertrial_vault"
}
@@ -3,5 +3,5 @@
{"type":"minecraft:item","name":"antarchy:blood_crystal_katana","weight":4},{"type":"minecraft:item","name":"antarchy:blood_crystal_chestplate","weight":2},{"type":"minecraft:item","name":"antarchy:blood_crystal_leggings","weight":2},{"type":"minecraft:item","name":"antarchy:lucid_pearl","weight":4},
{"type":"minecraft:item","name":"antarchy:bluestone","weight":14,"functions":[{"function":"minecraft:set_count","count":{"type":"minecraft:uniform","min":8,"max":20}}]},{"type":"minecraft:item","name":"antarchy:nyxite","weight":10,"functions":[{"function":"minecraft:set_count","count":{"type":"minecraft:uniform","min":3,"max":8}}]},
{"type":"minecraft:item","name":"antarchy:blood_crystal_apple","weight":20,"functions":[{"function":"minecraft:set_count","count":{"type":"minecraft:uniform","min":1,"max":3}}]},
{"type":"minecraft:item","name":"minecraft:tipped_arrow","weight":8,"functions":[{"function":"minecraft:set_count","count":{"type":"minecraft:uniform","min":4,"max":10}},{"function":"minecraft:set_potion","id":"antarchy:inversion"}]},{"type":"minecraft:item","name":"minecraft:potion","weight":8,"functions":[{"function":"minecraft:set_potion","id":"antarchy:inversion"}]},{"type":"minecraft:item","name":"minecraft:book","weight":10,"functions":[{"function":"minecraft:enchant_randomly","options":["minecraft:mending","minecraft:unbreaking","minecraft:efficiency","minecraft:fortune","antarchy:feather_rising","antarchy:chronosphere"]}]},{"type":"minecraft:item","name":"antarchy:titanium_ingot","weight":1},{"type":"minecraft:item","name":"antarchy:uranium_ingot","weight":1}
{"type":"minecraft:item","name":"minecraft:tipped_arrow","weight":8,"functions":[{"function":"minecraft:set_count","count":{"type":"minecraft:uniform","min":4,"max":10}},{"function":"minecraft:set_potion","id":"antarchy:inversion"}]},{"type":"minecraft:item","name":"minecraft:potion","weight":8,"functions":[{"function":"minecraft:set_potion","id":"antarchy:inversion"}]},{"type":"minecraft:item","name":"minecraft:potion","weight":6,"functions":[{"function":"minecraft:set_potion","id":"antarchy:time_contraction"}]},{"type":"minecraft:item","name":"minecraft:potion","weight":6,"functions":[{"function":"minecraft:set_potion","id":"antarchy:time_dilation"}]},{"type":"minecraft:item","name":"minecraft:book","weight":10,"functions":[{"function":"minecraft:enchant_randomly","options":["minecraft:mending","minecraft:unbreaking","minecraft:efficiency","minecraft:fortune","antarchy:feather_rising","antarchy:chronosphere"]}]},{"type":"minecraft:item","name":"antarchy:titanium_ingot","weight":1},{"type":"minecraft:item","name":"antarchy:uranium_ingot","weight":1}
]}],"random_sequence":"antarchy:spawners/underside_ruins/hard"}
@@ -5,5 +5,5 @@
{"type":"minecraft:item","name":"antarchy:bluestone","weight":15,"functions":[{"function":"minecraft:set_count","count":{"type":"minecraft:uniform","min":5,"max":14}}]},
{"type":"minecraft:item","name":"antarchy:nyxite","weight":10,"functions":[{"function":"minecraft:set_count","count":{"type":"minecraft:uniform","min":1,"max":4}}]},
{"type":"minecraft:item","name":"antarchy:blood_crystal_apple","weight":18,"functions":[{"function":"minecraft:set_count","count":{"type":"minecraft:uniform","min":1,"max":2}}]},
{"type":"minecraft:item","name":"minecraft:potion","weight":9,"functions":[{"function":"minecraft:set_potion","id":"antarchy:inversion"}]},{"type":"minecraft:item","name":"minecraft:book","weight":7,"functions":[{"function":"minecraft:enchant_randomly","options":["minecraft:mending","minecraft:unbreaking","minecraft:efficiency"]}]}
{"type":"minecraft:item","name":"minecraft:potion","weight":9,"functions":[{"function":"minecraft:set_potion","id":"antarchy:inversion"}]},{"type":"minecraft:item","name":"minecraft:potion","weight":6,"functions":[{"function":"minecraft:set_potion","id":"antarchy:time_contraction"}]},{"type":"minecraft:item","name":"minecraft:potion","weight":6,"functions":[{"function":"minecraft:set_potion","id":"antarchy:time_dilation"}]},{"type":"minecraft:item","name":"minecraft:book","weight":7,"functions":[{"function":"minecraft:enchant_randomly","options":["minecraft:mending","minecraft:unbreaking","minecraft:efficiency"]}]}
]}],"random_sequence":"antarchy:spawners/underside_ruins/medium"}
@@ -0,0 +1,76 @@
{
"type": "minecraft:chest",
"pools": [
{
"rolls": {
"type": "minecraft:uniform",
"min": 2,
"max": 4
},
"entries": [
{
"type": "minecraft:item",
"name": "antarchy:undertrial_key",
"weight": 2
},
{
"type": "minecraft:item",
"name": "minecraft:potion",
"weight": 8,
"functions": [
{
"function": "minecraft:set_potion",
"id": "antarchy:time_dilation"
}
]
},
{
"type": "minecraft:item",
"name": "antarchy:cornea_stalk",
"weight": 8,
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 1,
"max": 3
}
}
]
},
{
"type": "minecraft:item",
"name": "antarchy:bluestone",
"weight": 10,
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 2,
"max": 8
}
}
]
},
{
"type": "minecraft:item",
"name": "minecraft:diamond",
"weight": 4,
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 1,
"max": 2
}
}
]
}
]
}
],
"random_sequence": "antarchy:spawners/undertrial"
}
@@ -2,6 +2,11 @@
"replace": false,
"values": [
"antarchy:lucid",
"antarchy:reverie"
"antarchy:reverie",
"antarchy:scorpion",
"antarchy:bed_bug",
"antarchy:queen",
"antarchy:princess",
"antarchy:manticore"
]
}
@@ -6,8 +6,7 @@
"antarchy:lucid",
"antarchy:reverie",
"antarchy:bed_bug",
"antarchy:crawling_blight",
"antarchy:skulking_fright",
"antarchy:springbug"
"antarchy:scorpion",
"antarchy:emperor_scorpion"
]
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"antarchy:dream_dunes"
]
}
@@ -0,0 +1,27 @@
{
"type": "integrated_api:ceiling_structure",
"start_pool": "antarchy:underside_castle/underside_castle",
"size": 1,
"y_allowance": {
"min_y_allowed": -256,
"max_y_allowed": 24
},
"valid_biome_radius_check": 1,
"biomes": "#antarchy:has_structure/underside_castle_biomes",
"step": "underground_structures",
"enhanced_terrain_adaptation": {
"type": "integrated_api:none"
},
"start_height": {
"type": "minecraft:constant",
"value": {
"absolute": -128
}
},
"max_roof_search_distance": 256,
"min_roof_thickness": 3,
"min_open_space_below": 16,
"ceiling_offset": 0,
"spawn_overrides": {},
"liquid_settings": "ignore_waterlogging"
}
@@ -2,6 +2,10 @@
"structures": [
{
"structure": "antarchy:underside_ruins",
"weight": 2
},
{
"structure": "antarchy:underside_castle",
"weight": 1
}
],
@@ -0,0 +1,42 @@
{
"name": "antarchy:underside_castle/underside_castle",
"fallback": "minecraft:empty",
"elements": [
{
"weight": 1,
"element": {
"location": "antarchy:underside_castle/underside_castle1",
"processors": "antarchy:generic_processor",
"projection": "rigid",
"element_type": "integrated_api:integrated_api_single_pool_element"
}
},
{
"weight": 1,
"element": {
"location": "antarchy:underside_castle/underside_castle2",
"processors": "antarchy:generic_processor",
"projection": "rigid",
"element_type": "integrated_api:integrated_api_single_pool_element"
}
},
{
"weight": 1,
"element": {
"location": "antarchy:underside_castle/underside_castle3",
"processors": "antarchy:generic_processor",
"projection": "rigid",
"element_type": "integrated_api:integrated_api_single_pool_element"
}
},
{
"weight": 1,
"element": {
"location": "antarchy:underside_castle/underside_castle4",
"processors": "antarchy:generic_processor",
"projection": "rigid",
"element_type": "integrated_api:integrated_api_single_pool_element"
}
}
]
}
@@ -73,6 +73,15 @@
"projection": "rigid",
"element_type": "integrated_api:integrated_api_single_pool_element"
}
},
{
"weight": 1,
"element": {
"location": "antarchy:underside_ruins/underside_ruins9",
"processors": "antarchy:generic_processor",
"projection": "rigid",
"element_type": "integrated_api:integrated_api_single_pool_element"
}
}
]
}
@@ -6,6 +6,7 @@
"antarchy:blood_crystal_chestplate",
"antarchy:primordial_chestplate",
"antarchy:royal_guardian_chestplate",
"antarchy:royal_assailant_chestplate"
"antarchy:royal_assailant_chestplate",
"antarchy:tigers_eye_chestplate"
]
}
@@ -41,6 +41,10 @@
"antarchy:royal_assailant_chestplate",
"antarchy:royal_assailant_leggings",
"antarchy:royal_assailant_boots",
"antarchy:tigers_eye_helmet",
"antarchy:tigers_eye_chestplate",
"antarchy:tigers_eye_leggings",
"antarchy:tigers_eye_boots",
"antarchy:royal_guardian_sword",
"antarchy:royal_assailant_battleaxe",
"antarchy:royal_guardian_shield",
@@ -7,6 +7,10 @@
"antarchy:brutalfly_elytra",
"antarchy:springy_boots",
"antarchy:manticore_wings",
"antarchy:tigers_eye_helmet",
"antarchy:tigers_eye_chestplate",
"antarchy:tigers_eye_leggings",
"antarchy:tigers_eye_boots",
"antarchy:royal_assailant_battleaxe"
]
}
@@ -7,6 +7,7 @@
"antarchy:primordial_boots",
"antarchy:springy_boots",
"antarchy:royal_guardian_boots",
"antarchy:royal_assailant_boots"
"antarchy:royal_assailant_boots",
"antarchy:tigers_eye_boots"
]
}
@@ -8,6 +8,7 @@
"antarchy:fallen_king_crown",
"antarchy:primordial_helmet",
"antarchy:royal_guardian_helmet",
"antarchy:royal_assailant_helmet"
"antarchy:royal_assailant_helmet",
"antarchy:tigers_eye_helmet"
]
}
@@ -6,6 +6,7 @@
"antarchy:blood_crystal_leggings",
"antarchy:primordial_leggings",
"antarchy:royal_guardian_leggings",
"antarchy:royal_assailant_leggings"
"antarchy:royal_assailant_leggings",
"antarchy:tigers_eye_leggings"
]
}
@@ -1,6 +1,7 @@
package com.craisinlord.antarchy.fabric;
import com.craisinlord.antarchy.Antarchy;
import com.craisinlord.antarchy.config.AntarchyConfigCatalog;
import com.craisinlord.antarchy.config.AntarchySettings;
import com.craisinlord.antarchy.config.ConfigResetGuard;
import com.google.gson.Gson;
@@ -19,8 +20,6 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -36,7 +35,7 @@ public final class AntarchyConfigModuleFabric {
}
public static void init() {
ConfigResetGuard.wipeIfNeeded(
ConfigResetGuard.migrateIfNeeded(
CONFIG_DIR,
ConfigSection.MOBS.path,
ConfigSection.TOOLS.path,
@@ -134,49 +133,22 @@ public final class AntarchyConfigModuleFabric {
}
private static Map<String, SettingBinding> buildBindings() {
Map<String, Method> getters = new LinkedHashMap<>();
for (Method method : AntarchySettings.class.getMethods()) {
if (!isPublicStatic(method) || method.getParameterCount() != 0 || method.getReturnType() == Void.TYPE) {
continue;
}
getters.put(method.getName(), method);
}
return Arrays.stream(AntarchySettings.class.getMethods())
.filter(AntarchyConfigModuleFabric::isPublicStatic)
.filter(method -> method.getName().startsWith("set"))
.filter(method -> method.getParameterCount() == 1)
.sorted(Comparator.comparing(Method::getName))
.collect(LinkedHashMap::new, (bindings, setter) -> {
String propertyName = decapitalize(setter.getName().substring(3));
Method getter = getters.get(propertyName);
if (getter == null) {
return;
}
if (!isSupported(setter.getParameterTypes()[0], getter.getReturnType())) {
return;
}
bindings.put(propertyName, new SettingBinding(propertyName, getter, setter, ConfigSection.forProperty(propertyName)));
}, Map::putAll);
return AntarchyConfigCatalog.definitions().stream()
.collect(LinkedHashMap::new, (bindings, definition) -> bindings.put(
definition.name(),
new SettingBinding(
definition.name(),
definition.getter(),
definition.setter(),
toConfigSection(definition.section()))), Map::putAll);
}
private static boolean isPublicStatic(Method method) {
int modifiers = method.getModifiers();
return java.lang.reflect.Modifier.isPublic(modifiers) && java.lang.reflect.Modifier.isStatic(modifiers);
}
private static boolean isSupported(Class<?> setterType, Class<?> getterType) {
if (setterType == boolean.class || setterType == int.class || setterType == double.class || setterType == float.class) {
return getterType == setterType;
}
return setterType == String.class && ResourceKey.class.isAssignableFrom(getterType);
}
private static String decapitalize(String value) {
if (value.isEmpty()) {
return value;
}
return Character.toLowerCase(value.charAt(0)) + value.substring(1);
private static ConfigSection toConfigSection(AntarchyConfigCatalog.Section section) {
return switch (section) {
case MOBS -> ConfigSection.MOBS;
case TOOLS -> ConfigSection.TOOLS;
case MISC -> ConfigSection.MISC;
};
}
/**
@@ -194,70 +166,6 @@ public final class AntarchyConfigModuleFabric {
this.path = CONFIG_DIR.resolve(fileName);
}
private static ConfigSection forProperty(String name) {
if (isMiscSetting(name)) {
return MISC;
}
if (isToolSetting(name)) {
return TOOLS;
}
return MOBS;
}
private static boolean isMiscSetting(String name) {
return name.equals("disableInfinityBookPortalCreation")
|| name.equals("rainbowAntsLeadToInfinityDimensions")
|| name.equals("permanentPortalsEnabled")
|| name.equals("permanentPortalsFlintAndSteelEnabled")
|| name.equals("elythiaPortalEnabled")
|| name.equals("thoraxisPortalEnabled")
|| name.equals("cavarynPortalEnabled")
|| name.equals("hushweedSporeLifetimeSeconds")
|| name.equals("elythiaFireflyParticlesEnabled")
|| name.equals("duplicatorTreeEnabled")
|| name.equals("glowVinesUnderLeaves")
|| name.equals("swingThroughGrassEnabled")
|| name.equals("fabricKeybindingConflictFixEnabled")
|| name.equals("experimentalSettingsPopupDisabled")
|| name.equals("entitySpecificFireOverlayEnabled")
|| name.equals("dreamSandEnabled")
|| name.startsWith("dreamSand")
|| name.equals("ichorWitherEnabled")
|| name.startsWith("diamondMinecart")
|| name.startsWith("hoverboard");
}
private static boolean isToolSetting(String name) {
return name.equals("sizeChangingRaysEnabled")
|| name.startsWith("sizeRay")
|| name.equals("shrinkingPotionDelta")
|| name.equals("growthPotionDelta")
|| name.startsWith("ultimate")
|| name.startsWith("battleAxe")
|| name.startsWith("bigBertha")
|| name.startsWith("attitudeAdjuster")
|| name.startsWith("scorpionWhip")
|| name.startsWith("bloodCrystal")
|| name.startsWith("nightmareHelmet")
|| name.startsWith("nightmareChestplate")
|| name.startsWith("nightmareLeggings")
|| name.startsWith("nightmareBoots")
|| name.startsWith("nightmareArmorDreadAura")
|| name.startsWith("primordialArmor")
|| name.startsWith("nightmareSword")
|| name.startsWith("basiliskDagger")
|| name.startsWith("squidzooka")
|| name.equals("invertProjectilesFromInvertedPlayers")
|| name.startsWith("gravityGun")
|| name.startsWith("critterCage")
|| name.startsWith("minersDream")
|| name.equals("potentNyxiteInvertedDurationSeconds")
|| name.equals("corneaEarNightVisionSeconds")
|| name.startsWith("american")
|| name.startsWith("mogglesVision")
|| name.equals("ductTapeRepairPercentPerUse")
|| name.startsWith("fallenKingCrown");
}
}
/**
@@ -56,6 +56,8 @@ import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.BlockAndTintGetter;
import com.mojang.blaze3d.vertex.VertexConsumer;
import java.util.function.Function;
import software.bernie.geckolib.animatable.GeoAnimatable;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
public final class AntarchyFabricClientBootstrap {
private AntarchyFabricClientBootstrap() {
@@ -101,21 +103,21 @@ public final class AntarchyFabricClientBootstrap {
(BlockEntityRendererProvider) UnderVaultRenderer::new
);
EntityRendererRegistry.register(AntarchyFabricEntities.EASTER_BUNNY.get(), EasterBunnyRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.FLYING_SQUIRREL.get(), FlyingSquirrelRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.CATERPILLAR.get(), CaterpillarRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.BUTTERFLY.get(), ButterflyRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.REVERIE.get(), ReverieRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.BRUTALFLY.get(), BrutalflyRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.RED_ANT.get(), AntRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.BROWN_ANT.get(), AntRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.RAINBOW_ANT.get(), AntRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.MOLEWORM.get(), MolewormRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.WORM.get(), WormRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.MANTIS.get(), MantisRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.ALPHA_MANTIS.get(), AlphaMantisRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.MOLEVORE.get(), MolevoreRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.FLYTRAP.get(), FlytrapRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.EASTER_BUNNY.get(), context -> withTemporalGeoLayer(new EasterBunnyRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.FLYING_SQUIRREL.get(), context -> withTemporalGeoLayer(new FlyingSquirrelRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.CATERPILLAR.get(), context -> withTemporalGeoLayer(new CaterpillarRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.BUTTERFLY.get(), context -> withTemporalGeoLayer(new ButterflyRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.REVERIE.get(), context -> withTemporalGeoLayer(new ReverieRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.BRUTALFLY.get(), context -> withTemporalGeoLayer(new BrutalflyRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.RED_ANT.get(), context -> withTemporalGeoLayer(new AntRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.BROWN_ANT.get(), context -> withTemporalGeoLayer(new AntRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.RAINBOW_ANT.get(), context -> withTemporalGeoLayer(new AntRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.MOLEWORM.get(), context -> withTemporalGeoLayer(new MolewormRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.WORM.get(), context -> withTemporalGeoLayer(new WormRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.MANTIS.get(), context -> withTemporalGeoLayer(new MantisRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.ALPHA_MANTIS.get(), context -> withTemporalGeoLayer(new AlphaMantisRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.MOLEVORE.get(), context -> withTemporalGeoLayer(new MolevoreRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.FLYTRAP.get(), context -> withTemporalGeoLayer(new FlytrapRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.OURANWOOD_BOAT_ENTITY.get(), context -> new OuranwoodBoatRenderer<>(context, ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "textures/entity/boat/ouranwood.png"), false));
EntityRendererRegistry.register(AntarchyFabricEntities.OURANWOOD_CHEST_BOAT_ENTITY.get(), context -> new OuranwoodBoatRenderer<>(context, ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "textures/entity/chest_boat/ouranwood.png"), true));
EntityRendererRegistry.register(AntarchyFabricEntities.PEACH_BOAT_ENTITY.get(), context -> new PeachBoatRenderer<>(context, ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "textures/entity/boat/peach.png"), false));
@@ -124,19 +126,19 @@ public final class AntarchyFabricClientBootstrap {
EntityRendererRegistry.register(AntarchyFabricEntities.NADIR_CHEST_BOAT_ENTITY.get(), context -> new PeachBoatRenderer<>(context, ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "textures/entity/chest_boat/nadir.png"), true));
EntityRendererRegistry.register(AntarchyFabricEntities.ROYAL_BOAT_ENTITY.get(), context -> new PeachBoatRenderer<>(context, ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "textures/entity/boat/royal.png"), false));
EntityRendererRegistry.register(AntarchyFabricEntities.ROYAL_CHEST_BOAT_ENTITY.get(), context -> new PeachBoatRenderer<>(context, ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "textures/entity/chest_boat/royal.png"), true));
EntityRendererRegistry.register(AntarchyFabricEntities.APPLE_COW.get(), AppleCowRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.GOLDEN_APPLE_COW.get(), AppleCowRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.ENCHANTED_GOLDEN_APPLE_COW.get(), AppleCowRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.APPLE_COW.get(), context -> withTemporalGeoLayer(new AppleCowRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.GOLDEN_APPLE_COW.get(), context -> withTemporalGeoLayer(new AppleCowRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.ENCHANTED_GOLDEN_APPLE_COW.get(), context -> withTemporalGeoLayer(new AppleCowRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.DIAMOND_MINECART.get(), DiamondMinecartRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.DR_TRAYAURUS.get(), context -> new DrTrayaurusRenderer(context, ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "textures/entity/dr_trayaurus.png")));
EntityRendererRegistry.register(AntarchyFabricEntities.STRATOSHARK.get(), StratosharkRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.KRAKEN.get(), KrakenRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.STRATOSHARK.get(), context -> withTemporalGeoLayer(new StratosharkRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.KRAKEN.get(), context -> withTemporalGeoLayer(new KrakenRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.KRAKEN_PART.get(), MultipartPartRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.TENTACLE.get(), com.craisinlord.antarchy.content.client.renderer.TentacleRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.KRAKENS_GRASP_TRIDENT.get(), com.craisinlord.antarchy.content.client.renderer.KrakensGraspThrownTridentRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.MISSILE_SQUID.get(), MissileSquidRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.OCTOPUS_BOMB.get(), OctopusBombRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.NIGHTMARE.get(), NightmareRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.MISSILE_SQUID.get(), context -> withTemporalGeoLayer(new MissileSquidRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.OCTOPUS_BOMB.get(), context -> withTemporalGeoLayer(new OctopusBombRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.NIGHTMARE.get(), context -> withTemporalGeoLayer(new NightmareRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.NIGHTMARE_PORTAL.get(), NightmarePortalRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.DIMENSIONAL_TEAR.get(), DimensionalTearRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.PORTAL_GUN_PORTAL.get(), PortalGunPortalRenderer::new);
@@ -144,12 +146,12 @@ public final class AntarchyFabricClientBootstrap {
EntityRendererRegistry.register(AntarchyFabricEntities.PORTAL_GUN_BLACK_HOLE.get(), com.craisinlord.antarchy.content.client.renderer.PortalGunBlackHoleRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.PORTAL_GUN_PROJECTILE.get(), com.craisinlord.antarchy.content.client.renderer.PortalGunProjectileRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.NIGHTMARE_BITE.get(), NightmareBiteRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.LUCID.get(), LucidRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.VORTEX.get(), VortexRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.BED_BUG.get(), BedBugRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.WASP.get(), WaspRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.BOMBER.get(), BomberRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.BASILISK.get(), BasiliskRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.LUCID.get(), context -> withTemporalGeoLayer(new LucidRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.VORTEX.get(), context -> withTemporalGeoLayer(new VortexRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.BED_BUG.get(), context -> withTemporalGeoLayer(new BedBugRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.WASP.get(), context -> withTemporalGeoLayer(new WaspRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.BOMBER.get(), context -> withTemporalGeoLayer(new BomberRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.BASILISK.get(), context -> withTemporalGeoLayer(new BasiliskRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.SHRINK_RAY_PROJECTILE.get(), SizeRayProjectileRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.GROWTH_RAY_PROJECTILE.get(), SizeRayProjectileRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.LUCID_BOLT.get(), LucidBoltRenderer::new);
@@ -164,21 +166,21 @@ public final class AntarchyFabricClientBootstrap {
EntityRendererRegistry.register(AntarchyFabricEntities.HUSH_PROJECTILE.get(), HushProjectileRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.BRUTALFLY_ORB.get(), BrutalflyOrbRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.UPWARD_FALLING_BLOCK.get(), UpwardFallingBlockRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.SCORPION.get(), ScorpionRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.EMPEROR_SCORPION.get(), EmperorScorpionRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.TORETERROR.get(), ToreterrorRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.SCORPION.get(), context -> withTemporalGeoLayer(new ScorpionRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.EMPEROR_SCORPION.get(), context -> withTemporalGeoLayer(new EmperorScorpionRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.TORETERROR.get(), context -> withTemporalGeoLayer(new ToreterrorRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.WATER_BOMB.get(), WaterBombRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.CHEEP.get(), com.craisinlord.antarchy.content.client.renderer.CheepRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.DORRIE.get(), com.craisinlord.antarchy.content.client.renderer.DorrieRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.OURANWOOD_DEER.get(), com.craisinlord.antarchy.content.client.renderer.OuranwoodDeerRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.GLIMMER.get(), com.craisinlord.antarchy.content.client.renderer.glimmer.GlimmerRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.ELKA.get(), com.craisinlord.antarchy.content.client.renderer.ElkaRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.ROLLY_POLLY.get(), com.craisinlord.antarchy.content.client.renderer.RollyPollyRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.TERMITE.get(), TermiteRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.CRAWLING_BLIGHT.get(), CrawlingBlightRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.SKULKING_FRIGHT.get(), SkulkingFrightRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.MANTICORE.get(), com.craisinlord.antarchy.content.client.renderer.ManticoreRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.HERCULES_BEETLE.get(), HerculesBeetleRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.CHEEP.get(), context -> withTemporalGeoLayer(new com.craisinlord.antarchy.content.client.renderer.CheepRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.DORRIE.get(), context -> withTemporalGeoLayer(new com.craisinlord.antarchy.content.client.renderer.DorrieRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.OURANWOOD_DEER.get(), context -> withTemporalGeoLayer(new com.craisinlord.antarchy.content.client.renderer.OuranwoodDeerRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.GLIMMER.get(), context -> withTemporalGeoLayer(new com.craisinlord.antarchy.content.client.renderer.glimmer.GlimmerRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.ELKA.get(), context -> withTemporalGeoLayer(new com.craisinlord.antarchy.content.client.renderer.ElkaRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.ROLLY_POLLY.get(), context -> withTemporalGeoLayer(new com.craisinlord.antarchy.content.client.renderer.RollyPollyRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.TERMITE.get(), context -> withTemporalGeoLayer(new TermiteRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.CRAWLING_BLIGHT.get(), context -> withTemporalGeoLayer(new CrawlingBlightRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.SKULKING_FRIGHT.get(), context -> withTemporalGeoLayer(new SkulkingFrightRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.MANTICORE.get(), context -> withTemporalGeoLayer(new com.craisinlord.antarchy.content.client.renderer.ManticoreRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.HERCULES_BEETLE.get(), context -> withTemporalGeoLayer(new HerculesBeetleRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.PRINCE.get(), com.craisinlord.antarchy.content.client.renderer.RoyalMountRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.PRINCESS.get(), com.craisinlord.antarchy.content.client.renderer.RoyalMountRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.KING.get(), com.craisinlord.antarchy.content.client.renderer.RoyalBossRenderer::new);
@@ -186,9 +188,9 @@ public final class AntarchyFabricClientBootstrap {
EntityRendererRegistry.register(AntarchyFabricEntities.ROYAL_BOLT.get(), com.craisinlord.antarchy.content.client.renderer.RoyalBoltRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.ROYAL_ELEMENTAL_PROJECTILE.get(), com.craisinlord.antarchy.content.client.renderer.RoyalElementalProjectileRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.ROYAL_ICE_SPIKE.get(), com.craisinlord.antarchy.content.client.renderer.RoyalIceSpikeRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.JERRY.get(), JerryRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.SPRINGBUG.get(), SpringbugRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.SPIT_BUG.get(), SpitBugRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.JERRY.get(), context -> withTemporalGeoLayer(new JerryRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.SPRINGBUG.get(), context -> withTemporalGeoLayer(new SpringbugRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.SPIT_BUG.get(), context -> withTemporalGeoLayer(new SpitBugRenderer(context)));
EntityRendererRegistry.register(AntarchyFabricEntities.SPIT_BUG_PROJECTILE.get(), SpitBugProjectileRenderer::new);
EntityRendererRegistry.register(AntarchyFabricEntities.STINK_BUG.get(), StinkBugRenderer::new);
@@ -198,6 +200,11 @@ public final class AntarchyFabricClientBootstrap {
EntityModelLayerRegistry.registerModelLayer(PeachBoatRenderer.chestBoatLayer(), ChestBoatModel::createBodyModel);
}
private static <T extends GeoAnimatable, R extends GeoEntityRenderer<T>> R withTemporalGeoLayer(R renderer) {
renderer.addRenderLayer(new TemporalContractionGeoLayer<>(renderer));
return renderer;
}
private static void registerColors() {
ColorProviderRegistry.BLOCK.register(
(state, level, pos, tintIndex) -> tintIndex == 0 ? bluestoneWireColor(state.getValue(com.craisinlord.antarchy.content.block.BluestoneWireBlock.POWER)) : -1,
@@ -6,12 +6,10 @@ import com.craisinlord.antarchy.content.client.HordeClientState;
import com.craisinlord.antarchy.content.client.ScorpionWhipTetherClientState;
import com.craisinlord.antarchy.content.client.WormHookTetherClientState;
import com.craisinlord.antarchy.content.client.TigerEyeCamouflageClientState;
import com.craisinlord.antarchy.content.client.ThoraxisWeatherClientState;
import com.craisinlord.antarchy.content.entity.multipart.MultipartFramework;
import com.craisinlord.antarchy.content.entity.multipart.network.MultipartAttackPayload;
import com.craisinlord.antarchy.content.entity.multipart.network.MultipartInteractPayload;
import com.craisinlord.antarchy.content.network.*;
import com.craisinlord.antarchy.content.weather.ThoraxisWeatherKind;
import com.craisinlord.antarchy.fabric.client.BloodCrystalKatanaTrailClientState;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.minecraft.resources.ResourceLocation;
@@ -52,15 +50,6 @@ public final class AntarchyFabricClientNetworking {
context.client().execute(() -> WormHookTetherClientState.update(payload.playerId(), payload.hookId())));
ClientPlayNetworking.registerGlobalReceiver(BrutalflyElytraAnimationPayload.TYPE, (payload, context) ->
context.client().execute(() -> BrutalflyElytraClientState.trigger(payload.entityId(), payload.durationTicks(), payload.strength())));
ClientPlayNetworking.registerGlobalReceiver(ThoraxisWeatherPayload.TYPE, (payload, context) ->
context.client().execute(() -> ThoraxisWeatherClientState.apply(
ResourceLocation.parse(payload.dimensionId()),
ThoraxisWeatherKind.byId(payload.weatherId()),
payload.expiresAt(),
payload.anchorX(),
payload.anchorY(),
payload.anchorZ()
)));
ClientPlayNetworking.registerGlobalReceiver(HerculesBeetleImpactShakePayload.TYPE, (payload, context) ->
context.client().execute(() -> AntarchyFabricNetworking.triggerHerculesBeetleImpactShake(payload.durationTicks())));
ClientPlayNetworking.registerGlobalReceiver(ImpactShakePayload.TYPE, (payload, context) ->
@@ -26,7 +26,6 @@ import com.craisinlord.antarchy.content.tigereye.TigerEyeCamouflageSync;
import com.craisinlord.antarchy.content.entity.DorrieEntity;
import com.craisinlord.antarchy.content.network.DorrieJumpInputPayload;
import com.craisinlord.antarchy.content.network.SpringyBootsLaunchPayload;
import com.craisinlord.antarchy.content.weather.ThoraxisWeatherSnapshot;
import com.craisinlord.antarchy.fabric.AntarchyFabricContent;
import com.craisinlord.antarchy.fabric.entity.multipart.MultipartPartEntity;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
@@ -80,7 +79,6 @@ public final class AntarchyFabricNetworking {
PayloadTypeRegistry.playS2C().register(ScorpionWhipTetherPayload.TYPE, ScorpionWhipTetherPayload.STREAM_CODEC);
PayloadTypeRegistry.playS2C().register(WormHookTetherPayload.TYPE, WormHookTetherPayload.STREAM_CODEC);
PayloadTypeRegistry.playS2C().register(BrutalflyElytraAnimationPayload.TYPE, BrutalflyElytraAnimationPayload.STREAM_CODEC);
PayloadTypeRegistry.playS2C().register(ThoraxisWeatherPayload.TYPE, ThoraxisWeatherPayload.STREAM_CODEC);
PayloadTypeRegistry.playS2C().register(HerculesBeetleImpactShakePayload.TYPE, HerculesBeetleImpactShakePayload.STREAM_CODEC);
PayloadTypeRegistry.playS2C().register(ImpactShakePayload.TYPE, ImpactShakePayload.STREAM_CODEC);
PayloadTypeRegistry.playS2C().register(HordeIntensityPayload.TYPE, HordeIntensityPayload.STREAM_CODEC);
@@ -218,20 +216,6 @@ public final class AntarchyFabricNetworking {
ServerPlayNetworking.send(player, payload);
}
public static void syncThoraxisWeather(ServerLevel level, ThoraxisWeatherSnapshot snapshot) {
ThoraxisWeatherPayload payload = new ThoraxisWeatherPayload(
snapshot.dimension(),
snapshot.kind(),
snapshot.expiresAt(),
snapshot.anchor().getX(),
snapshot.anchor().getY(),
snapshot.anchor().getZ()
);
for (ServerPlayer player : level.players()) {
ServerPlayNetworking.send(player, payload);
}
}
public static void handleGravityState(Entity contextPlayer, GravityStatePayload payload) {
Entity entity = contextPlayer.level().getEntity(payload.entityId());
if (entity == null && contextPlayer.getId() == payload.entityId()) {
@@ -18,7 +18,7 @@ public final class AntarchyConfigModuleNeoforge {
public static void init(ModContainer modContainer) {
Path configDir = FMLPaths.CONFIGDIR.get().resolve("antarchy");
ConfigResetGuard.wipeIfNeeded(
ConfigResetGuard.migrateIfNeeded(
configDir,
configDir.resolve("antarchy_mobs.toml"),
configDir.resolve("antarchy_tools.toml"),
@@ -122,6 +122,12 @@ public final class AntarchyConfigModuleNeoforge {
AntarchySettings.setEmperorScorpionDamageRange(AntarchyMobsConfig.emperorScorpionDamageRange());
AntarchySettings.setEmperorScorpionMinDespawnTicks(AntarchyMobsConfig.emperorScorpionMinDespawnTicks());
AntarchySettings.setScorpionHealth(AntarchyMobsConfig.scorpionHealth());
AntarchySettings.setScorpionAttackDamage(AntarchyMobsConfig.scorpionAttackDamage());
AntarchySettings.setScorpionMovementSpeed(AntarchyMobsConfig.scorpionMovementSpeed());
AntarchySettings.setScorpionArmor(AntarchyMobsConfig.scorpionArmor());
AntarchySettings.setScorpionKnockbackResistance(AntarchyMobsConfig.scorpionKnockbackResistance());
AntarchySettings.setKrakenHealth(AntarchyMobsConfig.krakenHealth());
AntarchySettings.setKrakenAttackDamage(AntarchyMobsConfig.krakenAttackDamage());
AntarchySettings.setKrakenSquidSpawnEnabled(AntarchyMobsConfig.krakenSquidSpawnEnabled());
@@ -253,7 +259,42 @@ public final class AntarchyConfigModuleNeoforge {
AntarchySettings.setFlytrapGrabDamage(AntarchyMobsConfig.flytrapGrabDamage());
AntarchySettings.setFlytrapSweepHitCooldownTicks(AntarchyMobsConfig.flytrapSweepHitCooldownTicks());
AntarchySettings.setCaterpillarHealth(AntarchyMobsConfig.caterpillarHealth());
AntarchySettings.setCaterpillarMovementSpeed(AntarchyMobsConfig.caterpillarMovementSpeed());
AntarchySettings.setCaterpillarPupationTimeSeconds(AntarchyMobsConfig.caterpillarPupationTimeSeconds());
AntarchySettings.setFlyingSquirrelHealth(AntarchyMobsConfig.flyingSquirrelHealth());
AntarchySettings.setFlyingSquirrelMovementSpeed(AntarchyMobsConfig.flyingSquirrelMovementSpeed());
AntarchySettings.setButterflyHealth(AntarchyMobsConfig.butterflyHealth());
AntarchySettings.setButterflyMovementSpeed(AntarchyMobsConfig.butterflyMovementSpeed());
AntarchySettings.setButterflyFlyingSpeed(AntarchyMobsConfig.butterflyFlyingSpeed());
AntarchySettings.setBedBugHealth(AntarchyMobsConfig.bedBugHealth());
AntarchySettings.setBedBugAttackDamage(AntarchyMobsConfig.bedBugAttackDamage());
AntarchySettings.setBedBugMovementSpeed(AntarchyMobsConfig.bedBugMovementSpeed());
AntarchySettings.setBedBugArmor(AntarchyMobsConfig.bedBugArmor());
AntarchySettings.setStratosharkHealth(AntarchyMobsConfig.stratosharkHealth());
AntarchySettings.setStratosharkAttackDamage(AntarchyMobsConfig.stratosharkAttackDamage());
AntarchySettings.setStratosharkMovementSpeed(AntarchyMobsConfig.stratosharkMovementSpeed());
AntarchySettings.setStratosharkFlyingSpeed(AntarchyMobsConfig.stratosharkFlyingSpeed());
AntarchySettings.setStratosharkKnockbackResistance(AntarchyMobsConfig.stratosharkKnockbackResistance());
AntarchySettings.setMissileSquidHealth(AntarchyMobsConfig.missileSquidHealth());
AntarchySettings.setMissileSquidAttackDamage(AntarchyMobsConfig.missileSquidAttackDamage());
AntarchySettings.setMissileSquidMovementSpeed(AntarchyMobsConfig.missileSquidMovementSpeed());
AntarchySettings.setMissileSquidFlyingSpeed(AntarchyMobsConfig.missileSquidFlyingSpeed());
AntarchySettings.setMissileSquidKnockbackResistance(AntarchyMobsConfig.missileSquidKnockbackResistance());
AntarchySettings.setMolewormHealth(AntarchyMobsConfig.molewormHealth());
AntarchySettings.setMolewormAttackDamage(AntarchyMobsConfig.molewormAttackDamage());
AntarchySettings.setMolewormMovementSpeed(AntarchyMobsConfig.molewormMovementSpeed());
AntarchySettings.setMolevoreHealth(AntarchyMobsConfig.molevoreHealth());
AntarchySettings.setMolevoreAttackDamage(AntarchyMobsConfig.molevoreAttackDamage());
AntarchySettings.setMolevoreSpinTicks(AntarchyMobsConfig.molevoreSpinTicks());
AntarchySettings.setMolevoreCooldownTicks(AntarchyMobsConfig.molevoreCooldownTicks());
AntarchySettings.setMolevoreChargeSpeed(AntarchyMobsConfig.molevoreChargeSpeed());
AntarchySettings.setMolevoreBreakRange(AntarchyMobsConfig.molevoreBreakRange());
AntarchySettings.setMolevoreBreakVerticalRange(AntarchyMobsConfig.molevoreBreakVerticalRange());
AntarchySettings.setMolevoreBreakHalfWidth(AntarchyMobsConfig.molevoreBreakHalfWidth());
AntarchySettings.setOctopusBombHealth(AntarchyMobsConfig.octopusBombHealth());
AntarchySettings.setOctopusBombAttackDamage(AntarchyMobsConfig.octopusBombAttackDamage());
AntarchySettings.setReverieHealth(AntarchyMobsConfig.reverieHealth());
AntarchySettings.setReverieInterestRadius(AntarchyMobsConfig.reverieInterestRadius());
@@ -278,6 +319,7 @@ public final class AntarchyConfigModuleNeoforge {
AntarchySettings.setDimensionalTearEmergenceMinIntervalTicks(AntarchyMobsConfig.dimensionalTearEmergenceMinIntervalTicks());
AntarchySettings.setDimensionalTearEmergenceMaxIntervalTicks(AntarchyMobsConfig.dimensionalTearEmergenceMaxIntervalTicks());
AntarchySettings.setDimensionalTearLucidEventChance(AntarchyMobsConfig.dimensionalTearLucidEventChance());
AntarchySettings.setDimensionalTearsSpawnNaturally(AntarchyMobsConfig.dimensionalTearsSpawnNaturally());
AntarchySettings.setBasiliskPetrifyingGazeEnabled(AntarchyMobsConfig.basiliskPetrifyingGazeEnabled());
AntarchySettings.setBasiliskSpawnMaxLightLevel(AntarchyMobsConfig.basiliskSpawnMaxLightLevel());
@@ -419,6 +461,36 @@ public final class AntarchyConfigModuleNeoforge {
AntarchySettings.setUltimateBootsArmorToughness(AntarchyToolsConfig.ultimateBootsArmorToughness());
AntarchySettings.setUltimateArmorKnockbackResistance(AntarchyToolsConfig.ultimateArmorKnockbackResistance());
AntarchySettings.setRoyalArmorComesEnchanted(AntarchyToolsConfig.royalArmorComesEnchanted());
AntarchySettings.setRoyalArmorProtectionLevel(AntarchyToolsConfig.royalArmorProtectionLevel());
AntarchySettings.setRoyalArmorEnchantability(AntarchyToolsConfig.royalArmorEnchantability());
AntarchySettings.setRoyalArmorDurabilityMultiplier(AntarchyToolsConfig.royalArmorDurabilityMultiplier());
AntarchySettings.setRoyalGuardianHelmetArmorValue(AntarchyToolsConfig.royalGuardianHelmetArmorValue());
AntarchySettings.setRoyalGuardianChestplateArmorValue(AntarchyToolsConfig.royalGuardianChestplateArmorValue());
AntarchySettings.setRoyalGuardianLeggingsArmorValue(AntarchyToolsConfig.royalGuardianLeggingsArmorValue());
AntarchySettings.setRoyalGuardianBootsArmorValue(AntarchyToolsConfig.royalGuardianBootsArmorValue());
AntarchySettings.setRoyalGuardianArmorToughness(AntarchyToolsConfig.royalGuardianArmorToughness());
AntarchySettings.setRoyalGuardianArmorKnockbackResistance(AntarchyToolsConfig.royalGuardianArmorKnockbackResistance());
AntarchySettings.setRoyalAssailantHelmetArmorValue(AntarchyToolsConfig.royalAssailantHelmetArmorValue());
AntarchySettings.setRoyalAssailantChestplateArmorValue(AntarchyToolsConfig.royalAssailantChestplateArmorValue());
AntarchySettings.setRoyalAssailantLeggingsArmorValue(AntarchyToolsConfig.royalAssailantLeggingsArmorValue());
AntarchySettings.setRoyalAssailantBootsArmorValue(AntarchyToolsConfig.royalAssailantBootsArmorValue());
AntarchySettings.setRoyalAssailantArmorToughness(AntarchyToolsConfig.royalAssailantArmorToughness());
AntarchySettings.setRoyalAssailantArmorKnockbackResistance(AntarchyToolsConfig.royalAssailantArmorKnockbackResistance());
AntarchySettings.setRoyalAssailantHelmetDoubleDamageChance(AntarchyToolsConfig.royalAssailantHelmetDoubleDamageChance());
AntarchySettings.setRoyalAssailantChestplateDoubleDamageChance(AntarchyToolsConfig.royalAssailantChestplateDoubleDamageChance());
AntarchySettings.setRoyalAssailantLeggingsDoubleDamageChance(AntarchyToolsConfig.royalAssailantLeggingsDoubleDamageChance());
AntarchySettings.setRoyalAssailantBootsDoubleDamageChance(AntarchyToolsConfig.royalAssailantBootsDoubleDamageChance());
AntarchySettings.setRoyalGuardianSwordAttackDamage(AntarchyToolsConfig.royalGuardianSwordAttackDamage());
AntarchySettings.setRoyalGuardianSwordAttackSpeed(AntarchyToolsConfig.royalGuardianSwordAttackSpeed());
AntarchySettings.setRoyalAssailantBattleAxeAttackDamage(AntarchyToolsConfig.royalAssailantBattleAxeAttackDamage());
AntarchySettings.setRoyalAssailantBattleAxeAttackSpeed(AntarchyToolsConfig.royalAssailantBattleAxeAttackSpeed());
AntarchySettings.setRoyalWeaponAttackReachBonus(AntarchyToolsConfig.royalWeaponAttackReachBonus());
AntarchySettings.setRoyalWeaponAttackKnockbackBonus(AntarchyToolsConfig.royalWeaponAttackKnockbackBonus());
AntarchySettings.setRoyalWeaponDurability(AntarchyToolsConfig.royalWeaponDurability());
AntarchySettings.setRoyalWeaponEnchantability(AntarchyToolsConfig.royalWeaponEnchantability());
AntarchySettings.setRoyalGuardianShieldDurability(AntarchyToolsConfig.royalGuardianShieldDurability());
AntarchySettings.setBattleAxeAttackDamage(AntarchyToolsConfig.battleAxeAttackDamage());
AntarchySettings.setBattleAxeAttackSpeed(AntarchyToolsConfig.battleAxeAttackSpeed());
@@ -504,6 +576,20 @@ public final class AntarchyConfigModuleNeoforge {
AntarchySettings.setGravityGunBlastStrength(AntarchyToolsConfig.gravityGunBlastStrength());
AntarchySettings.setGravityGunCooldownSeconds(AntarchyToolsConfig.gravityGunCooldownSeconds());
AntarchySettings.setGravityGunMaxHoldDistance(AntarchyToolsConfig.gravityGunMaxHoldDistance());
AntarchySettings.setEyeOfTheStormEnabled(AntarchyToolsConfig.eyeOfTheStormEnabled());
AntarchySettings.setEyeOfTheStormUpdraftCooldownTicks(AntarchyToolsConfig.eyeOfTheStormUpdraftCooldownTicks());
AntarchySettings.setEyeOfTheStormUpdraftLaunchStrength(AntarchyToolsConfig.eyeOfTheStormUpdraftLaunchStrength());
AntarchySettings.setEyeOfTheStormUpdraftHeight(AntarchyToolsConfig.eyeOfTheStormUpdraftHeight());
AntarchySettings.setEyeOfTheStormUpdraftRadius(AntarchyToolsConfig.eyeOfTheStormUpdraftRadius());
AntarchySettings.setEyeOfTheStormUpdraftDurationTicks(AntarchyToolsConfig.eyeOfTheStormUpdraftDurationTicks());
AntarchySettings.setEyeOfTheStormSurgeCooldownTicks(AntarchyToolsConfig.eyeOfTheStormSurgeCooldownTicks());
AntarchySettings.setEyeOfTheStormSurgeRange(AntarchyToolsConfig.eyeOfTheStormSurgeRange());
AntarchySettings.setEyeOfTheStormSurgeDurationTicks(AntarchyToolsConfig.eyeOfTheStormSurgeDurationTicks());
AntarchySettings.setEyeOfTheStormSurgeRadius(AntarchyToolsConfig.eyeOfTheStormSurgeRadius());
AntarchySettings.setEyeOfTheStormSurgeHeight(AntarchyToolsConfig.eyeOfTheStormSurgeHeight());
AntarchySettings.setEyeOfTheStormSurgePullStrength(AntarchyToolsConfig.eyeOfTheStormSurgePullStrength());
AntarchySettings.setEyeOfTheStormSurgeReturnStrength(AntarchyToolsConfig.eyeOfTheStormSurgeReturnStrength());
AntarchySettings.setEyeOfTheStormSurgeDamage(AntarchyToolsConfig.eyeOfTheStormSurgeDamage());
AntarchySettings.setCritterCageMaxCapturableWidth(AntarchyToolsConfig.critterCageMaxCapturableWidth());
AntarchySettings.setCritterCageMaxCapturableHeight(AntarchyToolsConfig.critterCageMaxCapturableHeight());
@@ -92,6 +92,12 @@ public final class AntarchyMobsConfig {
private static final ModConfigSpec.DoubleValue EMPEROR_SCORPION_DAMAGE_RANGE;
private static final ModConfigSpec.IntValue EMPEROR_SCORPION_MIN_DESPAWN_TICKS;
private static final ModConfigSpec.DoubleValue SCORPION_HEALTH;
private static final ModConfigSpec.DoubleValue SCORPION_ATTACK_DAMAGE;
private static final ModConfigSpec.DoubleValue SCORPION_MOVEMENT_SPEED;
private static final ModConfigSpec.DoubleValue SCORPION_ARMOR;
private static final ModConfigSpec.DoubleValue SCORPION_KNOCKBACK_RESISTANCE;
// Kraken
@@ -217,8 +223,45 @@ public final class AntarchyMobsConfig {
// Caterpillar
private static final ModConfigSpec.DoubleValue CATERPILLAR_HEALTH;
private static final ModConfigSpec.DoubleValue CATERPILLAR_MOVEMENT_SPEED;
private static final ModConfigSpec.DoubleValue CATERPILLAR_PUPATION_TIME_SECONDS;
private static final ModConfigSpec.DoubleValue FLYING_SQUIRREL_HEALTH;
private static final ModConfigSpec.DoubleValue FLYING_SQUIRREL_MOVEMENT_SPEED;
private static final ModConfigSpec.DoubleValue BUTTERFLY_HEALTH;
private static final ModConfigSpec.DoubleValue BUTTERFLY_MOVEMENT_SPEED;
private static final ModConfigSpec.DoubleValue BUTTERFLY_FLYING_SPEED;
private static final ModConfigSpec.DoubleValue BED_BUG_HEALTH;
private static final ModConfigSpec.DoubleValue BED_BUG_ATTACK_DAMAGE;
private static final ModConfigSpec.DoubleValue BED_BUG_MOVEMENT_SPEED;
private static final ModConfigSpec.DoubleValue BED_BUG_ARMOR;
private static final ModConfigSpec.DoubleValue STRATOSHARK_HEALTH;
private static final ModConfigSpec.DoubleValue STRATOSHARK_ATTACK_DAMAGE;
private static final ModConfigSpec.DoubleValue STRATOSHARK_MOVEMENT_SPEED;
private static final ModConfigSpec.DoubleValue STRATOSHARK_FLYING_SPEED;
private static final ModConfigSpec.DoubleValue STRATOSHARK_KNOCKBACK_RESISTANCE;
private static final ModConfigSpec.DoubleValue MISSILE_SQUID_HEALTH;
private static final ModConfigSpec.DoubleValue MISSILE_SQUID_ATTACK_DAMAGE;
private static final ModConfigSpec.DoubleValue MISSILE_SQUID_MOVEMENT_SPEED;
private static final ModConfigSpec.DoubleValue MISSILE_SQUID_FLYING_SPEED;
private static final ModConfigSpec.DoubleValue MISSILE_SQUID_KNOCKBACK_RESISTANCE;
private static final ModConfigSpec.DoubleValue MOLEWORM_HEALTH;
private static final ModConfigSpec.DoubleValue MOLEWORM_ATTACK_DAMAGE;
private static final ModConfigSpec.DoubleValue MOLEWORM_MOVEMENT_SPEED;
private static final ModConfigSpec.DoubleValue MOLEVORE_HEALTH;
private static final ModConfigSpec.DoubleValue MOLEVORE_ATTACK_DAMAGE;
private static final ModConfigSpec.IntValue MOLEVORE_SPIN_TICKS;
private static final ModConfigSpec.IntValue MOLEVORE_COOLDOWN_TICKS;
private static final ModConfigSpec.DoubleValue MOLEVORE_CHARGE_SPEED;
private static final ModConfigSpec.DoubleValue MOLEVORE_BREAK_RANGE;
private static final ModConfigSpec.DoubleValue MOLEVORE_BREAK_VERTICAL_RANGE;
private static final ModConfigSpec.DoubleValue MOLEVORE_BREAK_HALF_WIDTH;
private static final ModConfigSpec.DoubleValue OCTOPUS_BOMB_HEALTH;
private static final ModConfigSpec.DoubleValue OCTOPUS_BOMB_ATTACK_DAMAGE;
// Ant Dance
@@ -253,6 +296,7 @@ public final class AntarchyMobsConfig {
private static final ModConfigSpec.IntValue DIMENSIONAL_TEAR_EMERGENCE_MIN_INTERVAL_TICKS;
private static final ModConfigSpec.IntValue DIMENSIONAL_TEAR_EMERGENCE_MAX_INTERVAL_TICKS;
private static final ModConfigSpec.DoubleValue DIMENSIONAL_TEAR_LUCID_EVENT_CHANCE;
private static final ModConfigSpec.BooleanValue DIMENSIONAL_TEARS_SPAWN_NATURALLY;
// Basilisk
@@ -555,6 +599,14 @@ public final class AntarchyMobsConfig {
.defineInRange("minDespawnTicks", 6000, 0, 1000000);
b.pop();
b.push("scorpion");
SCORPION_HEALTH = b.defineInRange("health", 30.0D, 0.1D, 32768.0D);
SCORPION_ATTACK_DAMAGE = b.defineInRange("attackDamage", 5.0D, 0.0D, 1024.0D);
SCORPION_MOVEMENT_SPEED = b.defineInRange("movementSpeed", 0.29D, 0.0D, 10.0D);
SCORPION_ARMOR = b.defineInRange("armor", 2.0D, 0.0D, 1024.0D);
SCORPION_KNOCKBACK_RESISTANCE = b.defineInRange("knockbackResistance", 0.2D, 0.0D, 1.0D);
b.pop();
// Kraken
@@ -726,11 +778,69 @@ public final class AntarchyMobsConfig {
// Caterpillar
b.push("caterpillar");
CATERPILLAR_HEALTH = b.defineInRange("health", 6.0D, 0.1D, 32768.0D);
CATERPILLAR_MOVEMENT_SPEED = b.defineInRange("movementSpeed", 0.24D, 0.0D, 10.0D);
CATERPILLAR_PUPATION_TIME_SECONDS = b
.comment("Time in seconds before a caterpillar emerges from its chrysalis.")
.defineInRange("pupationTimeSeconds", 600.0D, 1.0D, 3600.0D);
b.pop();
b.push("flyingSquirrel");
FLYING_SQUIRREL_HEALTH = b.defineInRange("health", 10.0D, 0.1D, 32768.0D);
FLYING_SQUIRREL_MOVEMENT_SPEED = b.defineInRange("movementSpeed", 0.35D, 0.0D, 10.0D);
b.pop();
b.push("butterfly");
BUTTERFLY_HEALTH = b.defineInRange("health", 6.0D, 0.1D, 32768.0D);
BUTTERFLY_MOVEMENT_SPEED = b.defineInRange("movementSpeed", 0.3D, 0.0D, 10.0D);
BUTTERFLY_FLYING_SPEED = b.defineInRange("flyingSpeed", 0.55D, 0.0D, 10.0D);
b.pop();
b.push("bedBug");
BED_BUG_HEALTH = b.defineInRange("health", 18.0D, 0.1D, 32768.0D);
BED_BUG_ATTACK_DAMAGE = b.defineInRange("attackDamage", 4.0D, 0.0D, 1024.0D);
BED_BUG_MOVEMENT_SPEED = b.defineInRange("movementSpeed", 0.24D, 0.0D, 10.0D);
BED_BUG_ARMOR = b.defineInRange("armor", 2.0D, 0.0D, 1024.0D);
b.pop();
b.push("stratoshark");
STRATOSHARK_HEALTH = b.defineInRange("health", 40.0D, 0.1D, 32768.0D);
STRATOSHARK_ATTACK_DAMAGE = b.defineInRange("attackDamage", 5.0D, 0.0D, 1024.0D);
STRATOSHARK_MOVEMENT_SPEED = b.defineInRange("movementSpeed", 0.34D, 0.0D, 10.0D);
STRATOSHARK_FLYING_SPEED = b.defineInRange("flyingSpeed", 0.5D, 0.0D, 10.0D);
STRATOSHARK_KNOCKBACK_RESISTANCE = b.defineInRange("knockbackResistance", 0.2D, 0.0D, 1.0D);
b.pop();
b.push("missileSquid");
MISSILE_SQUID_HEALTH = b.defineInRange("health", 60.0D, 0.1D, 32768.0D);
MISSILE_SQUID_ATTACK_DAMAGE = b.defineInRange("attackDamage", 9.0D, 0.0D, 1024.0D);
MISSILE_SQUID_MOVEMENT_SPEED = b.defineInRange("movementSpeed", 0.84D, 0.0D, 10.0D);
MISSILE_SQUID_FLYING_SPEED = b.defineInRange("flyingSpeed", 0.84D, 0.0D, 10.0D);
MISSILE_SQUID_KNOCKBACK_RESISTANCE = b.defineInRange("knockbackResistance", 0.15D, 0.0D, 1.0D);
b.pop();
b.push("moleworm");
MOLEWORM_HEALTH = b.defineInRange("health", 8.0D, 0.1D, 32768.0D);
MOLEWORM_ATTACK_DAMAGE = b.defineInRange("attackDamage", 1.0D, 0.0D, 1024.0D);
MOLEWORM_MOVEMENT_SPEED = b.defineInRange("movementSpeed", 0.25D, 0.0D, 10.0D);
b.pop();
b.push("molevore");
MOLEVORE_HEALTH = b.defineInRange("health", 140.0D, 0.1D, 32768.0D);
MOLEVORE_ATTACK_DAMAGE = b.defineInRange("attackDamage", 10.0D, 0.0D, 1024.0D);
MOLEVORE_SPIN_TICKS = b.defineInRange("spinTicks", 12, 0, 400);
MOLEVORE_COOLDOWN_TICKS = b.defineInRange("cooldownTicks", 60, 0, 20000);
MOLEVORE_CHARGE_SPEED = b.defineInRange("chargeSpeed", 1.15D, 0.0D, 10.0D);
MOLEVORE_BREAK_RANGE = b.defineInRange("breakRange", 1.8D, 0.0D, 32.0D);
MOLEVORE_BREAK_VERTICAL_RANGE = b.defineInRange("breakVerticalRange", 2.2D, 0.0D, 32.0D);
MOLEVORE_BREAK_HALF_WIDTH = b.defineInRange("breakHalfWidth", 1.1D, 0.0D, 32.0D);
b.pop();
b.push("octopusBomb");
OCTOPUS_BOMB_HEALTH = b.defineInRange("health", 100.0D, 0.1D, 32768.0D);
OCTOPUS_BOMB_ATTACK_DAMAGE = b.defineInRange("attackDamage", 16.0D, 0.0D, 1024.0D);
b.pop();
// Ant Dance
@@ -774,6 +884,7 @@ public final class AntarchyMobsConfig {
DIMENSIONAL_TEAR_EMERGENCE_MIN_INTERVAL_TICKS = b.comment("Minimum ticks between Nightmare/Lucid emergence events per tear.").defineInRange("emergenceMinIntervalTicks", 400, 20, 240000);
DIMENSIONAL_TEAR_EMERGENCE_MAX_INTERVAL_TICKS = b.comment("Maximum ticks between Nightmare/Lucid emergence events per tear.").defineInRange("emergenceMaxIntervalTicks", 1200, 20, 240000);
DIMENSIONAL_TEAR_LUCID_EVENT_CHANCE = b.comment("Chance that an emergence event spawns a Lucid instead of a Nightmare.").defineInRange("lucidEventChance", 0.65D, 0.0D, 1.0D);
DIMENSIONAL_TEARS_SPAWN_NATURALLY = b.define("spawnNaturally", true);
b.pop();
@@ -935,6 +1046,41 @@ public final class AntarchyMobsConfig {
SPEC = b.build();
}
static double caterpillarHealth() { return CATERPILLAR_HEALTH.get(); }
static double caterpillarMovementSpeed() { return CATERPILLAR_MOVEMENT_SPEED.get(); }
static double flyingSquirrelHealth() { return FLYING_SQUIRREL_HEALTH.get(); }
static double flyingSquirrelMovementSpeed() { return FLYING_SQUIRREL_MOVEMENT_SPEED.get(); }
static double butterflyHealth() { return BUTTERFLY_HEALTH.get(); }
static double butterflyMovementSpeed() { return BUTTERFLY_MOVEMENT_SPEED.get(); }
static double butterflyFlyingSpeed() { return BUTTERFLY_FLYING_SPEED.get(); }
static double bedBugHealth() { return BED_BUG_HEALTH.get(); }
static double bedBugAttackDamage() { return BED_BUG_ATTACK_DAMAGE.get(); }
static double bedBugMovementSpeed() { return BED_BUG_MOVEMENT_SPEED.get(); }
static double bedBugArmor() { return BED_BUG_ARMOR.get(); }
static double stratosharkHealth() { return STRATOSHARK_HEALTH.get(); }
static double stratosharkAttackDamage() { return STRATOSHARK_ATTACK_DAMAGE.get(); }
static double stratosharkMovementSpeed() { return STRATOSHARK_MOVEMENT_SPEED.get(); }
static double stratosharkFlyingSpeed() { return STRATOSHARK_FLYING_SPEED.get(); }
static double stratosharkKnockbackResistance() { return STRATOSHARK_KNOCKBACK_RESISTANCE.get(); }
static double missileSquidHealth() { return MISSILE_SQUID_HEALTH.get(); }
static double missileSquidAttackDamage() { return MISSILE_SQUID_ATTACK_DAMAGE.get(); }
static double missileSquidMovementSpeed() { return MISSILE_SQUID_MOVEMENT_SPEED.get(); }
static double missileSquidFlyingSpeed() { return MISSILE_SQUID_FLYING_SPEED.get(); }
static double missileSquidKnockbackResistance() { return MISSILE_SQUID_KNOCKBACK_RESISTANCE.get(); }
static double molewormHealth() { return MOLEWORM_HEALTH.get(); }
static double molewormAttackDamage() { return MOLEWORM_ATTACK_DAMAGE.get(); }
static double molewormMovementSpeed() { return MOLEWORM_MOVEMENT_SPEED.get(); }
static double molevoreHealth() { return MOLEVORE_HEALTH.get(); }
static double molevoreAttackDamage() { return MOLEVORE_ATTACK_DAMAGE.get(); }
static int molevoreSpinTicks() { return MOLEVORE_SPIN_TICKS.get(); }
static int molevoreCooldownTicks() { return MOLEVORE_COOLDOWN_TICKS.get(); }
static double molevoreChargeSpeed() { return MOLEVORE_CHARGE_SPEED.get(); }
static double molevoreBreakRange() { return MOLEVORE_BREAK_RANGE.get(); }
static double molevoreBreakVerticalRange() { return MOLEVORE_BREAK_VERTICAL_RANGE.get(); }
static double molevoreBreakHalfWidth() { return MOLEVORE_BREAK_HALF_WIDTH.get(); }
static double octopusBombHealth() { return OCTOPUS_BOMB_HEALTH.get(); }
static double octopusBombAttackDamage() { return OCTOPUS_BOMB_ATTACK_DAMAGE.get(); }
private AntarchyMobsConfig() {}
private static boolean isValidDimensionId(Object value) {
@@ -1010,6 +1156,12 @@ public final class AntarchyMobsConfig {
static double emperorScorpionDamageRange() { return EMPEROR_SCORPION_DAMAGE_RANGE.get(); }
static int emperorScorpionMinDespawnTicks() { return EMPEROR_SCORPION_MIN_DESPAWN_TICKS.get(); }
static double scorpionHealth() { return SCORPION_HEALTH.get(); }
static double scorpionAttackDamage() { return SCORPION_ATTACK_DAMAGE.get(); }
static double scorpionMovementSpeed() { return SCORPION_MOVEMENT_SPEED.get(); }
static double scorpionArmor() { return SCORPION_ARMOR.get(); }
static double scorpionKnockbackResistance() { return SCORPION_KNOCKBACK_RESISTANCE.get(); }
static double krakenHealth() { return KRAKEN_HEALTH.get(); }
static double krakenAttackDamage() { return KRAKEN_ATTACK_DAMAGE.get(); }
static boolean krakenSquidSpawnEnabled() { return KRAKEN_SQUID_SPAWN_ENABLED.get(); }
@@ -1162,6 +1314,7 @@ public final class AntarchyMobsConfig {
static int dimensionalTearEmergenceMinIntervalTicks() { return DIMENSIONAL_TEAR_EMERGENCE_MIN_INTERVAL_TICKS.get(); }
static int dimensionalTearEmergenceMaxIntervalTicks() { return DIMENSIONAL_TEAR_EMERGENCE_MAX_INTERVAL_TICKS.get(); }
static float dimensionalTearLucidEventChance() { return DIMENSIONAL_TEAR_LUCID_EVENT_CHANCE.get().floatValue(); }
static boolean dimensionalTearsSpawnNaturally() { return DIMENSIONAL_TEARS_SPAWN_NATURALLY.get(); }
static double nightmareMovementSpeed() { return NIGHTMARE_MOVEMENT_SPEED.get(); }
static int nightmareWeaknessTicks() { return NIGHTMARE_WEAKNESS_TICKS.get(); }
static int nightmareDreadTicks() { return NIGHTMARE_DREAD_TICKS.get(); }
@@ -67,6 +67,36 @@ public final class AntarchyToolsConfig {
private static final ModConfigSpec.DoubleValue ULTIMATE_BOOTS_ARMOR_TOUGHNESS;
private static final ModConfigSpec.DoubleValue ULTIMATE_ARMOR_KNOCKBACK_RESISTANCE;
private static final ModConfigSpec.BooleanValue ROYAL_ARMOR_COMES_ENCHANTED;
private static final ModConfigSpec.IntValue ROYAL_ARMOR_PROTECTION_LEVEL;
private static final ModConfigSpec.IntValue ROYAL_ARMOR_ENCHANTABILITY;
private static final ModConfigSpec.IntValue ROYAL_ARMOR_DURABILITY_MULTIPLIER;
private static final ModConfigSpec.IntValue ROYAL_GUARDIAN_HELMET_ARMOR_VALUE;
private static final ModConfigSpec.IntValue ROYAL_GUARDIAN_CHESTPLATE_ARMOR_VALUE;
private static final ModConfigSpec.IntValue ROYAL_GUARDIAN_LEGGINGS_ARMOR_VALUE;
private static final ModConfigSpec.IntValue ROYAL_GUARDIAN_BOOTS_ARMOR_VALUE;
private static final ModConfigSpec.DoubleValue ROYAL_GUARDIAN_ARMOR_TOUGHNESS;
private static final ModConfigSpec.DoubleValue ROYAL_GUARDIAN_ARMOR_KNOCKBACK_RESISTANCE;
private static final ModConfigSpec.IntValue ROYAL_ASSAILANT_HELMET_ARMOR_VALUE;
private static final ModConfigSpec.IntValue ROYAL_ASSAILANT_CHESTPLATE_ARMOR_VALUE;
private static final ModConfigSpec.IntValue ROYAL_ASSAILANT_LEGGINGS_ARMOR_VALUE;
private static final ModConfigSpec.IntValue ROYAL_ASSAILANT_BOOTS_ARMOR_VALUE;
private static final ModConfigSpec.DoubleValue ROYAL_ASSAILANT_ARMOR_TOUGHNESS;
private static final ModConfigSpec.DoubleValue ROYAL_ASSAILANT_ARMOR_KNOCKBACK_RESISTANCE;
private static final ModConfigSpec.DoubleValue ROYAL_ASSAILANT_HELMET_DOUBLE_DAMAGE_CHANCE;
private static final ModConfigSpec.DoubleValue ROYAL_ASSAILANT_CHESTPLATE_DOUBLE_DAMAGE_CHANCE;
private static final ModConfigSpec.DoubleValue ROYAL_ASSAILANT_LEGGINGS_DOUBLE_DAMAGE_CHANCE;
private static final ModConfigSpec.DoubleValue ROYAL_ASSAILANT_BOOTS_DOUBLE_DAMAGE_CHANCE;
private static final ModConfigSpec.DoubleValue ROYAL_GUARDIAN_SWORD_ATTACK_DAMAGE;
private static final ModConfigSpec.DoubleValue ROYAL_GUARDIAN_SWORD_ATTACK_SPEED;
private static final ModConfigSpec.DoubleValue ROYAL_ASSAILANT_BATTLE_AXE_ATTACK_DAMAGE;
private static final ModConfigSpec.DoubleValue ROYAL_ASSAILANT_BATTLE_AXE_ATTACK_SPEED;
private static final ModConfigSpec.DoubleValue ROYAL_WEAPON_ATTACK_REACH_BONUS;
private static final ModConfigSpec.DoubleValue ROYAL_WEAPON_ATTACK_KNOCKBACK_BONUS;
private static final ModConfigSpec.IntValue ROYAL_WEAPON_DURABILITY;
private static final ModConfigSpec.IntValue ROYAL_WEAPON_ENCHANTABILITY;
private static final ModConfigSpec.IntValue ROYAL_GUARDIAN_SHIELD_DURABILITY;
// Battle Axe
@@ -190,6 +220,20 @@ public final class AntarchyToolsConfig {
private static final ModConfigSpec.DoubleValue GRAVITY_GUN_BLAST_STRENGTH;
private static final ModConfigSpec.DoubleValue GRAVITY_GUN_COOLDOWN_SECONDS;
private static final ModConfigSpec.DoubleValue GRAVITY_GUN_MAX_HOLD_DISTANCE;
private static final ModConfigSpec.BooleanValue EYE_OF_THE_STORM_ENABLED;
private static final ModConfigSpec.IntValue EYE_OF_THE_STORM_UPDRAFT_COOLDOWN_TICKS;
private static final ModConfigSpec.DoubleValue EYE_OF_THE_STORM_UPDRAFT_LAUNCH_STRENGTH;
private static final ModConfigSpec.DoubleValue EYE_OF_THE_STORM_UPDRAFT_HEIGHT;
private static final ModConfigSpec.DoubleValue EYE_OF_THE_STORM_UPDRAFT_RADIUS;
private static final ModConfigSpec.IntValue EYE_OF_THE_STORM_UPDRAFT_DURATION_TICKS;
private static final ModConfigSpec.IntValue EYE_OF_THE_STORM_SURGE_COOLDOWN_TICKS;
private static final ModConfigSpec.DoubleValue EYE_OF_THE_STORM_SURGE_RANGE;
private static final ModConfigSpec.IntValue EYE_OF_THE_STORM_SURGE_DURATION_TICKS;
private static final ModConfigSpec.DoubleValue EYE_OF_THE_STORM_SURGE_RADIUS;
private static final ModConfigSpec.DoubleValue EYE_OF_THE_STORM_SURGE_HEIGHT;
private static final ModConfigSpec.DoubleValue EYE_OF_THE_STORM_SURGE_PULL_STRENGTH;
private static final ModConfigSpec.DoubleValue EYE_OF_THE_STORM_SURGE_RETURN_STRENGTH;
private static final ModConfigSpec.DoubleValue EYE_OF_THE_STORM_SURGE_DAMAGE;
// Critter Cage
@@ -305,6 +349,38 @@ public final class AntarchyToolsConfig {
ULTIMATE_ARMOR_KNOCKBACK_RESISTANCE = b.comment("Knockback resistance granted by each Ultimate Armor piece.") .defineInRange("knockbackResistance", 0.1D, 0.0D, 1.0D);
b.pop();
b.push("royalGear");
ROYAL_ARMOR_COMES_ENCHANTED = b.define("comesEnchanted", true);
ROYAL_ARMOR_PROTECTION_LEVEL = b.defineInRange("protectionLevel", 10, 0, 100);
ROYAL_ARMOR_ENCHANTABILITY = b.defineInRange("enchantability", 30, 0, 100);
ROYAL_ARMOR_DURABILITY_MULTIPLIER = b.defineInRange("durabilityMultiplier", 93, 0, 1000);
ROYAL_GUARDIAN_HELMET_ARMOR_VALUE = b.defineInRange("guardianHelmetArmor", 5, 0, 100);
ROYAL_GUARDIAN_CHESTPLATE_ARMOR_VALUE = b.defineInRange("guardianChestplateArmor", 10, 0, 100);
ROYAL_GUARDIAN_LEGGINGS_ARMOR_VALUE = b.defineInRange("guardianLeggingsArmor", 8, 0, 100);
ROYAL_GUARDIAN_BOOTS_ARMOR_VALUE = b.defineInRange("guardianBootsArmor", 5, 0, 100);
ROYAL_GUARDIAN_ARMOR_TOUGHNESS = b.defineInRange("guardianArmorToughness", 4.0D, 0.0D, 100.0D);
ROYAL_GUARDIAN_ARMOR_KNOCKBACK_RESISTANCE = b.defineInRange("guardianArmorKnockbackResistance", 0.15D, 0.0D, 1.0D);
ROYAL_ASSAILANT_HELMET_ARMOR_VALUE = b.defineInRange("assailantHelmetArmor", 5, 0, 100);
ROYAL_ASSAILANT_CHESTPLATE_ARMOR_VALUE = b.defineInRange("assailantChestplateArmor", 10, 0, 100);
ROYAL_ASSAILANT_LEGGINGS_ARMOR_VALUE = b.defineInRange("assailantLeggingsArmor", 8, 0, 100);
ROYAL_ASSAILANT_BOOTS_ARMOR_VALUE = b.defineInRange("assailantBootsArmor", 5, 0, 100);
ROYAL_ASSAILANT_ARMOR_TOUGHNESS = b.defineInRange("assailantArmorToughness", 3.0D, 0.0D, 100.0D);
ROYAL_ASSAILANT_ARMOR_KNOCKBACK_RESISTANCE = b.defineInRange("assailantArmorKnockbackResistance", 0.15D, 0.0D, 1.0D);
ROYAL_ASSAILANT_HELMET_DOUBLE_DAMAGE_CHANCE = b.defineInRange("assailantHelmetDoubleDamageChance", 0.06D, 0.0D, 1.0D);
ROYAL_ASSAILANT_CHESTPLATE_DOUBLE_DAMAGE_CHANCE = b.defineInRange("assailantChestplateDoubleDamageChance", 0.08D, 0.0D, 1.0D);
ROYAL_ASSAILANT_LEGGINGS_DOUBLE_DAMAGE_CHANCE = b.defineInRange("assailantLeggingsDoubleDamageChance", 0.07D, 0.0D, 1.0D);
ROYAL_ASSAILANT_BOOTS_DOUBLE_DAMAGE_CHANCE = b.defineInRange("assailantBootsDoubleDamageChance", 0.05D, 0.0D, 1.0D);
ROYAL_GUARDIAN_SWORD_ATTACK_DAMAGE = b.defineInRange("guardianSwordAttackDamage", 111.0D, 0.0D, 4096.0D);
ROYAL_GUARDIAN_SWORD_ATTACK_SPEED = b.defineInRange("guardianSwordAttackSpeed", -2.5D, -10.0D, 10.0D);
ROYAL_ASSAILANT_BATTLE_AXE_ATTACK_DAMAGE = b.defineInRange("assailantBattleAxeAttackDamage", 151.0D, 0.0D, 4096.0D);
ROYAL_ASSAILANT_BATTLE_AXE_ATTACK_SPEED = b.defineInRange("assailantBattleAxeAttackSpeed", -2.9D, -10.0D, 10.0D);
ROYAL_WEAPON_ATTACK_REACH_BONUS = b.defineInRange("weaponAttackReachBonus", 1.0D, 0.0D, 32.0D);
ROYAL_WEAPON_ATTACK_KNOCKBACK_BONUS = b.defineInRange("weaponAttackKnockbackBonus", 1.0D, 0.0D, 32.0D);
ROYAL_WEAPON_DURABILITY = b.defineInRange("weaponDurability", 4608, 1, 100000);
ROYAL_WEAPON_ENCHANTABILITY = b.defineInRange("weaponEnchantability", 30, 0, 100);
ROYAL_GUARDIAN_SHIELD_DURABILITY = b.defineInRange("guardianShieldDurability", 1008, 1, 100000);
b.pop();
// Battle Axe
@@ -487,6 +563,23 @@ public final class AntarchyToolsConfig {
GRAVITY_GUN_MAX_HOLD_DISTANCE = b.comment("Maximum distance a held target can be pushed from the player, in blocks.") .defineInRange("maxHoldDistance", 10.0D, 1.5D, 64.0D);
b.pop();
b.push("eyeOfTheStorm");
EYE_OF_THE_STORM_ENABLED = b.define("enabled", true);
EYE_OF_THE_STORM_UPDRAFT_COOLDOWN_TICKS = b.defineInRange("updraftCooldownTicks", 40, 0, 20000);
EYE_OF_THE_STORM_UPDRAFT_LAUNCH_STRENGTH = b.defineInRange("updraftLaunchStrength", 1.15D, 0.0D, 16.0D);
EYE_OF_THE_STORM_UPDRAFT_HEIGHT = b.defineInRange("updraftHeight", 4.0D, 0.0D, 128.0D);
EYE_OF_THE_STORM_UPDRAFT_RADIUS = b.defineInRange("updraftRadius", 1.3D, 0.0D, 64.0D);
EYE_OF_THE_STORM_UPDRAFT_DURATION_TICKS = b.defineInRange("updraftDurationTicks", 32, 0, 20000);
EYE_OF_THE_STORM_SURGE_COOLDOWN_TICKS = b.defineInRange("surgeCooldownTicks", 70, 0, 20000);
EYE_OF_THE_STORM_SURGE_RANGE = b.defineInRange("surgeRange", 16.0D, 0.0D, 256.0D);
EYE_OF_THE_STORM_SURGE_DURATION_TICKS = b.defineInRange("surgeDurationTicks", 300, 0, 20000);
EYE_OF_THE_STORM_SURGE_RADIUS = b.defineInRange("surgeRadius", 4.0D, 0.0D, 128.0D);
EYE_OF_THE_STORM_SURGE_HEIGHT = b.defineInRange("surgeHeight", 6.0D, 0.0D, 128.0D);
EYE_OF_THE_STORM_SURGE_PULL_STRENGTH = b.defineInRange("surgePullStrength", 0.85D, 0.0D, 16.0D);
EYE_OF_THE_STORM_SURGE_RETURN_STRENGTH = b.defineInRange("surgeReturnStrength", 1.4D, 0.0D, 16.0D);
EYE_OF_THE_STORM_SURGE_DAMAGE = b.defineInRange("surgeDamage", 5.0F, 0.0F, 1024.0F);
b.pop();
// Critter Cage
@@ -710,5 +803,50 @@ public final class AntarchyToolsConfig {
static int americanRegenerationAmplifier() { return AMERICAN_REGENERATION_AMPLIFIER.get(); }
static double mogglesVisionRadius() { return MOGGLES_VISION_RADIUS.get(); }
static boolean eyeOfTheStormEnabled() { return EYE_OF_THE_STORM_ENABLED.get(); }
static int eyeOfTheStormUpdraftCooldownTicks() { return EYE_OF_THE_STORM_UPDRAFT_COOLDOWN_TICKS.get(); }
static double eyeOfTheStormUpdraftLaunchStrength() { return EYE_OF_THE_STORM_UPDRAFT_LAUNCH_STRENGTH.get(); }
static double eyeOfTheStormUpdraftHeight() { return EYE_OF_THE_STORM_UPDRAFT_HEIGHT.get(); }
static double eyeOfTheStormUpdraftRadius() { return EYE_OF_THE_STORM_UPDRAFT_RADIUS.get(); }
static int eyeOfTheStormUpdraftDurationTicks() { return EYE_OF_THE_STORM_UPDRAFT_DURATION_TICKS.get(); }
static int eyeOfTheStormSurgeCooldownTicks() { return EYE_OF_THE_STORM_SURGE_COOLDOWN_TICKS.get(); }
static double eyeOfTheStormSurgeRange() { return EYE_OF_THE_STORM_SURGE_RANGE.get(); }
static int eyeOfTheStormSurgeDurationTicks() { return EYE_OF_THE_STORM_SURGE_DURATION_TICKS.get(); }
static double eyeOfTheStormSurgeRadius() { return EYE_OF_THE_STORM_SURGE_RADIUS.get(); }
static double eyeOfTheStormSurgeHeight() { return EYE_OF_THE_STORM_SURGE_HEIGHT.get(); }
static double eyeOfTheStormSurgePullStrength() { return EYE_OF_THE_STORM_SURGE_PULL_STRENGTH.get(); }
static double eyeOfTheStormSurgeReturnStrength() { return EYE_OF_THE_STORM_SURGE_RETURN_STRENGTH.get(); }
static float eyeOfTheStormSurgeDamage() { return EYE_OF_THE_STORM_SURGE_DAMAGE.get().floatValue(); }
static boolean royalArmorComesEnchanted() { return ROYAL_ARMOR_COMES_ENCHANTED.get(); }
static int royalArmorProtectionLevel() { return ROYAL_ARMOR_PROTECTION_LEVEL.get(); }
static int royalArmorEnchantability() { return ROYAL_ARMOR_ENCHANTABILITY.get(); }
static int royalArmorDurabilityMultiplier() { return ROYAL_ARMOR_DURABILITY_MULTIPLIER.get(); }
static int royalGuardianHelmetArmorValue() { return ROYAL_GUARDIAN_HELMET_ARMOR_VALUE.get(); }
static int royalGuardianChestplateArmorValue() { return ROYAL_GUARDIAN_CHESTPLATE_ARMOR_VALUE.get(); }
static int royalGuardianLeggingsArmorValue() { return ROYAL_GUARDIAN_LEGGINGS_ARMOR_VALUE.get(); }
static int royalGuardianBootsArmorValue() { return ROYAL_GUARDIAN_BOOTS_ARMOR_VALUE.get(); }
static double royalGuardianArmorToughness() { return ROYAL_GUARDIAN_ARMOR_TOUGHNESS.get(); }
static double royalGuardianArmorKnockbackResistance() { return ROYAL_GUARDIAN_ARMOR_KNOCKBACK_RESISTANCE.get(); }
static int royalAssailantHelmetArmorValue() { return ROYAL_ASSAILANT_HELMET_ARMOR_VALUE.get(); }
static int royalAssailantChestplateArmorValue() { return ROYAL_ASSAILANT_CHESTPLATE_ARMOR_VALUE.get(); }
static int royalAssailantLeggingsArmorValue() { return ROYAL_ASSAILANT_LEGGINGS_ARMOR_VALUE.get(); }
static int royalAssailantBootsArmorValue() { return ROYAL_ASSAILANT_BOOTS_ARMOR_VALUE.get(); }
static double royalAssailantArmorToughness() { return ROYAL_ASSAILANT_ARMOR_TOUGHNESS.get(); }
static double royalAssailantArmorKnockbackResistance() { return ROYAL_ASSAILANT_ARMOR_KNOCKBACK_RESISTANCE.get(); }
static double royalAssailantHelmetDoubleDamageChance() { return ROYAL_ASSAILANT_HELMET_DOUBLE_DAMAGE_CHANCE.get(); }
static double royalAssailantChestplateDoubleDamageChance() { return ROYAL_ASSAILANT_CHESTPLATE_DOUBLE_DAMAGE_CHANCE.get(); }
static double royalAssailantLeggingsDoubleDamageChance() { return ROYAL_ASSAILANT_LEGGINGS_DOUBLE_DAMAGE_CHANCE.get(); }
static double royalAssailantBootsDoubleDamageChance() { return ROYAL_ASSAILANT_BOOTS_DOUBLE_DAMAGE_CHANCE.get(); }
static double royalGuardianSwordAttackDamage() { return ROYAL_GUARDIAN_SWORD_ATTACK_DAMAGE.get(); }
static double royalGuardianSwordAttackSpeed() { return ROYAL_GUARDIAN_SWORD_ATTACK_SPEED.get(); }
static double royalAssailantBattleAxeAttackDamage() { return ROYAL_ASSAILANT_BATTLE_AXE_ATTACK_DAMAGE.get(); }
static double royalAssailantBattleAxeAttackSpeed() { return ROYAL_ASSAILANT_BATTLE_AXE_ATTACK_SPEED.get(); }
static double royalWeaponAttackReachBonus() { return ROYAL_WEAPON_ATTACK_REACH_BONUS.get(); }
static double royalWeaponAttackKnockbackBonus() { return ROYAL_WEAPON_ATTACK_KNOCKBACK_BONUS.get(); }
static int royalWeaponDurability() { return ROYAL_WEAPON_DURABILITY.get(); }
static int royalWeaponEnchantability() { return ROYAL_WEAPON_ENCHANTABILITY.get(); }
static int royalGuardianShieldDurability() { return ROYAL_GUARDIAN_SHIELD_DURABILITY.get(); }
}
@@ -163,7 +163,7 @@ public final class AntarchyNeoForgeClient {
event.registerEntityRenderer(AntarchyNeoforgeEntites.UPWARD_FALLING_BLOCK.get(), com.craisinlord.antarchy.content.client.renderer.UpwardFallingBlockRenderer::new);
event.registerEntityRenderer(AntarchyNeoforgeEntites.SCORPION.get(), context -> withParalyzedGeoLayer(new ScorpionRenderer(context)));
event.registerEntityRenderer(AntarchyNeoforgeEntites.EMPEROR_SCORPION.get(), context -> withParalyzedGeoLayer(new EmperorScorpionRenderer(context)));
event.registerEntityRenderer(AntarchyNeoforgeEntites.TORETERROR.get(), ToreterrorRenderer::new);
event.registerEntityRenderer(AntarchyNeoforgeEntites.TORETERROR.get(), context -> withParalyzedGeoLayer(new ToreterrorRenderer(context)));
event.registerEntityRenderer(AntarchyNeoforgeEntites.WATER_BOMB.get(), WaterBombRenderer::new);
event.registerEntityRenderer(AntarchyNeoforgeEntites.CHEEP.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.CheepRenderer(context)));
event.registerEntityRenderer(AntarchyNeoforgeEntites.DORRIE.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.DorrieRenderer(context)));
@@ -174,7 +174,7 @@ public final class AntarchyNeoForgeClient {
event.registerEntityRenderer(AntarchyNeoforgeEntites.TERMITE.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.TermiteRenderer(context)));
event.registerEntityRenderer(AntarchyNeoforgeEntites.CRAWLING_BLIGHT.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.CrawlingBlightRenderer(context)));
event.registerEntityRenderer(AntarchyNeoforgeEntites.SKULKING_FRIGHT.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.SkulkingFrightRenderer(context)));
event.registerEntityRenderer(AntarchyNeoforgeEntites.MANTICORE.get(), com.craisinlord.antarchy.content.client.renderer.ManticoreRenderer::new);
event.registerEntityRenderer(AntarchyNeoforgeEntites.MANTICORE.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.ManticoreRenderer(context)));
event.registerEntityRenderer(AntarchyNeoforgeEntites.HERCULES_BEETLE.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.HerculesBeetleRenderer(context)));
event.registerEntityRenderer(AntarchyNeoforgeEntites.PRINCE.get(), com.craisinlord.antarchy.content.client.renderer.RoyalMountRenderer::new);
event.registerEntityRenderer(AntarchyNeoforgeEntites.PRINCESS.get(), com.craisinlord.antarchy.content.client.renderer.RoyalMountRenderer::new);
@@ -201,7 +201,6 @@ public final class AntarchyNeoForgeClient {
renderer.addLayer(new TigerEyeCamouflagePlayerLayer(renderer));
renderer.addLayer(new GoopedLivingLayer(renderer));
renderer.addLayer(new GlimmeringLivingLayer(renderer));
renderer.addLayer(new TemporalContractionAfterimageLayer<>(renderer));
renderer.addLayer(new RoyalAssailantAxeAfterimageLayer(renderer));
renderer.addLayer(new BrutalflyElytraLayer(renderer));
renderer.addLayer(new com.craisinlord.antarchy.content.client.renderer.ManticoreWingsLayer(renderer));
@@ -242,7 +241,6 @@ public final class AntarchyNeoForgeClient {
((LivingEntityRenderer) livingRenderer).addLayer(new ParalyzedStoneLivingLayer<>(livingRenderer));
((LivingEntityRenderer) livingRenderer).addLayer(new GoopedLivingLayer<>(livingRenderer));
((LivingEntityRenderer) livingRenderer).addLayer(new GlimmeringLivingLayer<>(livingRenderer));
((LivingEntityRenderer) livingRenderer).addLayer(new TemporalContractionAfterimageLayer<>(livingRenderer));
}
private static <T extends LivingEntity & GeoAnimatable> GeoEntityRenderer<T> withParalyzedGeoLayer(GeoEntityRenderer<T> renderer) {
@@ -1,62 +0,0 @@
package com.craisinlord.antarchy.neoforge.network;
import com.craisinlord.antarchy.content.client.ThoraxisWeatherClientState;
import com.craisinlord.antarchy.content.weather.ThoraxisWeatherKind;
import com.craisinlord.antarchy.content.weather.ThoraxisWeatherSnapshot;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.neoforge.network.PacketDistributor;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
public final class ThoraxisWeatherNetworking {
private ThoraxisWeatherNetworking() {
}
public static void register(PayloadRegistrar registrar) {
registrar.playToClient(
com.craisinlord.antarchy.content.network.ThoraxisWeatherPayload.TYPE,
com.craisinlord.antarchy.content.network.ThoraxisWeatherPayload.STREAM_CODEC,
ThoraxisWeatherNetworking::handleWeatherPayload
);
}
public static void syncLevel(ServerLevel level, ThoraxisWeatherSnapshot snapshot) {
com.craisinlord.antarchy.content.network.ThoraxisWeatherPayload payload = new com.craisinlord.antarchy.content.network.ThoraxisWeatherPayload(
snapshot.dimension(),
snapshot.kind(),
snapshot.expiresAt(),
snapshot.anchor().getX(),
snapshot.anchor().getY(),
snapshot.anchor().getZ()
);
for (ServerPlayer player : level.players()) {
PacketDistributor.sendToPlayer(player, payload);
}
}
public static void syncPlayer(ServerPlayer player, ThoraxisWeatherSnapshot snapshot) {
com.craisinlord.antarchy.content.network.ThoraxisWeatherPayload payload = new com.craisinlord.antarchy.content.network.ThoraxisWeatherPayload(
snapshot.dimension(),
snapshot.kind(),
snapshot.expiresAt(),
snapshot.anchor().getX(),
snapshot.anchor().getY(),
snapshot.anchor().getZ()
);
PacketDistributor.sendToPlayer(player, payload);
}
private static void handleWeatherPayload(com.craisinlord.antarchy.content.network.ThoraxisWeatherPayload payload, IPayloadContext context) {
context.enqueueWork(() -> ThoraxisWeatherClientState.apply(
ResourceLocation.parse(payload.dimensionId()),
ThoraxisWeatherKind.byId(payload.weatherId()),
payload.expiresAt(),
payload.anchorX(),
payload.anchorY(),
payload.anchorZ()
));
}
}
@@ -137,6 +137,5 @@ public class AntarchyNeoforgePayloadHandlers {
)
);
MultipartNetworking.register(registrar);
// ThoraxisWeatherNetworking.register(registrar);
}
}