diff --git a/common/build.gradle b/common/build.gradle index 38199053..7d413be2 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -7,26 +7,27 @@ dependencies { // modImplementation("curse.maven:create-${create_curseforge_id}:${create_curseforge_file_id}") // modImplementation("curse.maven:selene-499980:4754433") compileOnly("curse.maven:intapi-${project.intapi_curseforge_id}:${project.intapi_curseforge_file_id_neoforge}") - compileOnly("curse.maven:create-${project.create_curseforge_id_neoforge}:${project.create_curseforge_file_id_neoforge}") - compileOnly("curse.maven:marvel-${project.marvel_curseforge_id}:${project.marvel_curseforge_file_id}") - compileOnly("curse.maven:stellaris-${project.stellaris_curseforge_id}:${project.stellaris_curseforge_file_id}") - compileOnly("curse.maven:aperture-${project.aperture_curseforge_id}:${project.aperture_curseforge_file_id}") - compileOnly("curse.maven:inventory_pets-${project.inventory_pets_curseforge_id}:${project.inventory_pets_curseforge_file_id}") - compileOnly("curse.maven:cataclysm-${project.cataclysm_curseforge_id}:${project.cataclysm_curseforge_file_id}") - compileOnly("curse.maven:iaf-${project.iaf_curseforge_id}:${project.iaf_curseforge_file_id}") - compileOnly("curse.maven:backpack-${project.backpack_curseforge_id}:${project.backpack_curseforge_file_id}") +// compileOnly("curse.maven:create-${project.create_curseforge_id_neoforge}:${project.create_curseforge_file_id_neoforge}") +// compileOnly("curse.maven:marvel-${project.marvel_curseforge_id}:${project.marvel_curseforge_file_id}") +// compileOnly("curse.maven:stellaris-${project.stellaris_curseforge_id}:${project.stellaris_curseforge_file_id}") +// compileOnly("curse.maven:aperture-${project.aperture_curseforge_id}:${project.aperture_curseforge_file_id}") +// compileOnly("curse.maven:inventory_pets-${project.inventory_pets_curseforge_id}:${project.inventory_pets_curseforge_file_id}") +// compileOnly("curse.maven:cataclysm-${project.cataclysm_curseforge_id}:${project.cataclysm_curseforge_file_id}") +// compileOnly("curse.maven:iaf-${project.iaf_curseforge_id}:${project.iaf_curseforge_file_id}") +// compileOnly("curse.maven:backpack-${project.backpack_curseforge_id}:${project.backpack_curseforge_file_id}") // compileOnly("curse.maven:regions_unexplored-${project.regions_unexplored_curseforge_id}:${project.regions_unexplored_curseforge_file_id}") // compileOnly("curse.maven:geckolib-${project.geckolib_curseforge_id}:${project.geckolib_curseforge_file_id}") compileOnly(files("$rootDir/infinite_dimensions_jars/infinity-2.7.1+1.21.1-neoforge.jar")) compileOnly(files("$rootDir/infinite_dimensions_jars/infinity-2.7.1+1.21.1-fabric.jar")) compileOnly(files("$rootDir/infinite_dimensions_jars/infinity-2.7.1+1.21.1-neoforge-sources.jar")) compileOnly(files("$rootDir/infinite_dimensions_jars/gravity-api-1.0.7-1.20.1.jar")) - compileOnly(files("$rootDir/infinite_dimensions_jars/Cloro's Gravity Gun Mod (Release 1.3.1).jar")) +// compileOnly(files("$rootDir/infinite_dimensions_jars/Cloro's Gravity Gun Mod (Release 1.3.1).jar")) // compileOnly(files("$rootDir/infinite_dimensions_jars/antarchy-1.0.0+1.21.1-neoforge.jar")) - compileOnly(files("$rootDir/infinite_dimensions_jars/VanillaBackport-neoforge-1.21.1-1.1.7.6.jar")) - compileOnly(files("$rootDir/infinite_dimensions_jars/soul-fire-d-neoforge-1.21-6.1.0.jar")) - compileOnly(files("$rootDir/infinite_dimensions_jars/prometheus-neoforge-1.21-1.2.5.jar")) +// compileOnly(files("$rootDir/infinite_dimensions_jars/VanillaBackport-neoforge-1.21.1-1.1.7.6.jar")) +// compileOnly(files("$rootDir/infinite_dimensions_jars/soul-fire-d-neoforge-1.21-6.1.0.jar")) +// compileOnly(files("$rootDir/infinite_dimensions_jars/prometheus-neoforge-1.21-1.2.5.jar")) compileOnly(files("$rootDir/infinite_dimensions_jars/sable-neoforge-1.21.1-2.0.3.jar")) + compileOnly(files("$rootDir/infinite_dimensions_jars/antarchy-1.0.0+1.21.1-neoforge.jar")) compileOnly("software.bernie.geckolib:geckolib-neoforge-${minecraft_version}:${geckolib_version}") // // compileOnly group: 'org.ow2.asm', name: 'asm-tree', version: '9.4' diff --git a/common/src/main/java/com/craisinlord/antarchy/config/AntarchySettings.java b/common/src/main/java/com/craisinlord/antarchy/config/AntarchySettings.java index 9102e4ea..a17e9d62 100644 --- a/common/src/main/java/com/craisinlord/antarchy/config/AntarchySettings.java +++ b/common/src/main/java/com/craisinlord/antarchy/config/AntarchySettings.java @@ -454,8 +454,8 @@ public final class AntarchySettings { private static double toreterrorHealth = 300.0D; private static double toreterrorJumpAttackDamage = 14.0D; private static double toreterrorJumpAttackKnockback = 2.5D; - private static double toreterrorSpinDamage = 8.0D; - private static double toreterrorSpinKnockback = 1.5D; + private static double toreterrorSpinDamage = 6.0D; + private static double toreterrorSpinKnockback = 0.9D; private static double toreterrorRangedWaterBombChance = 0.5D; private static double toreterrorProjectileDamageMultiplier = 0.5D; private static double waterBombDamage = 6.0D; diff --git a/common/src/main/java/com/craisinlord/antarchy/config/ConfigResetGuard.java b/common/src/main/java/com/craisinlord/antarchy/config/ConfigResetGuard.java new file mode 100644 index 00000000..b80fcf06 --- /dev/null +++ b/common/src/main/java/com/craisinlord/antarchy/config/ConfigResetGuard.java @@ -0,0 +1,54 @@ +package com.craisinlord.antarchy.config; + +import com.craisinlord.antarchy.Antarchy; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +public final class ConfigResetGuard { + public static final int RESET_GENERATION = 1; + private static final String MARKER_FILE_NAME = ".config_generation"; + + private ConfigResetGuard() { + } + + public static void wipeIfNeeded(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); + } + } + + writeGeneration(markerPath); + } + + private static int readGeneration(Path markerPath) { + if (!Files.exists(markerPath)) { + return 0; + } + + try { + return Integer.parseInt(Files.readString(markerPath).trim()); + } catch (IOException | NumberFormatException e) { + return 0; + } + } + + private static void writeGeneration(Path markerPath) { + try { + Files.createDirectories(markerPath.getParent()); + Files.writeString(markerPath, Integer.toString(RESET_GENERATION)); + } catch (IOException e) { + Antarchy.LOGGER.warn("Failed to write config generation marker at {}", markerPath, e); + } + } +} diff --git a/common/src/main/java/com/craisinlord/antarchy/content/AntarchySoundEvents.java b/common/src/main/java/com/craisinlord/antarchy/content/AntarchySoundEvents.java index 3ad471a1..20594557 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/AntarchySoundEvents.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/AntarchySoundEvents.java @@ -122,6 +122,10 @@ public final class AntarchySoundEvents { public static Supplier BOMBER_WALK = (Supplier) UNBOUND; public static Supplier BOMBER_KNOCK = (Supplier) UNBOUND; public static Supplier BOMBER_EXPLODE = (Supplier) UNBOUND; + public static Supplier TORETERROR_IDLE = (Supplier) UNBOUND; + public static Supplier TORETERROR_HURT = (Supplier) UNBOUND; + public static Supplier TORETERROR_DEATH = (Supplier) UNBOUND; + public static Supplier TORETERROR_BOMBER_FIRE = (Supplier) UNBOUND; public static Supplier STINKY_FLY = (Supplier) UNBOUND; public static Supplier CREEPING_HORROR_GROWL = (Supplier) UNBOUND; public static Supplier CREEPING_HORROR_HURT = (Supplier) UNBOUND; @@ -249,6 +253,10 @@ public final class AntarchySoundEvents { Supplier bomberWalk, Supplier bomberKnock, Supplier bomberExplode, + Supplier toreterrorIdle, + Supplier toreterrorHurt, + Supplier toreterrorDeath, + Supplier toreterrorBomberFire, Supplier stinkyFly, Supplier creepingHorrorGrowl, Supplier creepingHorrorHurt, @@ -372,6 +380,10 @@ public final class AntarchySoundEvents { BOMBER_WALK = bomberWalk; BOMBER_KNOCK = bomberKnock; BOMBER_EXPLODE = bomberExplode; + TORETERROR_IDLE = toreterrorIdle; + TORETERROR_HURT = toreterrorHurt; + TORETERROR_DEATH = toreterrorDeath; + TORETERROR_BOMBER_FIRE = toreterrorBomberFire; STINKY_FLY = stinkyFly; CREEPING_HORROR_GROWL = creepingHorrorGrowl; CREEPING_HORROR_HURT = creepingHorrorHurt; diff --git a/common/src/main/java/com/craisinlord/antarchy/content/StinkyBehavior.java b/common/src/main/java/com/craisinlord/antarchy/content/StinkyBehavior.java index 93581e62..bd386b45 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/StinkyBehavior.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/StinkyBehavior.java @@ -155,7 +155,7 @@ public final class StinkyBehavior { } private static void attractArthropod(Mob mob, LivingEntity source) { - if (!isValidStinkySourceForMob(mob, source)) { + if (!isValidStinkyAttackSourceForMob(mob, source)) { return; } @@ -169,7 +169,7 @@ public final class StinkyBehavior { } private static void repelPassiveOrNeutralMob(Mob mob, LivingEntity source) { - if (!(mob instanceof PathfinderMob pathfinderMob) || !isValidStinkySourceForMob(mob, source)) { + if (!(mob instanceof PathfinderMob pathfinderMob) || !isValidStinkyRepelSourceForMob(mob, source)) { return; } @@ -195,7 +195,10 @@ public final class StinkyBehavior { return !(mob instanceof Enemy); } - private static boolean isValidStinkySourceForMob(Mob mob, LivingEntity source) { + private static boolean isValidStinkyAttackSourceForMob(Mob mob, LivingEntity source) { + if (!isValidStinkyRepelSourceForMob(mob, source)) { + return false; + } if (source == mob || !source.isAlive() || !source.hasEffect(AntarchyObjects.STINKY_EFFECT.get())) { return false; } @@ -205,4 +208,14 @@ public final class StinkyBehavior { return !mob.isAlliedTo(source); } + private static boolean isValidStinkyRepelSourceForMob(Mob mob, LivingEntity source) { + if (source == mob || !source.isAlive() || !source.hasEffect(AntarchyObjects.STINKY_EFFECT.get())) { + return false; + } + if (source instanceof Player player && player.isSpectator()) { + return false; + } + return !mob.isAlliedTo(source); + } + } diff --git a/common/src/main/java/com/craisinlord/antarchy/content/client/NightmareSwordTooltipHelper.java b/common/src/main/java/com/craisinlord/antarchy/content/client/NightmareSwordTooltipHelper.java new file mode 100644 index 00000000..56c6d041 --- /dev/null +++ b/common/src/main/java/com/craisinlord/antarchy/content/client/NightmareSwordTooltipHelper.java @@ -0,0 +1,29 @@ +package com.craisinlord.antarchy.content.client; + +import com.craisinlord.antarchy.config.AntarchySettings; +import com.craisinlord.antarchy.content.item.NightmareSwordItem; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Player; + +public final class NightmareSwordTooltipHelper { + private NightmareSwordTooltipHelper() { + } + + public static Component damageLine() { + Player player = Minecraft.getInstance().player; + float damage = player != null + ? NightmareSwordItem.calculateDamage(player) + : (float) AntarchySettings.nightmareSwordBaseDamage(); + return Component.translatable("tooltip.antarchy.nightmare_sword_damage", formatDamage(damage)).withStyle(ChatFormatting.RED); + } + + private static String formatDamage(float damage) { + float rounded = Math.round(damage * 10.0F) / 10.0F; + if (rounded == (int) rounded) { + return String.valueOf((int) rounded); + } + return String.valueOf(rounded); + } +} diff --git a/common/src/main/java/com/craisinlord/antarchy/content/entity/AppleCowEntity.java b/common/src/main/java/com/craisinlord/antarchy/content/entity/AppleCowEntity.java index 301f1961..0b08252f 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/entity/AppleCowEntity.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/entity/AppleCowEntity.java @@ -353,6 +353,18 @@ public abstract class AppleCowEntity extends Cow implements GeoEntity, Shearable this.spawnAtLocation(new ItemStack(this.shearDropItem(), 2), this.getBbHeight() * 0.66F); } + @Override + protected void dropCustomDeathLoot(ServerLevel level, net.minecraft.world.damagesource.DamageSource damageSource, boolean recentlyHit) { + super.dropCustomDeathLoot(level, damageSource, recentlyHit); + + if (this.isBaby() || this.isSheared()) { + return; + } + + int count = this instanceof AppleCowEntityVariants.EnchantedGoldenAppleCow ? 1 : 1 + this.random.nextInt(2); + this.spawnAtLocation(new ItemStack(this.shearDropItem(), count)); + } + private net.minecraft.world.item.Item shearDropItem() { if (this instanceof AppleCowEntityVariants.EnchantedGoldenAppleCow) { return Items.ENCHANTED_GOLDEN_APPLE; diff --git a/common/src/main/java/com/craisinlord/antarchy/content/entity/ToreterrorEntity.java b/common/src/main/java/com/craisinlord/antarchy/content/entity/ToreterrorEntity.java index 19138391..086aa853 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/entity/ToreterrorEntity.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/entity/ToreterrorEntity.java @@ -2,6 +2,7 @@ package com.craisinlord.antarchy.content.entity; import com.craisinlord.antarchy.config.AntarchySettings; import com.craisinlord.antarchy.content.AntarchyObjects; +import com.craisinlord.antarchy.content.AntarchySoundEvents; import com.craisinlord.antarchy.content.damage.AntarchyDamageSources; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -78,7 +79,7 @@ public class ToreterrorEntity extends Monster implements GeoEntity { private static final int RAPID_FIRE_END_TICK = 60; private static final int SHOOT_BOMBER_TICK = 12; private static final int SHOOT_BOMBER_SECOND_TICK = 32; - private static final int JUMP_TOTAL_TICKS = 55; + private static final int JUMP_TOTAL_TICKS = 40; private static final int JUMP_LAUNCH_TICK = 10; private static final int JUMP_SHAKE_TICKS = 12; private static final int SPIN_START_TOTAL_TICKS = 5; @@ -93,8 +94,8 @@ public class ToreterrorEntity extends Monster implements GeoEntity { private static final double RANGED_MAX_RANGE_SQR = 625.0D; private static final double SPIN_TRIGGER_RANGE_SQR = 225.0D; private static final double SPIN_LEASH_RANGE_SQR = 225.0D; - private static final double SPIN_RADIUS = 4.5D; - private static final double SPIN_MOVE_SPEED = 0.833D; + private static final double SPIN_RADIUS = 2.5D; + private static final double SPIN_MOVE_SPEED = 0.65D; private static final double SPIN_ANIMATION_SPEED = 0.49D; private static final double JUMP_SHOCKWAVE_RADIUS = 6.0D; @@ -145,7 +146,8 @@ public class ToreterrorEntity extends Monster implements GeoEntity { .add(Attributes.MOVEMENT_SPEED, 0.325D) .add(Attributes.FOLLOW_RANGE, 48.0D) .add(Attributes.KNOCKBACK_RESISTANCE, 0.85D) - .add(Attributes.ARMOR, 10.0D); + .add(Attributes.ARMOR, 16.0D) + .add(Attributes.ARMOR_TOUGHNESS, 4.0D); } public static boolean canSpawn(EntityType entityType, ServerLevelAccessor level, MobSpawnType spawnReason, BlockPos pos, net.minecraft.util.RandomSource random) { @@ -284,7 +286,22 @@ public class ToreterrorEntity extends Monster implements GeoEntity { return this.entityData.get(JUMP_SHAKING); } -@Override + @Override + protected net.minecraft.sounds.SoundEvent getAmbientSound() { + return AntarchySoundEvents.TORETERROR_IDLE.get(); + } + + @Override + protected net.minecraft.sounds.SoundEvent getHurtSound(DamageSource damageSource) { + return AntarchySoundEvents.TORETERROR_HURT.get(); + } + + @Override + protected net.minecraft.sounds.SoundEvent getDeathSound() { + return AntarchySoundEvents.TORETERROR_DEATH.get(); + } + + @Override public void startSeenByPlayer(ServerPlayer player) { super.startSeenByPlayer(player); this.bossEvent.addPlayer(player); @@ -423,7 +440,7 @@ public class ToreterrorEntity extends Monster implements GeoEntity { LivingEntity target = this.getTarget(); if (target != null) { Vec3 toTarget = target.position().subtract(this.position()).normalize(); - this.setDeltaMovement(toTarget.x * 0.6D, 1.4D, toTarget.z * 0.6D); + this.setDeltaMovement(toTarget.x * 0.6D, 1.15D, toTarget.z * 0.6D); this.hasImpulse = true; } } @@ -431,20 +448,18 @@ public class ToreterrorEntity extends Monster implements GeoEntity { this.jumpAirborne = true; } if (this.jumpLaunched && this.jumpAirborne && !this.shockwaveApplied) { - boolean forceLand = this.jumpAnimTicks <= 1; - if (forceLand) { - BlockPos pos = BlockPos.containing(this.getX(), this.getY(), this.getZ()); - while (pos.getY() > this.level().getMinBuildHeight() && this.level().isEmptyBlock(pos)) { - pos = pos.below(); - } - this.teleportTo(this.getX(), pos.getY() + 1.0, this.getZ()); - this.setDeltaMovement(Vec3.ZERO); - } - if (this.onGround() || forceLand) { + if (this.onGround()) { this.shockwaveApplied = true; this.applyJumpShockwave(); this.jumpShakeTicks = JUMP_SHAKE_TICKS; this.entityData.set(JUMP_SHAKING, true); + } else if (this.jumpAnimTicks <= 10) { + Vec3 vel = this.getDeltaMovement(); + this.setDeltaMovement(vel.x * 0.5D, Math.min(vel.y, -1.5D), vel.z * 0.5D); + this.hasImpulse = true; + if (this.jumpAnimTicks <= 2) { + this.jumpAnimTicks = 2; + } } } this.jumpAnimTicks--; @@ -517,7 +532,7 @@ public class ToreterrorEntity extends Monster implements GeoEntity { this.spinEndTicks--; if (this.spinEndTicks <= 0) { this.stopSpinSequence(); - this.spinCooldown = 260 + this.random.nextInt(80); + this.spinCooldown = 340 + this.random.nextInt(80); this.spinHitCooldowns.clear(); } } @@ -532,7 +547,7 @@ public class ToreterrorEntity extends Monster implements GeoEntity { return; } Vec3 forward = this.spinDirection.lengthSqr() > 1.0E-4D ? this.spinDirection.normalize() : towardTarget; - Vec3 combined = forward.scale(0.95D).add(towardTarget.scale(0.05D)); + Vec3 combined = forward.scale(0.99D).add(towardTarget.scale(0.01D)); this.spinDirection = combined.lengthSqr() > 1.0E-4D ? combined.normalize() : towardTarget; } @@ -703,6 +718,7 @@ public class ToreterrorEntity extends Monster implements GeoEntity { if (!(this.level() instanceof ServerLevel serverLevel)) return; LivingEntity target = this.getTarget(); if (target == null) return; + this.playSound(AntarchySoundEvents.TORETERROR_BOMBER_FIRE.get(), 1.1F, 0.9F + this.random.nextFloat() * 0.15F); int count = 3; for (int i = 0; i < count; i++) { BomberEntity bomber = AntarchyObjects.BOMBER.get().create(this.level()); diff --git a/common/src/main/java/com/craisinlord/antarchy/content/entity/ant/AntTeleportHelper.java b/common/src/main/java/com/craisinlord/antarchy/content/entity/ant/AntTeleportHelper.java index 29dbd29b..d0957941 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/entity/ant/AntTeleportHelper.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/entity/ant/AntTeleportHelper.java @@ -1,18 +1,24 @@ package com.craisinlord.antarchy.content.entity.ant; import com.craisinlord.antarchy.config.AntarchySettings; +import java.util.ArrayList; import java.util.LinkedHashSet; +import java.util.List; import java.util.Set; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceKey; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.PlayerRespawnLogic; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.OwnableEntity; +import net.minecraft.world.entity.TamableAnimal; +import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.DismountHelper; import net.minecraft.world.item.ItemStack; @@ -20,13 +26,78 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.portal.DimensionTransition; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; public final class AntTeleportHelper { + private static final double COMPANION_FOLLOW_RADIUS = 16.0D; + private AntTeleportHelper() { } + public static void teleportPlayerWithCompanions(ServerPlayer player, ServerLevel destination, Vec3 destinationPos) { + Mob vehicle = player.getVehicle() instanceof Mob mob ? mob : null; + List companions = collectCompanions(player); + player.teleportTo(destination, destinationPos.x, destinationPos.y, destinationPos.z, player.getYRot(), player.getXRot()); + Mob movedVehicle = null; + for (Mob companion : companions) { + Mob moved = moveCompanion(companion, destination, destinationPos); + if (companion == vehicle) { + movedVehicle = moved; + } + } + + if (movedVehicle != null) { + player.startRiding(movedVehicle, true); + } + } + + private static List collectCompanions(ServerPlayer player) { + List companions = new ArrayList<>(); + if (player.getVehicle() instanceof Mob vehicle) { + companions.add(vehicle); + } + + for (Mob mob : player.serverLevel().getEntitiesOfClass(Mob.class, player.getBoundingBox().inflate(COMPANION_FOLLOW_RADIUS), mob -> isFollowingPet(mob, player))) { + if (!companions.contains(mob)) { + companions.add(mob); + } + } + + return companions; + } + + private static boolean isFollowingPet(Mob mob, ServerPlayer player) { + if (!mob.isAlive()) { + return false; + } + + if (mob instanceof TamableAnimal tamable) { + return tamable.isTame() && player.getUUID().equals(tamable.getOwnerUUID()) && !tamable.isOrderedToSit(); + } + + if (mob instanceof AbstractHorse horse) { + return horse.isTamed() && player.getUUID().equals(horse.getOwnerUUID()); + } + + return mob instanceof OwnableEntity ownable && player.getUUID().equals(ownable.getOwnerUUID()); + } + + @Nullable + private static Mob moveCompanion(Mob companion, ServerLevel destination, Vec3 destinationPos) { + companion.stopRiding(); + companion.ejectPassengers(); + companion.getNavigation().stop(); + if (companion.level() == destination) { + companion.teleportTo(destinationPos.x, destinationPos.y, destinationPos.z); + return companion; + } + + Entity moved = companion.changeDimension(new DimensionTransition(destination, destinationPos, Vec3.ZERO, companion.getYRot(), companion.getXRot(), DimensionTransition.DO_NOTHING)); + return moved instanceof Mob mob ? mob : null; + } + static InteractionResult handleInteraction(BaseAntEntity ant, Player player, ItemStack itemStack) { if (ant.requiresActivationReagent() && !ant.isTeleportActivatedState()) { if (!(player instanceof ServerPlayer serverPlayer)) { @@ -62,7 +133,7 @@ public final class AntTeleportHelper { } Vec3 destinationPos = getDestinationPosition(serverPlayer, destination); - serverPlayer.teleportTo(destination, destinationPos.x, destinationPos.y, destinationPos.z, serverPlayer.getYRot(), serverPlayer.getXRot()); + teleportPlayerWithCompanions(serverPlayer, destination, destinationPos); serverPlayer.playSound(SoundEvents.ENDERMAN_TELEPORT, 1.0F, 1.0F); return InteractionResult.CONSUME; } diff --git a/common/src/main/java/com/craisinlord/antarchy/content/item/NightmareSwordItem.java b/common/src/main/java/com/craisinlord/antarchy/content/item/NightmareSwordItem.java index 48e09ec4..bff8a536 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/item/NightmareSwordItem.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/item/NightmareSwordItem.java @@ -1,9 +1,11 @@ package com.craisinlord.antarchy.content.item; import com.craisinlord.antarchy.config.AntarchySettings; +import com.craisinlord.antarchy.content.client.NightmareSwordTooltipHelper; import java.util.List; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.SwordItem; @@ -21,6 +23,18 @@ public class NightmareSwordItem extends SwordItem { this.attackSpeed = attackSpeed; } + public static float calculateDamage(LivingEntity attacker) { + float baseDamage = (float) AntarchySettings.nightmareSwordBaseDamage(); + float maxHealth = attacker.getMaxHealth(); + if (maxHealth <= 0.0F) { + return baseDamage; + } + + float missingFraction = (maxHealth - attacker.getHealth()) / maxHealth; + float scalingFactor = (float) AntarchySettings.nightmareSwordScalingFactor(); + return baseDamage + missingFraction * scalingFactor * baseDamage; + } + @Override public ItemAttributeModifiers getDefaultAttributeModifiers() { return SwordItem.createAttributes( @@ -38,6 +52,7 @@ public class NightmareSwordItem extends SwordItem { @Override public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltipComponents, TooltipFlag tooltipFlag) { tooltipComponents.add(Component.translatable("tooltip.antarchy.nightmare_sword").withStyle(ChatFormatting.DARK_RED)); + tooltipComponents.add(NightmareSwordTooltipHelper.damageLine()); super.appendHoverText(stack, context, tooltipComponents, tooltipFlag); } } diff --git a/common/src/main/java/com/craisinlord/antarchy/mixins/NightmareSwordDamageMixin.java b/common/src/main/java/com/craisinlord/antarchy/mixins/NightmareSwordDamageMixin.java new file mode 100644 index 00000000..35040515 --- /dev/null +++ b/common/src/main/java/com/craisinlord/antarchy/mixins/NightmareSwordDamageMixin.java @@ -0,0 +1,30 @@ +package com.craisinlord.antarchy.mixins; + +import com.craisinlord.antarchy.content.item.NightmareSwordItem; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +@Mixin(LivingEntity.class) +public abstract class NightmareSwordDamageMixin { + @ModifyVariable(method = "hurt", at = @At("HEAD"), ordinal = 0, argsOnly = true) + private float antarchy$applyNightmareSwordDamage(float amount, DamageSource source) { + LivingEntity self = (LivingEntity) (Object) this; + if (self.level().isClientSide) { + return amount; + } + + if (!(source.getEntity() instanceof Player attacker)) { + return amount; + } + + if (!(attacker.getMainHandItem().getItem() instanceof NightmareSwordItem)) { + return amount; + } + + return NightmareSwordItem.calculateDamage(attacker); + } +} diff --git a/common/src/main/resources/antarchy-common.mixins.json b/common/src/main/resources/antarchy-common.mixins.json index e738a860..fb56a509 100644 --- a/common/src/main/resources/antarchy-common.mixins.json +++ b/common/src/main/resources/antarchy-common.mixins.json @@ -12,6 +12,7 @@ "FireVisualBaseFireBlockMixin", "FireVisualEntityMixin", "GlowVinesUnderLeavesMixin", + "NightmareSwordDamageMixin", "ServerPlayerGameModeMixin", "SquidzookaEnchantMixin", "SquidzookaMultishotMixin", diff --git a/common/src/main/resources/assets/antarchy/lang/en_us.json b/common/src/main/resources/assets/antarchy/lang/en_us.json index 2832695d..a023eacb 100644 --- a/common/src/main/resources/assets/antarchy/lang/en_us.json +++ b/common/src/main/resources/assets/antarchy/lang/en_us.json @@ -220,6 +220,7 @@ "tooltip.antarchy.nightmare_armor_double_damage": "%s%% chance to deal double damage", "tooltip.antarchy.nightmare_armor_set_bonus": "Full Set: Wither & Dread immunity", "tooltip.antarchy.nightmare_sword": "Deals more damage as your health drops.", + "tooltip.antarchy.nightmare_sword_damage": "Deals %s damage", "tooltip.antarchy.primordial_helmet_water_breathing": "Grants the wearer Water Breathing", "tooltip.antarchy.primordial_armor_knockback_dealt": "Adds %s attack knockback per piece", "tooltip.antarchy.primordial_armor_set_bonus": "Full Set: Attacks ignore enemy knockback resistance", @@ -654,6 +655,10 @@ "subtitles.antarchy.bomber_walk": "Bomber walks", "subtitles.antarchy.bomber_knock": "Bomber gets hit", "subtitles.antarchy.bomber_explode": "Bomber fuse hisses", + "subtitles.antarchy.toreterror_idle": "Toreterror idles", + "subtitles.antarchy.toreterror_hurt": "Toreterror hurts", + "subtitles.antarchy.toreterror_death": "Toreterror dies", + "subtitles.antarchy.toreterror_bomber_fire": "Toreterror launches bombers", "subtitles.antarchy.creeping_horror_growl": "Creeping Horror growls", "subtitles.antarchy.creeping_horror_hurt": "Creeping Horror hurts", "subtitles.antarchy.creeping_horror_bite": "Creeping Horror bites", diff --git a/common/src/main/resources/assets/antarchy/sounds.json b/common/src/main/resources/assets/antarchy/sounds.json index a1d1e750..a2dfd7df 100644 --- a/common/src/main/resources/assets/antarchy/sounds.json +++ b/common/src/main/resources/assets/antarchy/sounds.json @@ -466,6 +466,53 @@ } ] }, + "toreterror_idle": { + "subtitle": "subtitles.antarchy.toreterror_idle", + "sounds": [ + { + "name": "antarchy:mob/toreterror/idle1" + }, + { + "name": "antarchy:mob/toreterror/idle2" + }, + { + "name": "antarchy:mob/toreterror/idle3" + } + ] + }, + "toreterror_hurt": { + "subtitle": "subtitles.antarchy.toreterror_hurt", + "sounds": [ + { + "name": "antarchy:mob/toreterror/hurt1" + }, + { + "name": "antarchy:mob/toreterror/hurt2" + }, + { + "name": "antarchy:mob/toreterror/hurt3" + } + ] + }, + "toreterror_death": { + "subtitle": "subtitles.antarchy.toreterror_death", + "sounds": [ + { + "name": "antarchy:mob/toreterror/death" + } + ] + }, + "toreterror_bomber_fire": { + "subtitle": "subtitles.antarchy.toreterror_bomber_fire", + "sounds": [ + { + "name": "antarchy:mob/toreterror/bomber_fire1" + }, + { + "name": "antarchy:mob/toreterror/bomber_fire2" + } + ] + }, "creeping_horror_growl": { "subtitle": "subtitles.antarchy.creeping_horror_growl", "sounds": [ diff --git a/common/src/main/resources/assets/antarchy/sounds/mob/toreterror/bomber_fire1.ogg b/common/src/main/resources/assets/antarchy/sounds/mob/toreterror/bomber_fire1.ogg new file mode 100644 index 00000000..7a62426e Binary files /dev/null and b/common/src/main/resources/assets/antarchy/sounds/mob/toreterror/bomber_fire1.ogg differ diff --git a/common/src/main/resources/assets/antarchy/sounds/mob/toreterror/bomber_fire2.ogg b/common/src/main/resources/assets/antarchy/sounds/mob/toreterror/bomber_fire2.ogg new file mode 100644 index 00000000..102048ad Binary files /dev/null and b/common/src/main/resources/assets/antarchy/sounds/mob/toreterror/bomber_fire2.ogg differ diff --git a/common/src/main/resources/assets/antarchy/sounds/mob/toreterror/death.ogg b/common/src/main/resources/assets/antarchy/sounds/mob/toreterror/death.ogg index 16d08699..0962e82b 100644 Binary files a/common/src/main/resources/assets/antarchy/sounds/mob/toreterror/death.ogg and b/common/src/main/resources/assets/antarchy/sounds/mob/toreterror/death.ogg differ diff --git a/common/src/main/resources/data/antarchy/dimension/elythia.json b/common/src/main/resources/data/antarchy/dimension/elythia.json index dc015266..551c88de 100644 --- a/common/src/main/resources/data/antarchy/dimension/elythia.json +++ b/common/src/main/resources/data/antarchy/dimension/elythia.json @@ -485,7 +485,7 @@ "humidity": 0.85, "continentalness": -0.88, "erosion": 0.20, - "weirdness": 0.60, + "weirdness": 0.50, "depth": 0.0, "offset": 0.0 } @@ -497,7 +497,7 @@ "humidity": 0.82, "continentalness": -0.90, "erosion": 0.15, - "weirdness": -0.65, + "weirdness": -0.55, "depth": 0.0, "offset": 0.0 } @@ -509,7 +509,7 @@ "humidity": 0.85, "continentalness": -0.88, "erosion": 0.20, - "weirdness": 0.60, + "weirdness": 0.50, "depth": 0.5, "offset": 0.0 } @@ -521,7 +521,7 @@ "humidity": 0.82, "continentalness": -0.90, "erosion": 0.15, - "weirdness": -0.65, + "weirdness": -0.55, "depth": 0.5, "offset": 0.0 } diff --git a/common/src/main/resources/data/antarchy/loot_table/entities/apple_cow.json b/common/src/main/resources/data/antarchy/loot_table/entities/apple_cow.json index 40a7b375..a7437c82 100644 --- a/common/src/main/resources/data/antarchy/loot_table/entities/apple_cow.json +++ b/common/src/main/resources/data/antarchy/loot_table/entities/apple_cow.json @@ -70,37 +70,6 @@ ] } ] - }, - { - "rolls": 1, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "minecraft:flags": { - "is_baby": false, - "sheared": false - } - } - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:apple", - "functions": [ - { - "function": "minecraft:set_count", - "count": { - "type": "minecraft:uniform", - "min": 1.0, - "max": 2.0 - } - } - ] - } - ] } ] } diff --git a/common/src/main/resources/data/antarchy/loot_table/entities/cheep.json b/common/src/main/resources/data/antarchy/loot_table/entities/cheep.json index 213089f6..9c830ca5 100644 --- a/common/src/main/resources/data/antarchy/loot_table/entities/cheep.json +++ b/common/src/main/resources/data/antarchy/loot_table/entities/cheep.json @@ -1,25 +1,5 @@ { "type": "minecraft:entity", - "pools": [ - { - "rolls": 1.0, - "entries": [ - { - "type": "minecraft:item", - "name": "antarchy:cheep" - } - ], - "functions": [ - { - "function": "minecraft:set_count", - "count": { - "type": "minecraft:uniform", - "min": 1.0, - "max": 1.0 - } - } - ] - } - ], + "pools": [], "random_sequence": "antarchy:entities/cheep" } diff --git a/common/src/main/resources/data/antarchy/loot_table/entities/enchanted_golden_apple_cow.json b/common/src/main/resources/data/antarchy/loot_table/entities/enchanted_golden_apple_cow.json index 594bf75b..a7437c82 100644 --- a/common/src/main/resources/data/antarchy/loot_table/entities/enchanted_golden_apple_cow.json +++ b/common/src/main/resources/data/antarchy/loot_table/entities/enchanted_golden_apple_cow.json @@ -70,35 +70,6 @@ ] } ] - }, - { - "rolls": 1, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "minecraft:flags": { - "is_baby": false - }, - "antarchy:apple_cow": { - "sheared": false - } - } - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:enchanted_golden_apple", - "functions": [ - { - "function": "minecraft:set_count", - "count": 1 - } - ] - } - ] } ] } diff --git a/common/src/main/resources/data/antarchy/loot_table/entities/golden_apple_cow.json b/common/src/main/resources/data/antarchy/loot_table/entities/golden_apple_cow.json index 27801152..a7437c82 100644 --- a/common/src/main/resources/data/antarchy/loot_table/entities/golden_apple_cow.json +++ b/common/src/main/resources/data/antarchy/loot_table/entities/golden_apple_cow.json @@ -70,39 +70,6 @@ ] } ] - }, - { - "rolls": 1, - "conditions": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "minecraft:flags": { - "is_baby": false - }, - "antarchy:apple_cow": { - "sheared": false - } - } - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:golden_apple", - "functions": [ - { - "function": "minecraft:set_count", - "count": { - "type": "minecraft:uniform", - "min": 1.0, - "max": 2.0 - } - } - ] - } - ] } ] } diff --git a/common/src/main/resources/data/antarchy/structure/toreterror_arena/toreterror_arena.nbt b/common/src/main/resources/data/antarchy/structure/toreterror_arena/toreterror_arena.nbt index f36059d3..2a2e871f 100644 Binary files a/common/src/main/resources/data/antarchy/structure/toreterror_arena/toreterror_arena.nbt and b/common/src/main/resources/data/antarchy/structure/toreterror_arena/toreterror_arena.nbt differ diff --git a/common/src/main/resources/data/antarchy/structure/trayaurus_lab/trayaurus_lab_bottom.nbt b/common/src/main/resources/data/antarchy/structure/trayaurus_lab/trayaurus_lab_bottom.nbt index 972d9cde..e30dedf0 100644 Binary files a/common/src/main/resources/data/antarchy/structure/trayaurus_lab/trayaurus_lab_bottom.nbt and b/common/src/main/resources/data/antarchy/structure/trayaurus_lab/trayaurus_lab_bottom.nbt differ diff --git a/common/src/main/resources/data/antarchy/worldgen/biome/elythia_beach.json b/common/src/main/resources/data/antarchy/worldgen/biome/elythia_beach.json index 486932e0..2f185cc5 100644 --- a/common/src/main/resources/data/antarchy/worldgen/biome/elythia_beach.json +++ b/common/src/main/resources/data/antarchy/worldgen/biome/elythia_beach.json @@ -51,7 +51,9 @@ "antarchy:elythia_underground" ], [], - [], + [ + "minecraft:patch_sugar_cane" + ], [] ], "creature_spawn_probability": 0.04, diff --git a/common/src/main/resources/data/antarchy/worldgen/biome/elythia_meadow.json b/common/src/main/resources/data/antarchy/worldgen/biome/elythia_meadow.json index ae92b86f..ef2c2ebd 100644 --- a/common/src/main/resources/data/antarchy/worldgen/biome/elythia_meadow.json +++ b/common/src/main/resources/data/antarchy/worldgen/biome/elythia_meadow.json @@ -62,7 +62,8 @@ "antarchy:elythia_large_tuff_boulders", "antarchy:elythia_tuff_boulders", "antarchy:elythia_meadow_flora", - "antarchy:elythia_brown_ant_nests" + "antarchy:elythia_brown_ant_nests", + "minecraft:patch_sugar_cane" ], [] ], @@ -133,7 +134,7 @@ } ], "water_ambient": [ - { "type": "antarchy:cheep", "weight": 20, "minCount": 4, "maxCount": 8 }, + { "type": "antarchy:cheep", "weight": 10, "minCount": 3, "maxCount": 6 }, { "type": "minecraft:tropical_fish", "weight": 20, "minCount": 4, "maxCount": 8 } ], "misc": [] diff --git a/common/src/main/resources/data/antarchy/worldgen/biome/elythia_ocean.json b/common/src/main/resources/data/antarchy/worldgen/biome/elythia_ocean.json index d8ffd3cf..c22a5def 100644 --- a/common/src/main/resources/data/antarchy/worldgen/biome/elythia_ocean.json +++ b/common/src/main/resources/data/antarchy/worldgen/biome/elythia_ocean.json @@ -53,7 +53,8 @@ [], [ "minecraft:sea_pickle", - "minecraft:warm_ocean_vegetation" + "minecraft:warm_ocean_vegetation", + "minecraft:kelp_warm" ], [] ], @@ -71,7 +72,7 @@ { "type": "minecraft:turtle", "weight": 5, "minCount": 1, "maxCount": 2 }, { "type": "antarchy:octopus_bomb", "weight": 4, "minCount": 1, "maxCount": 2 }], "water_ambient": [ - { "type": "antarchy:cheep", "weight": 20, "minCount": 4, "maxCount": 8 }, + { "type": "antarchy:cheep", "weight": 10, "minCount": 3, "maxCount": 6 }, { "type": "minecraft:tropical_fish", "weight": 20, "minCount": 4, "maxCount": 8 } ], "misc": [] diff --git a/common/src/main/resources/data/antarchy/worldgen/biome/elythia_river.json b/common/src/main/resources/data/antarchy/worldgen/biome/elythia_river.json index 5b3787de..8b8caa79 100644 --- a/common/src/main/resources/data/antarchy/worldgen/biome/elythia_river.json +++ b/common/src/main/resources/data/antarchy/worldgen/biome/elythia_river.json @@ -54,7 +54,8 @@ ], [], [ - "antarchy:elythia_meadow_flora" + "antarchy:elythia_meadow_flora", + "minecraft:patch_sugar_cane" ], [] ], diff --git a/common/src/main/resources/data/antarchy/worldgen/biome/ouranwood_forest.json b/common/src/main/resources/data/antarchy/worldgen/biome/ouranwood_forest.json index 62235ae6..0a1aa928 100644 --- a/common/src/main/resources/data/antarchy/worldgen/biome/ouranwood_forest.json +++ b/common/src/main/resources/data/antarchy/worldgen/biome/ouranwood_forest.json @@ -109,7 +109,7 @@ "maxCount": 1 }], "water_ambient": [ - { "type": "antarchy:cheep", "weight": 20, "minCount": 4, "maxCount": 8 }, + { "type": "antarchy:cheep", "weight": 10, "minCount": 3, "maxCount": 6 }, { "type": "minecraft:tropical_fish", "weight": 20, "minCount": 4, "maxCount": 8 }], "misc": [] } diff --git a/common/src/main/resources/data/minecraft/tags/item/fishes.json b/common/src/main/resources/data/minecraft/tags/item/fishes.json deleted file mode 100644 index 12df0487..00000000 --- a/common/src/main/resources/data/minecraft/tags/item/fishes.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "antarchy:cheep" - ] -} diff --git a/fabric/build.gradle b/fabric/build.gradle index 0738b295..73467fe4 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -23,22 +23,22 @@ dependencies { modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" modImplementation "software.bernie.geckolib:geckolib-fabric-${project.minecraft_version}:${project.geckolib_version}" compileOnly("curse.maven:intapi-${project.intapi_curseforge_id}:${project.intapi_curseforge_file_id_neoforge}") - compileOnly("curse.maven:create-${project.create_curseforge_id_neoforge}:${project.create_curseforge_file_id_neoforge}") - compileOnly("curse.maven:marvel-${project.marvel_curseforge_id}:${project.marvel_curseforge_file_id}") - compileOnly("curse.maven:stellaris-${project.stellaris_curseforge_id}:${project.stellaris_curseforge_file_id}") - compileOnly("curse.maven:aperture-${project.aperture_curseforge_id}:${project.aperture_curseforge_file_id}") - compileOnly("curse.maven:inventory_pets-${project.inventory_pets_curseforge_id}:${project.inventory_pets_curseforge_file_id}") - compileOnly("curse.maven:cataclysm-${project.cataclysm_curseforge_id}:${project.cataclysm_curseforge_file_id}") - compileOnly("curse.maven:iaf-${project.iaf_curseforge_id}:${project.iaf_curseforge_file_id}") - compileOnly("curse.maven:backpack-${project.backpack_curseforge_id}:${project.backpack_curseforge_file_id}") - compileOnly("curse.maven:regions_unexplored-${project.regions_unexplored_curseforge_id}:${project.regions_unexplored_curseforge_file_id}") +// compileOnly("curse.maven:create-${project.create_curseforge_id_neoforge}:${project.create_curseforge_file_id_neoforge}") +// compileOnly("curse.maven:marvel-${project.marvel_curseforge_id}:${project.marvel_curseforge_file_id}") +// compileOnly("curse.maven:stellaris-${project.stellaris_curseforge_id}:${project.stellaris_curseforge_file_id}") +// compileOnly("curse.maven:aperture-${project.aperture_curseforge_id}:${project.aperture_curseforge_file_id}") +// compileOnly("curse.maven:inventory_pets-${project.inventory_pets_curseforge_id}:${project.inventory_pets_curseforge_file_id}") +// compileOnly("curse.maven:cataclysm-${project.cataclysm_curseforge_id}:${project.cataclysm_curseforge_file_id}") +// compileOnly("curse.maven:iaf-${project.iaf_curseforge_id}:${project.iaf_curseforge_file_id}") +// compileOnly("curse.maven:backpack-${project.backpack_curseforge_id}:${project.backpack_curseforge_file_id}") +// compileOnly("curse.maven:regions_unexplored-${project.regions_unexplored_curseforge_id}:${project.regions_unexplored_curseforge_file_id}") compileOnly(files("$rootDir/infinite_dimensions_jars/infinity-2.7.1+1.21.1-neoforge.jar")) compileOnly(files("$rootDir/infinite_dimensions_jars/infinity-2.7.1+1.21.1-neoforge-sources.jar")) compileOnly(files("$rootDir/infinite_dimensions_jars/gravity-api-1.0.7-1.20.1.jar")) - compileOnly(files("$rootDir/infinite_dimensions_jars/Cloro's Gravity Gun Mod (Release 1.3.1).jar")) - compileOnly(files("$rootDir/infinite_dimensions_jars/VanillaBackport-neoforge-1.21.1-1.1.7.6.jar")) - compileOnly(files("$rootDir/infinite_dimensions_jars/soul-fire-d-neoforge-1.21-6.1.0.jar")) - compileOnly(files("$rootDir/infinite_dimensions_jars/prometheus-neoforge-1.21-1.2.5.jar")) +// compileOnly(files("$rootDir/infinite_dimensions_jars/Cloro's Gravity Gun Mod (Release 1.3.1).jar")) +// compileOnly(files("$rootDir/infinite_dimensions_jars/VanillaBackport-neoforge-1.21.1-1.1.7.6.jar")) +// compileOnly(files("$rootDir/infinite_dimensions_jars/soul-fire-d-neoforge-1.21-6.1.0.jar")) +// compileOnly(files("$rootDir/infinite_dimensions_jars/prometheus-neoforge-1.21-1.2.5.jar")) compileOnly(files("$rootDir/infinite_dimensions_jars/cloth-config-15.0.140-fabric.jar")) compileOnly(files("$rootDir/infinite_dimensions_jars/sable-neoforge-1.21.1-2.0.3.jar")) diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyConfigModuleFabric.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyConfigModuleFabric.java index c2f8a0d4..898fc485 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyConfigModuleFabric.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyConfigModuleFabric.java @@ -2,6 +2,7 @@ package com.craisinlord.antarchy.fabric; import com.craisinlord.antarchy.Antarchy; import com.craisinlord.antarchy.config.AntarchySettings; +import com.craisinlord.antarchy.config.ConfigResetGuard; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; @@ -35,6 +36,13 @@ public final class AntarchyConfigModuleFabric { } public static void init() { + ConfigResetGuard.wipeIfNeeded( + CONFIG_DIR, + ConfigSection.MOBS.path, + ConfigSection.TOOLS.path, + ConfigSection.MISC.path, + LEGACY_CONFIG_PATH + ); JsonObject legacy = readConfig(LEGACY_CONFIG_PATH); Map loaded = new LinkedHashMap<>(); Map normalized = new LinkedHashMap<>(); diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricContent.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricContent.java index 3ed3ad6d..dbb19dd4 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricContent.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricContent.java @@ -396,6 +396,10 @@ public final class AntarchyFabricContent { public static final DeferredHolder BOMBER_WALK = registerSoundEvent("bomber_walk"); public static final DeferredHolder BOMBER_KNOCK = registerSoundEvent("bomber_knock"); public static final DeferredHolder BOMBER_EXPLODE = registerSoundEvent("bomber_explode"); + public static final DeferredHolder TORETERROR_IDLE = registerSoundEvent("toreterror_idle"); + public static final DeferredHolder TORETERROR_HURT = registerSoundEvent("toreterror_hurt"); + public static final DeferredHolder TORETERROR_DEATH = registerSoundEvent("toreterror_death"); + public static final DeferredHolder TORETERROR_BOMBER_FIRE = registerSoundEvent("toreterror_bomber_fire"); public static final DeferredHolder STINKY_FLY_SOUND = registerSoundEvent("stinky_fly"); public static final DeferredHolder CREEPING_HORROR_GROWL = registerSoundEvent("creeping_horror_growl"); public static final DeferredHolder CREEPING_HORROR_HURT = registerSoundEvent("creeping_horror_hurt"); @@ -1814,7 +1818,7 @@ public final class AntarchyFabricContent { () -> new DeferredSpawnEggItem(LURKING_TERROR, 0x2D5A1B, 0x8B0000, new Item.Properties())); public static final DeferredHolder, EntityType> CHEEP = ENTITY_TYPES.register("cheep", - () -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.CheepEntity::new, MobCategory.WATER_CREATURE) + () -> EntityType.Builder.of(com.craisinlord.antarchy.content.entity.CheepEntity::new, MobCategory.WATER_AMBIENT) .sized(1.0F, 1.2F) .clientTrackingRange(8) .build("cheep")); @@ -1828,8 +1832,6 @@ public final class AntarchyFabricContent { .sized(3.0F, 4.0F) .clientTrackingRange(12) .build("hercules_beetle")); - public static final DeferredItem CHEEP_ITEM = ITEMS.register("cheep", - () -> new Item(new Item.Properties().food(new FoodProperties.Builder().nutrition(2).saturationModifier(0.2F).build()))); public static final DeferredItem CHEEP_SPAWN_EGG = ITEMS.register("cheep_spawn_egg", () -> new DeferredSpawnEggItem(CHEEP, 0xFF00AA, 0x00FF44, new Item.Properties())); public static final DeferredItem DORRIE_SPAWN_EGG = ITEMS.register("dorrie_spawn_egg", @@ -1968,6 +1970,7 @@ public final class AntarchyFabricContent { SpawnPlacements.register(KRAKEN.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, KrakenEntity::canSpawn); SpawnPlacements.register(MISSILE_SQUID.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, MissileSquidEntity::canSpawn); SpawnPlacements.register(OCTOPUS_BOMB.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, OctopusBombEntity::canSpawn); + SpawnPlacements.register(CHEEP.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, net.minecraft.world.entity.animal.AbstractFish::checkSurfaceWaterAnimalSpawnRules); SpawnPlacements.register(NIGHTMARE.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, NightmareEntity::canSpawn); SpawnPlacements.register(MOLEWORM.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, MolewormEntity::canSpawn); SpawnPlacements.register(MANTIS.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, MantisEntity::canSpawn); @@ -2081,7 +2084,6 @@ public final class AntarchyFabricContent { "hercules_beetle_spawn_egg", "creeping_horror_spawn_egg", "lurking_terror_spawn_egg" -> 90; case "stink_bug", "chiten" -> 22; - case "cheep" -> 21; case "water_cannon" -> 52; case "primordial_helmet", "primordial_chestplate", "primordial_leggings", "primordial_boots" -> 53; case "jumpy_boots" -> 54; @@ -2367,7 +2369,6 @@ public final class AntarchyFabricContent { CREATIVE_MODE_TABS.register(); // Wire common-module accessors after all registrations are complete. - AntarchyObjects.CHEEP_ITEM = () -> CHEEP_ITEM.get(); AntarchyObjects.setHerculesBeetle(() -> HERCULES_BEETLE.get()); AntarchySoundEvents.bind( @@ -2484,6 +2485,10 @@ public final class AntarchyFabricContent { BOMBER_WALK, BOMBER_KNOCK, BOMBER_EXPLODE, + TORETERROR_IDLE, + TORETERROR_HURT, + TORETERROR_DEATH, + TORETERROR_BOMBER_FIRE, STINKY_FLY_SOUND, CREEPING_HORROR_GROWL, CREEPING_HORROR_HURT, diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyConfigModuleNeoforge.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyConfigModuleNeoforge.java index 8302837d..05e0a1bb 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyConfigModuleNeoforge.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyConfigModuleNeoforge.java @@ -1,8 +1,11 @@ package com.craisinlord.antarchy.neoforge; import com.craisinlord.antarchy.config.AntarchySettings; +import com.craisinlord.antarchy.config.ConfigResetGuard; import com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakePayload; import com.craisinlord.antarchy.content.network.HerculesBeetleImpactShakeSync; +import java.nio.file.Path; +import net.neoforged.fml.loading.FMLPaths; import net.neoforged.neoforge.network.PacketDistributor; import net.neoforged.fml.ModContainer; import net.neoforged.fml.config.ModConfig; @@ -12,6 +15,13 @@ public final class AntarchyConfigModuleNeoforge { private AntarchyConfigModuleNeoforge() {} public static void init(ModContainer modContainer) { + Path configDir = FMLPaths.CONFIGDIR.get().resolve("antarchy"); + ConfigResetGuard.wipeIfNeeded( + configDir, + configDir.resolve("antarchy_mobs.toml"), + configDir.resolve("antarchy_tools.toml"), + configDir.resolve("antarchy_misc.toml") + ); modContainer.registerConfig(ModConfig.Type.COMMON, AntarchyMobsConfig.SPEC, "antarchy/antarchy_mobs.toml"); modContainer.registerConfig(ModConfig.Type.COMMON, AntarchyToolsConfig.SPEC, "antarchy/antarchy_tools.toml"); modContainer.registerConfig(ModConfig.Type.COMMON, AntarchyMiscConfig.SPEC, "antarchy/antarchy_misc.toml"); diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyNeoforge.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyNeoforge.java index 2f27acd1..a7834edb 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyNeoforge.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyNeoforge.java @@ -137,6 +137,10 @@ public class AntarchyNeoforge { AntarchyNeoforgeSounds.BOMBER_WALK, AntarchyNeoforgeSounds.BOMBER_KNOCK, AntarchyNeoforgeSounds.BOMBER_EXPLODE, + AntarchyNeoforgeSounds.TORETERROR_IDLE, + AntarchyNeoforgeSounds.TORETERROR_HURT, + AntarchyNeoforgeSounds.TORETERROR_DEATH, + AntarchyNeoforgeSounds.TORETERROR_BOMBER_FIRE, AntarchyNeoforgeSounds.STINKY_FLY, AntarchyNeoforgeSounds.CREEPING_HORROR_GROWL, AntarchyNeoforgeSounds.CREEPING_HORROR_HURT, diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoForgeEvents.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoForgeEvents.java index 99f897ef..618d228e 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoForgeEvents.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoForgeEvents.java @@ -74,7 +74,6 @@ public final class AntarchyNeoForgeEvents { NeoForge.EVENT_BUS.addListener(AntarchyNeoForgeEvents::onInvertedEffectExpired); NeoForge.EVENT_BUS.addListener(AntarchyNeoForgeEvents::handleUltimateBowDamage); NeoForge.EVENT_BUS.addListener(AntarchyNeoForgeEvents::handleUltimateCrossbowDamage); - NeoForge.EVENT_BUS.addListener(AntarchyNeoForgeEvents::handleNightmareSwordDamage); NeoForge.EVENT_BUS.addListener(AntarchyNeoForgeEvents::handleNightmareArmorDoubleDamage); NeoForge.EVENT_BUS.addListener(AntarchyNeoForgeEvents::handleScorpionWhipAttackEntity); NeoForge.EVENT_BUS.addListener(AntarchyNeoForgeEvents::handleScorpionWhipLeftClickBlock); @@ -672,19 +671,6 @@ public final class AntarchyNeoForgeEvents { } - static void handleNightmareSwordDamage(LivingIncomingDamageEvent event) { - net.minecraft.world.damagesource.DamageSource source = event.getSource(); - if (!(source.getEntity() instanceof Player attacker)) return; - if (!(attacker.getMainHandItem().getItem() instanceof NightmareSwordItem)) return; - - float maxHealth = attacker.getMaxHealth(); - if (maxHealth <= 0) return; - float missingFraction = (maxHealth - attacker.getHealth()) / maxHealth; - float baseDamage = (float) AntarchySettings.nightmareSwordBaseDamage(); - float scalingFactor = (float) AntarchySettings.nightmareSwordScalingFactor(); - - event.setAmount(baseDamage + missingFraction * scalingFactor * baseDamage); - } static void handleNightmareArmorDoubleDamage(LivingIncomingDamageEvent event) { net.minecraft.world.damagesource.DamageSource source = event.getSource(); diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeCreativeModeTabs.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeCreativeModeTabs.java index 829907a5..98f4fcba 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeCreativeModeTabs.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeCreativeModeTabs.java @@ -144,7 +144,6 @@ public class AntarchyNeoforgeCreativeModeTabs { event.accept(AntarchyNeoforgeItems.MOLEVORE_NOSE.get()); event.accept(AntarchyNeoforgeItems.MOLEWORM_ITEM.get()); event.accept(AntarchyNeoforgeItems.MUD_PIE.get()); - event.accept(AntarchyNeoforgeItems.CHEEP.get()); event.accept(AntarchyNeoforgeItems.LUCID_EYE.get()); event.accept(AntarchyNeoforgeItems.BLOOD_CRYSTAL_SHARD.get()); event.accept(AntarchyNeoforgeItems.BLOOD_CRYSTAL_APPLE.get()); @@ -436,7 +435,7 @@ public class AntarchyNeoforgeCreativeModeTabs { case "ultimate_bow", "ultimate_crossbow" -> 20; // 21 - Foods - case "cloud_shark_fin_soup", "mud_pie", "cheep", "rainbow_sugar", + case "cloud_shark_fin_soup", "mud_pie", "rainbow_sugar", "blood_crystal_apple" -> 21; // 22 - Crafting ingredients diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeEntites.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeEntites.java index cad5b817..bd7aa921 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeEntites.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeEntites.java @@ -303,7 +303,7 @@ public final class AntarchyNeoforgeEntites { .clientTrackingRange(10) .build("lurking_terror")); public static final DeferredHolder, EntityType> CHEEP = ENTITY_TYPES.register("cheep", - () -> EntityType.Builder.of(CheepEntity::new, MobCategory.WATER_CREATURE) + () -> EntityType.Builder.of(CheepEntity::new, MobCategory.WATER_AMBIENT) .sized(1.0F, 1.2F) .clientTrackingRange(8) .build("cheep")); diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeItems.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeItems.java index 03125724..17559a02 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeItems.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeItems.java @@ -362,12 +362,6 @@ public final class AntarchyNeoforgeItems { public static final DeferredItem URANIUM_INGOT = ITEMS.registerSimpleItem("uranium_ingot", new Item.Properties().rarity(Rarity.UNCOMMON).fireResistant()); public static final DeferredItem TITANIUM_INGOT = ITEMS.registerSimpleItem("titanium_ingot", new Item.Properties().rarity(Rarity.UNCOMMON).fireResistant()); public static final DeferredItem MOLEVORE_NOSE = ITEMS.registerSimpleItem("molevore_nose", new Item.Properties().rarity(Rarity.RARE)); - public static final DeferredItem CHEEP = ITEMS.register("cheep", - () -> new Item(new Item.Properties() - .food(new FoodProperties.Builder() - .nutrition(2) - .saturationModifier(0.2F) - .build()))); public static final DeferredItem MOLEWORM_ITEM = ITEMS.register("moleworm", () -> new Item(new Item.Properties() .food(new FoodProperties.Builder() diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeSounds.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeSounds.java index d2c1cb47..f42d866b 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeSounds.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeSounds.java @@ -124,6 +124,10 @@ public final class AntarchyNeoforgeSounds { public static final DeferredHolder BOMBER_WALK = registerSoundEvent("bomber_walk"); public static final DeferredHolder BOMBER_KNOCK = registerSoundEvent("bomber_knock"); public static final DeferredHolder BOMBER_EXPLODE = registerSoundEvent("bomber_explode"); + public static final DeferredHolder TORETERROR_IDLE = registerSoundEvent("toreterror_idle"); + public static final DeferredHolder TORETERROR_HURT = registerSoundEvent("toreterror_hurt"); + public static final DeferredHolder TORETERROR_DEATH = registerSoundEvent("toreterror_death"); + public static final DeferredHolder TORETERROR_BOMBER_FIRE = registerSoundEvent("toreterror_bomber_fire"); public static final DeferredHolder STINKY_FLY = registerSoundEvent("stinky_fly"); public static final DeferredHolder CREEPING_HORROR_GROWL = registerSoundEvent("creeping_horror_growl"); public static final DeferredHolder CREEPING_HORROR_HURT = registerSoundEvent("creeping_horror_hurt");