Toreterror changes

Remove cheep item
fix cheep spawning
nightmare sword tooltip
apple cow sheared drop fix
This commit is contained in:
craisinlord committed 2026-07-05 18:35:25 -05:00
1 parent dc2c4cf014
commit 84bf436434
40 files changed
+411 -209

No files matched your search

+13 -12
View File
@@ -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'
@@ -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;
@@ -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);
}
}
}
@@ -122,6 +122,10 @@ public final class AntarchySoundEvents {
public static Supplier<SoundEvent> BOMBER_WALK = (Supplier<SoundEvent>) UNBOUND;
public static Supplier<SoundEvent> BOMBER_KNOCK = (Supplier<SoundEvent>) UNBOUND;
public static Supplier<SoundEvent> BOMBER_EXPLODE = (Supplier<SoundEvent>) UNBOUND;
public static Supplier<SoundEvent> TORETERROR_IDLE = (Supplier<SoundEvent>) UNBOUND;
public static Supplier<SoundEvent> TORETERROR_HURT = (Supplier<SoundEvent>) UNBOUND;
public static Supplier<SoundEvent> TORETERROR_DEATH = (Supplier<SoundEvent>) UNBOUND;
public static Supplier<SoundEvent> TORETERROR_BOMBER_FIRE = (Supplier<SoundEvent>) UNBOUND;
public static Supplier<SoundEvent> STINKY_FLY = (Supplier<SoundEvent>) UNBOUND;
public static Supplier<SoundEvent> CREEPING_HORROR_GROWL = (Supplier<SoundEvent>) UNBOUND;
public static Supplier<SoundEvent> CREEPING_HORROR_HURT = (Supplier<SoundEvent>) UNBOUND;
@@ -249,6 +253,10 @@ public final class AntarchySoundEvents {
Supplier<SoundEvent> bomberWalk,
Supplier<SoundEvent> bomberKnock,
Supplier<SoundEvent> bomberExplode,
Supplier<SoundEvent> toreterrorIdle,
Supplier<SoundEvent> toreterrorHurt,
Supplier<SoundEvent> toreterrorDeath,
Supplier<SoundEvent> toreterrorBomberFire,
Supplier<SoundEvent> stinkyFly,
Supplier<SoundEvent> creepingHorrorGrowl,
Supplier<SoundEvent> 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;
@@ -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);
}
}
@@ -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);
}
}
@@ -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;
@@ -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<ToreterrorEntity> 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());
@@ -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<Mob> 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<Mob> collectCompanions(ServerPlayer player) {
List<Mob> 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;
}
@@ -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<Component> 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);
}
}
@@ -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);
}
}
@@ -12,6 +12,7 @@
"FireVisualBaseFireBlockMixin",
"FireVisualEntityMixin",
"GlowVinesUnderLeavesMixin",
"NightmareSwordDamageMixin",
"ServerPlayerGameModeMixin",
"SquidzookaEnchantMixin",
"SquidzookaMultishotMixin",
@@ -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",
@@ -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": [
@@ -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
}
@@ -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
}
}
]
}
]
}
]
}
@@ -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"
}
@@ -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
}
]
}
]
}
]
}
@@ -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
}
}
]
}
]
}
]
}
@@ -51,7 +51,9 @@
"antarchy:elythia_underground"
],
[],
[],
[
"minecraft:patch_sugar_cane"
],
[]
],
"creature_spawn_probability": 0.04,
@@ -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": []
@@ -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": []
@@ -54,7 +54,8 @@
],
[],
[
"antarchy:elythia_meadow_flora"
"antarchy:elythia_meadow_flora",
"minecraft:patch_sugar_cane"
],
[]
],
@@ -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": []
}
@@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"antarchy:cheep"
]
}