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 e46f1c26..c69b958b 100644 --- a/common/src/main/java/com/craisinlord/antarchy/config/AntarchySettings.java +++ b/common/src/main/java/com/craisinlord/antarchy/config/AntarchySettings.java @@ -18,6 +18,8 @@ public final class AntarchySettings { private static boolean glowingTorchflowers = true; private static boolean glowVinesUnderLeaves = true; private static boolean swingThroughGrassEnabled = true; + private static boolean fabricKeybindingConflictFixEnabled = true; + private static boolean experimentalSettingsPopupDisabled = true; private static boolean sizeChangingRaysEnabled = true; private static double sizeRayMinScale = 0.1D; private static double sizeRayMaxScale = 10.0D; @@ -49,11 +51,11 @@ public final class AntarchySettings { private static double ultimateCrossbowAttackDamage = 8.0D; private static double ultimateCrossbowChargeSpeedMultiplier = 0.25D; private static double ultimateMaceDamageMultiplier = 1.5D; - private static double battleAxeAttackDamage = 44.0D; + private static double battleAxeAttackDamage = 46.0D; private static double bigBerthaAttackDamage = 55.0D; private static double bigBerthaReachBonus = 3.0D; private static double bigBerthaAttackSpeed = -3.0D; - private static double attitudeAdjusterBaseDamage = 40.0D; + private static double attitudeAdjusterBaseDamage = 47.0D; private static boolean attitudeAdjusterBreaksBlocks = true; private static double krakensGraspAttackDamage = 16.0D; private static double krakensGraspAttackSpeed = -2.9D; @@ -119,11 +121,15 @@ public final class AntarchySettings { private static double alphaMantisFlyingSpeed = 0.77D; private static int alphaMantisSummonIntervalTicks = 300; private static int alphaMantisMaxMinions = 4; - private static double rollyPollyHealth = 12.0D; + private static double rollyPollyHealth = 25.0D; private static double rollyPollyMovementSpeed = 0.3D; private static double rollyPollyRollSpeedMultiplier = 2.2D; private static double rollyPollyTumbleDamage = 1.0D; private static int rollyPollyTameChance = 3; + private static double rollyPollyBowlingDamage = 3.0D; + private static double rollyPollyBowlingKnockback = 0.8D; + private static double rollyPollyArmor = 2.0D; + private static double rollyPollyRolledArmorBonus = 16.0D; private static double krakenProjectileDamageTakenMultiplier = 0.5D; private static boolean krakenSquidSpawnEnabled = true; private static boolean krakenMassSpawnEnabled = true; @@ -168,6 +174,7 @@ public final class AntarchySettings { private static double dreamSandGravityMultiplier = 0.45D; private static double dreamSandFallDamageMultiplier = 0.35D; private static double dreamSandEffectDurationSeconds = 7.0D; + private static double dreamSandFallingBlockGravityMultiplier = 0.4D; private static boolean ichorWitherEnabled = true; private static int nightmareHelmetArmorValue = 3; private static int nightmareChestplateArmorValue = 8; @@ -273,7 +280,7 @@ public final class AntarchySettings { private static double emperorScorpionMovementSpeed = 0.384D; private static double emperorScorpionArmor = 22.0D; private static double emperorScorpionKnockbackResistance = 0.8D; - private static double emperorScorpionFollowRange = 40.0D; + private static double emperorScorpionFollowRange = 80.0D; private static int emperorScorpionXpReward = 25; private static int emperorScorpionClawAnimTicks = 23; private static int emperorScorpionClawHitTick = 12; @@ -284,7 +291,9 @@ public final class AntarchySettings { private static int emperorScorpionPoisonTicks = 300; private static int emperorScorpionWeaknessTicks = 120; private static int emperorScorpionSummonIntervalTicks = 140; - private static int emperorScorpionMaxSummonedScorpions = 8; + private static int emperorScorpionMaxSummonedScorpions = 4; + private static int emperorScorpionMaxNearbyScorpions = 3; + private static int emperorScorpionHardenCooldownTicks = 2400; private static double scorpionHealth = 30.0D; private static double scorpionAttackDamage = 5.0D; private static double scorpionMovementSpeed = 0.29D; @@ -581,6 +590,14 @@ public final class AntarchySettings { return swingThroughGrassEnabled; } + public static boolean fabricKeybindingConflictFixEnabled() { + return fabricKeybindingConflictFixEnabled; + } + + public static boolean experimentalSettingsPopupDisabled() { + return experimentalSettingsPopupDisabled; + } + public static boolean sizeChangingRaysEnabled() { return sizeChangingRaysEnabled; } @@ -904,6 +921,22 @@ public final class AntarchySettings { return rollyPollyTameChance; } + public static double rollyPollyBowlingDamage() { + return rollyPollyBowlingDamage; + } + + public static double rollyPollyBowlingKnockback() { + return rollyPollyBowlingKnockback; + } + + public static double rollyPollyArmor() { + return rollyPollyArmor; + } + + public static double rollyPollyRolledArmorBonus() { + return rollyPollyRolledArmorBonus; + } + public static double waspHealth() { return waspHealth; } @@ -1111,6 +1144,14 @@ public final class AntarchySettings { swingThroughGrassEnabled = value; } + public static void setFabricKeybindingConflictFixEnabled(boolean value) { + fabricKeybindingConflictFixEnabled = value; + } + + public static void setExperimentalSettingsPopupDisabled(boolean value) { + experimentalSettingsPopupDisabled = value; + } + public static void setSizeChangingRaysEnabled(boolean value) { sizeChangingRaysEnabled = value; } @@ -1438,6 +1479,22 @@ public final class AntarchySettings { rollyPollyTameChance = value; } + public static void setRollyPollyBowlingDamage(double value) { + rollyPollyBowlingDamage = value; + } + + public static void setRollyPollyBowlingKnockback(double value) { + rollyPollyBowlingKnockback = value; + } + + public static void setRollyPollyArmor(double value) { + rollyPollyArmor = value; + } + + public static void setRollyPollyRolledArmorBonus(double value) { + rollyPollyRolledArmorBonus = value; + } + public static void setKrakenProjectileDamageTakenMultiplier(double value) { krakenProjectileDamageTakenMultiplier = value; } @@ -1671,6 +1728,14 @@ public final class AntarchySettings { dreamSandEffectDurationSeconds = value; } + public static double dreamSandFallingBlockGravityMultiplier() { + return dreamSandFallingBlockGravityMultiplier; + } + + public static void setDreamSandFallingBlockGravityMultiplier(double value) { + dreamSandFallingBlockGravityMultiplier = value; + } + public static boolean ichorWitherEnabled() { return ichorWitherEnabled; } @@ -2075,6 +2140,12 @@ public final class AntarchySettings { public static int emperorScorpionMaxSummonedScorpions() { return emperorScorpionMaxSummonedScorpions; } public static void setEmperorScorpionMaxSummonedScorpions(int value) { emperorScorpionMaxSummonedScorpions = value; } + public static int emperorScorpionMaxNearbyScorpions() { return emperorScorpionMaxNearbyScorpions; } + public static void setEmperorScorpionMaxNearbyScorpions(int value) { emperorScorpionMaxNearbyScorpions = value; } + + public static int emperorScorpionHardenCooldownTicks() { return emperorScorpionHardenCooldownTicks; } + public static void setEmperorScorpionHardenCooldownTicks(int value) { emperorScorpionHardenCooldownTicks = value; } + public static double scorpionHealth() { return scorpionHealth; } public static void setScorpionHealth(double value) { scorpionHealth = value; } diff --git a/common/src/main/java/com/craisinlord/antarchy/config/ConfigResetGuard.java b/common/src/main/java/com/craisinlord/antarchy/config/ConfigResetGuard.java index c0ef9b88..b348355f 100644 --- a/common/src/main/java/com/craisinlord/antarchy/config/ConfigResetGuard.java +++ b/common/src/main/java/com/craisinlord/antarchy/config/ConfigResetGuard.java @@ -6,7 +6,7 @@ import java.nio.file.Files; import java.nio.file.Path; public final class ConfigResetGuard { - public static final int RESET_GENERATION = 2; + public static final int RESET_GENERATION = 3; private static final String MARKER_FILE_NAME = ".config_generation"; private ConfigResetGuard() { 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 af9c2c0b..b2090f4b 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/AntarchySoundEvents.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/AntarchySoundEvents.java @@ -156,6 +156,9 @@ public final class AntarchySoundEvents { public static Supplier SPIT_BUG_HURT = (Supplier) UNBOUND; public static Supplier SPIT_BUG_SPIT = (Supplier) UNBOUND; public static Supplier BRUTALFLY_SPIT = (Supplier) UNBOUND; + public static Supplier ROLLY_POLLY_WHEEL_MODE = (Supplier) UNBOUND; + public static Supplier ROLLY_POLLY_NORMAL_MODE = (Supplier) UNBOUND; + public static Supplier ROLLY_POLLY_ROLL = (Supplier) UNBOUND; private AntarchySoundEvents() { } @@ -307,7 +310,10 @@ public final class AntarchySoundEvents { Supplier jumpyBugJump, Supplier spitBugHurt, Supplier spitBugSpit, - Supplier brutalflySpit + Supplier brutalflySpit, + Supplier rollyPollyWheelMode, + Supplier rollyPollyNormalMode, + Supplier rollyPollyRoll ) { SQUIDZOOKA_FIRE = squidzookaFire; SHRINK_RAY_SOUND = shrinkRaySound; @@ -456,5 +462,8 @@ public final class AntarchySoundEvents { SPIT_BUG_HURT = spitBugHurt; SPIT_BUG_SPIT = spitBugSpit; BRUTALFLY_SPIT = brutalflySpit; + ROLLY_POLLY_WHEEL_MODE = rollyPollyWheelMode; + ROLLY_POLLY_NORMAL_MODE = rollyPollyNormalMode; + ROLLY_POLLY_ROLL = rollyPollyRoll; } } diff --git a/common/src/main/java/com/craisinlord/antarchy/content/AntarchyTags.java b/common/src/main/java/com/craisinlord/antarchy/content/AntarchyTags.java index a3e4083e..356b94b3 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/AntarchyTags.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/AntarchyTags.java @@ -114,6 +114,7 @@ public final class AntarchyTags { public static final class Fluids { public static final TagKey LUMEN = TagKey.create(Registries.FLUID, id("lumen")); public static final TagKey GIANT_LILY_PAD_SUPPORTING_FLUIDS = TagKey.create(Registries.FLUID, id("giant_lily_pad_supporting_fluids")); + public static final TagKey ANTIWATER = TagKey.create(Registries.FLUID, id("antiwater")); private Fluids() { } diff --git a/common/src/main/java/com/craisinlord/antarchy/content/entity/BedBugEntity.java b/common/src/main/java/com/craisinlord/antarchy/content/entity/BedBugEntity.java index bf3a3307..4369d4be 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/entity/BedBugEntity.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/entity/BedBugEntity.java @@ -324,7 +324,7 @@ public class BedBugEntity extends Animal implements GeoEntity { return state.setAndContinue(BITE_ANIM); } - if (this.getDeltaMovement().horizontalDistanceSqr() > 0.003D) { + if (state.isMoving()) { state.getController().setAnimationSpeed(1.15D); return state.setAndContinue(WALK_ANIM); } diff --git a/common/src/main/java/com/craisinlord/antarchy/content/entity/EmperorScorpionEntity.java b/common/src/main/java/com/craisinlord/antarchy/content/entity/EmperorScorpionEntity.java index 258f42eb..b30a6741 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/entity/EmperorScorpionEntity.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/entity/EmperorScorpionEntity.java @@ -106,7 +106,7 @@ public class EmperorScorpionEntity extends Monster implements GeoEntity { private int attackAnimTicks; private int clawCooldownTicks; private int stingCooldownTicks; - private int hardenCooldownTicks = AntarchySettings.emperorScorpionSummonIntervalTicks(); + private int hardenCooldownTicks = AntarchySettings.emperorScorpionHardenCooldownTicks(); private int hardenCastTicks; private int hardenCastSpawnTicks; private int hardenStateTicks; @@ -331,7 +331,8 @@ public class EmperorScorpionEntity extends Monster implements GeoEntity { switch (this.getHardenPhase()) { case CASTING -> { if (this.hardenCastTicks % this.hardenCastSpawnTicks == 0 - && this.hardenSummonedScorpions < AntarchySettings.emperorScorpionMaxSummonedScorpions()) { + && this.hardenSummonedScorpions < AntarchySettings.emperorScorpionMaxSummonedScorpions() + && this.countNearbyScorpionMinions() < AntarchySettings.emperorScorpionMaxNearbyScorpions()) { this.summonScorpionMinion(); this.hardenSummonedScorpions++; if (this.hardenSummonedScorpions >= AntarchySettings.emperorScorpionMaxSummonedScorpions()) { @@ -407,6 +408,16 @@ public class EmperorScorpionEntity extends Monster implements GeoEntity { this.setAggressive(false); } + private static final double NEARBY_SCORPION_CHECK_RADIUS = 24.0D; + + private int countNearbyScorpionMinions() { + return this.level().getEntitiesOfClass( + ScorpionEntity.class, + this.getBoundingBox().inflate(NEARBY_SCORPION_CHECK_RADIUS), + Entity::isAlive + ).size(); + } + private void summonScorpionMinion() { if (!(this.level() instanceof ServerLevel serverLevel)) { return; diff --git a/common/src/main/java/com/craisinlord/antarchy/content/entity/HerculesBeetleEntity.java b/common/src/main/java/com/craisinlord/antarchy/content/entity/HerculesBeetleEntity.java index 4cd5c7d3..a50cc0fe 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/entity/HerculesBeetleEntity.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/entity/HerculesBeetleEntity.java @@ -318,7 +318,7 @@ public class HerculesBeetleEntity extends TamableAnimal implements GeoEntity, Fl this.flightCooldown--; } - if (this.isFlying() && this.tickCount % 16 == 0) { + if (this.isFlying() && this.tickCount % 32 == 0) { this.playSound(AntarchySoundEvents.MANTIS_FLY_LOOP.get(), 0.5F, 0.85F + this.random.nextFloat() * 0.1F); } diff --git a/common/src/main/java/com/craisinlord/antarchy/content/entity/HushProjectileEntity.java b/common/src/main/java/com/craisinlord/antarchy/content/entity/HushProjectileEntity.java index bb336669..0ab9206f 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/entity/HushProjectileEntity.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/entity/HushProjectileEntity.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.AntarchyTags; import java.util.UUID; import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.nbt.CompoundTag; @@ -9,6 +10,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.ThrowableItemProjectile; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; @@ -20,10 +22,13 @@ import net.minecraft.world.phys.Vec3; public class HushProjectileEntity extends ThrowableItemProjectile { private static final int DREAD_DURATION_TICKS = 300; private static final double TRAVEL_SPEED = 0.27D; + private static final int RETARGET_GRACE_TICKS = 60; + private static final double RETARGET_SEARCH_RADIUS = 16.0D; private static final DustParticleOptions HUSH_PARTICLES = new DustParticleOptions(new org.joml.Vector3f(1.0F, 0.05F, 0.05F), 1.0F); private static final String TARGET_UUID_KEY = "HushTarget"; private UUID targetUuid; + private int retargetGraceTicksRemaining; public HushProjectileEntity(EntityType entityType, Level level) { super(entityType, level); @@ -85,9 +90,23 @@ public class HushProjectileEntity extends ThrowableItemProjectile { this.getBoundingBox().inflate(48.0D), entity -> entity.isAlive() && entity.getUUID().equals(this.targetUuid) ).stream().findFirst().orElse(null); + if (target == null) { - this.discard(); - return; + target = this.findReplacementTarget(); + if (target != null) { + this.targetUuid = target.getUUID(); + this.retargetGraceTicksRemaining = 0; + } else { + if (this.retargetGraceTicksRemaining <= 0) { + this.retargetGraceTicksRemaining = RETARGET_GRACE_TICKS; + } + if (--this.retargetGraceTicksRemaining <= 0) { + this.discard(); + } + return; + } + } else { + this.retargetGraceTicksRemaining = 0; } Vec3 toTarget = target.getEyePosition().subtract(this.position()); @@ -101,6 +120,19 @@ public class HushProjectileEntity extends ThrowableItemProjectile { this.setDeltaMovement(this.getDeltaMovement().lerp(desired, 0.1D)); } + private LivingEntity findReplacementTarget() { + return this.level().getEntitiesOfClass( + LivingEntity.class, + this.getBoundingBox().inflate(RETARGET_SEARCH_RADIUS), + entity -> entity.isAlive() + && !entity.getUUID().equals(this.targetUuid) + && entity.getType().is(AntarchyTags.Entities.HUSHWEED_TARGETS) + && (!(entity instanceof Player player) || (!player.isCreative() && !player.isSpectator()))) + .stream() + .min(java.util.Comparator.comparingDouble(this::distanceToSqr)) + .orElse(null); + } + @Override protected void onHitEntity(EntityHitResult result) { super.onHitEntity(result); diff --git a/common/src/main/java/com/craisinlord/antarchy/content/entity/LurkingTerrorEntity.java b/common/src/main/java/com/craisinlord/antarchy/content/entity/LurkingTerrorEntity.java index 1a8754fa..71b029de 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/entity/LurkingTerrorEntity.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/entity/LurkingTerrorEntity.java @@ -165,7 +165,7 @@ public class LurkingTerrorEntity extends Monster implements GeoEntity { @Override public void tick() { super.tick(); - if (!this.level().isClientSide() && !this.onGround() && this.tickCount % 40 == 0) { + if (!this.level().isClientSide() && !this.onGround() && this.tickCount % 80 == 0) { this.playSound(AntarchySoundEvents.LURKING_TERROR_FLY_LOOP.get(), 0.45F, 0.95F + this.random.nextFloat() * 0.1F); } if (!this.level().isClientSide() && attackAnimTicks > 0) attackAnimTicks--; diff --git a/common/src/main/java/com/craisinlord/antarchy/content/entity/MantisEntity.java b/common/src/main/java/com/craisinlord/antarchy/content/entity/MantisEntity.java index ea348ed5..f81d7eaa 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/entity/MantisEntity.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/entity/MantisEntity.java @@ -206,7 +206,7 @@ public class MantisEntity extends Monster implements GeoEntity { if (this.flyBurstTicks > 0) { this.flyBurstTicks--; - if (this.flyBurstTicks % 8 == 0) { + if (this.flyBurstTicks % 16 == 0) { this.playSound(AntarchySoundEvents.MANTIS_FLY_LOOP.get(), 0.45F, 0.95F + this.random.nextFloat() * 0.1F); } } diff --git a/common/src/main/java/com/craisinlord/antarchy/content/entity/RollyPollyEntity.java b/common/src/main/java/com/craisinlord/antarchy/content/entity/RollyPollyEntity.java index fb01ed32..bef51ef8 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/entity/RollyPollyEntity.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/entity/RollyPollyEntity.java @@ -1,5 +1,6 @@ package com.craisinlord.antarchy.content.entity; +import com.craisinlord.antarchy.Antarchy; import com.craisinlord.antarchy.config.AntarchySettings; import com.craisinlord.antarchy.content.AntarchyTags; import com.craisinlord.antarchy.content.AntarchySoundEvents; @@ -12,25 +13,27 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.BlockTags; +import net.minecraft.tags.DamageTypeTags; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.sounds.SoundEvents; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; -import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.TamableAnimal; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.FollowOwnerGoal; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; import net.minecraft.world.entity.ai.goal.MoveToBlockGoal; @@ -38,6 +41,8 @@ import net.minecraft.world.entity.ai.goal.PanicGoal; import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; import net.minecraft.world.entity.ai.goal.TemptGoal; import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal; +import net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal; import net.minecraft.world.entity.ai.util.DefaultRandomPos; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; @@ -77,7 +82,9 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { private static final int ROLL_UP_TICKS = 15; private static final int UNROLL_TICKS = 9; private static final int DEFENSIVE_CURL_TICKS = 100; - private static final int TUMBLE_DAMAGE_INTERVAL_TICKS = 30; + private static final int ROLL_SOUND_INTERVAL_TICKS = 25; + private static final ResourceLocation ROLLED_ARMOR_MODIFIER_ID = + ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "rolly_polly_rolled_armor"); private static final EntityDataAccessor ANIMATION_STATE = SynchedEntityData.defineId(RollyPollyEntity.class, EntityDataSerializers.INT); @@ -89,8 +96,8 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { private int rollTransitionTicks; private boolean unrolling; private int defensiveCurlTicks; - private int tumbleTicks; private boolean hasCompost; + private int rollSoundCooldown; public RollyPollyEntity(EntityType entityType, Level level) { super(entityType, level); @@ -108,6 +115,8 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { return Mob.createMobAttributes() .add(Attributes.MAX_HEALTH, AntarchySettings.rollyPollyHealth()) .add(Attributes.MOVEMENT_SPEED, AntarchySettings.rollyPollyMovementSpeed()) + .add(Attributes.ATTACK_DAMAGE, AntarchySettings.rollyPollyBowlingDamage()) + .add(Attributes.ARMOR, AntarchySettings.rollyPollyArmor()) .add(Attributes.FOLLOW_RANGE, 16.0D); } @@ -128,24 +137,28 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { return !RollyPollyEntity.this.isRolled() && !RollyPollyEntity.this.isTame() && super.canUse(); } }); - this.goalSelector.addGoal(2, new FertilizeCropGoal()); - this.goalSelector.addGoal(3, new EatCompostItemGoal()); - this.goalSelector.addGoal(4, new SnuggleOnBedGoal()); - this.goalSelector.addGoal(5, new TemptGoal(this, 1.1D, Ingredient.of(AntarchyTags.Items.ROLLY_POLLY_FOOD), false) { + this.goalSelector.addGoal(2, new BowlingAttackGoal()); + this.goalSelector.addGoal(3, new FertilizeCropGoal()); + this.goalSelector.addGoal(4, new EatCompostItemGoal()); + this.goalSelector.addGoal(5, new SnuggleOnBedGoal()); + this.goalSelector.addGoal(6, new TemptGoal(this, 1.1D, Ingredient.of(AntarchyTags.Items.ROLLY_POLLY_FOOD), false) { @Override public boolean canUse() { return !RollyPollyEntity.this.isRolled() && super.canUse(); } }); - this.goalSelector.addGoal(6, new RollingStrollGoal()); - this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D) { + this.goalSelector.addGoal(7, new FollowOwnerGoal(this, 1.1D, 10.0F, 2.0F)); + this.goalSelector.addGoal(8, new RollingStrollGoal()); + this.goalSelector.addGoal(9, new WaterAvoidingRandomStrollGoal(this, 1.0D) { @Override public boolean canUse() { - return !RollyPollyEntity.this.isRolled() && !RollyPollyEntity.this.isVehicle() && super.canUse(); + return !RollyPollyEntity.this.isRolled() && super.canUse(); } }); - this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F)); - this.goalSelector.addGoal(9, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Player.class, 8.0F)); + this.goalSelector.addGoal(11, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(1, new OwnerHurtByTargetGoal(this)); + this.targetSelector.addGoal(2, new OwnerHurtTargetGoal(this)); } @Override @@ -198,13 +211,6 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { return InteractionResult.sidedSuccess(this.level().isClientSide); } - if (this.isTame() && stack.isEmpty() && !player.isShiftKeyDown() && !player.isPassengerOfSameVehicle(this)) { - if (!this.level().isClientSide) { - player.startRiding(this); - } - return InteractionResult.sidedSuccess(this.level().isClientSide); - } - return super.mobInteract(player, hand); } @@ -235,34 +241,36 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { this.entityData.set(ROLLED, rolled); } - /** Toggles wheel mode; called from the ridden-roll keybind payload. */ - public void handleRollToggle(ServerPlayer player) { - if (!this.isTame() || this.getControllingPassenger() != player) { - return; - } - if (this.rollTransitionTicks > 0) { - return; - } - if (this.isRolled()) { - this.startUnroll(); - } else { - this.startRollUp(); - } - } - private void startRollUp() { this.setRolled(true); this.unrolling = false; this.rollTransitionTicks = ROLL_UP_TICKS; this.setAnimationState(ANIM_ROLL_UP); - this.playSound(SoundEvents.ARMADILLO_ROLL, 0.8F, 1.0F); + this.playSound(AntarchySoundEvents.ROLLY_POLLY_WHEEL_MODE.get(), 0.8F, 1.0F); + this.applyRolledArmorBonus(); } private void startUnroll() { this.unrolling = true; this.rollTransitionTicks = UNROLL_TICKS; this.setAnimationState(ANIM_UNROLL); - this.playSound(SoundEvents.ARMADILLO_UNROLL_START, 0.8F, 1.0F); + this.playSound(AntarchySoundEvents.ROLLY_POLLY_NORMAL_MODE.get(), 0.8F, 1.0F); + this.removeRolledArmorBonus(); + } + + private void applyRolledArmorBonus() { + AttributeInstance armor = this.getAttribute(Attributes.ARMOR); + if (armor != null && armor.getModifier(ROLLED_ARMOR_MODIFIER_ID) == null) { + armor.addTransientModifier(new AttributeModifier( + ROLLED_ARMOR_MODIFIER_ID, AntarchySettings.rollyPollyRolledArmorBonus(), AttributeModifier.Operation.ADD_VALUE)); + } + } + + private void removeRolledArmorBonus() { + AttributeInstance armor = this.getAttribute(Attributes.ARMOR); + if (armor != null) { + armor.removeModifier(ROLLED_ARMOR_MODIFIER_ID); + } } @Override @@ -272,14 +280,14 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { private void stopDefensiveCurl() { this.defensiveCurlTicks = 0; - if (this.isRolled() && !this.isVehicle()) { + if (this.isRolled()) { this.startUnroll(); } } @Override public boolean hurt(DamageSource source, float amount) { - if (this.isRolled()) { + if (this.isRolled() && source.is(DamageTypeTags.IS_PROJECTILE)) { amount *= 0.25F; } boolean hurt = super.hurt(source, amount); @@ -313,29 +321,27 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { if (this.defensiveCurlTicks > 0) { this.defensiveCurlTicks--; this.getNavigation().stop(); - if (this.defensiveCurlTicks <= 0 && this.isRolled() && !this.isVehicle()) { + if (this.defensiveCurlTicks <= 0 && this.isRolled()) { this.startUnroll(); } } - this.tickTumbleDamage(); + this.tickRollSound(); } - private void tickTumbleDamage() { - if (!this.isRolled() || this.rollTransitionTicks > 0 - || !(this.getControllingPassenger() instanceof Player rider)) { - this.tumbleTicks = 0; + private void tickRollSound() { + if (!this.isRolled() || this.rollTransitionTicks > 0 || this.getDeltaMovement().horizontalDistanceSqr() <= 0.003D) { + this.rollSoundCooldown = 0; return; } - boolean moving = this.getDeltaMovement().horizontalDistanceSqr() > 0.003D; - boolean helmeted = !rider.getItemBySlot(EquipmentSlot.HEAD).isEmpty(); - if (!moving || helmeted) { + + if (this.rollSoundCooldown > 0) { + this.rollSoundCooldown--; return; } - if (++this.tumbleTicks >= TUMBLE_DAMAGE_INTERVAL_TICKS) { - this.tumbleTicks = 0; - rider.hurt(this.damageSources().generic(), (float) AntarchySettings.rollyPollyTumbleDamage()); - } + + this.rollSoundCooldown = ROLL_SOUND_INTERVAL_TICKS; + this.playSound(AntarchySoundEvents.ROLLY_POLLY_ROLL.get(), 0.7F, 0.9F + this.random.nextFloat() * 0.2F); } private int getAnimationState() { @@ -346,70 +352,15 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { this.entityData.set(ANIMATION_STATE, state); } - @Override - @Nullable - public LivingEntity getControllingPassenger() { - if (!this.isTame()) { - return null; - } - Entity passenger = this.getFirstPassenger(); - return passenger instanceof LivingEntity living ? living : null; - } - - @Override - public boolean canAddPassenger(Entity passenger) { - return this.getPassengers().isEmpty(); - } - - @Override - protected void positionRider(Entity passenger, MoveFunction moveFunction) { - if (this.hasPassenger(passenger)) { - // When rolled the rider tucks into the center of the ball; otherwise sits on the shell - double yOffset = this.isRolled() ? -0.25D : 0.45D; - moveFunction.accept(passenger, this.getX(), this.getY() + yOffset, this.getZ()); - } - } - @Override public void travel(Vec3 travelVector) { - if (this.defensiveCurlTicks > 0 && !this.isVehicle()) { + if (this.defensiveCurlTicks > 0) { super.travel(Vec3.ZERO); return; } super.travel(travelVector); } - @Override - protected void tickRidden(Player player, Vec3 travelVector) { - super.tickRidden(player, travelVector); - this.setRot(player.getYHeadRot(), player.getXRot() * 0.5F); - this.yRotO = this.yBodyRot = this.yHeadRot = this.getYRot(); - } - - @Override - protected Vec3 getRiddenInput(Player player, Vec3 travelVector) { - if (this.rollTransitionTicks > 0) { - // Hold still while rolling up / unrolling - return Vec3.ZERO; - } - float forward = player.zza; - float strafe = player.xxa * 0.5F; - if (forward < 0.0F) { - forward *= 0.4F; - } - if (this.isRolled()) { - // Rolling is fast but drifty - strafe *= 0.35F; - } - return new Vec3(strafe, 0.0D, forward); - } - - @Override - protected float getRiddenSpeed(Player player) { - return (float) (this.getAttributeValue(Attributes.MOVEMENT_SPEED) - * (this.isRolled() ? AntarchySettings.rollyPollyRollSpeedMultiplier() : 1.0D)); - } - @Override public boolean causeFallDamage(float fallDistance, float multiplier, DamageSource damageSource) { if (this.isRolled()) { @@ -483,7 +434,6 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { public boolean canUse() { if (RollyPollyEntity.this.hasCompost || RollyPollyEntity.this.isRolled() - || RollyPollyEntity.this.isVehicle() || RollyPollyEntity.this.defensiveCurlTicks > 0) { return false; } @@ -500,7 +450,6 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { public boolean canContinueToUse() { return !RollyPollyEntity.this.hasCompost && !RollyPollyEntity.this.isRolled() - && !RollyPollyEntity.this.isVehicle() && this.targetItem != null && this.targetItem.isAlive() && isCompostable(this.targetItem.getItem()); @@ -571,7 +520,6 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { public boolean canUse() { return RollyPollyEntity.this.hasCompost && !RollyPollyEntity.this.isRolled() - && !RollyPollyEntity.this.isVehicle() && RollyPollyEntity.this.defensiveCurlTicks <= 0 && super.canUse(); } @@ -579,7 +527,6 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { @Override public boolean canContinueToUse() { return RollyPollyEntity.this.hasCompost - && !RollyPollyEntity.this.isVehicle() && super.canContinueToUse(); } @@ -653,6 +600,84 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { } } + private class BowlingAttackGoal extends Goal { + private static final double CHARGE_SPEED = 1.3D; + private static final double HIT_RANGE_SQR = 1.75D * 1.75D; + private static final int ATTACK_COOLDOWN_TICKS = 20; + + private int attackCooldown; + + BowlingAttackGoal() { + this.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK)); + } + + @Override + public boolean canUse() { + LivingEntity target = RollyPollyEntity.this.getTarget(); + return RollyPollyEntity.this.isTame() + && target != null + && target.isAlive(); + } + + @Override + public boolean canContinueToUse() { + return this.canUse(); + } + + @Override + public void start() { + this.attackCooldown = 0; + if (!RollyPollyEntity.this.isRolled() && RollyPollyEntity.this.rollTransitionTicks <= 0) { + RollyPollyEntity.this.startRollUp(); + } + } + + @Override + public void stop() { + RollyPollyEntity.this.getNavigation().stop(); + if (RollyPollyEntity.this.isRolled() && RollyPollyEntity.this.rollTransitionTicks <= 0) { + RollyPollyEntity.this.startUnroll(); + } + } + + @Override + public void tick() { + LivingEntity target = RollyPollyEntity.this.getTarget(); + if (target == null) { + return; + } + + RollyPollyEntity.this.getLookControl().setLookAt(target, 30.0F, 30.0F); + + if (this.attackCooldown > 0) { + this.attackCooldown--; + } + + if (!RollyPollyEntity.this.isRolled() || RollyPollyEntity.this.rollTransitionTicks > 0) { + return; + } + + RollyPollyEntity.this.getNavigation().moveTo(target, CHARGE_SPEED); + + if (this.attackCooldown <= 0 && RollyPollyEntity.this.distanceToSqr(target) <= HIT_RANGE_SQR) { + this.attackCooldown = ATTACK_COOLDOWN_TICKS; + this.performBowlingHit(target); + } + } + + private void performBowlingHit(LivingEntity target) { + boolean hurt = target.hurt(RollyPollyEntity.this.damageSources().mobAttack(RollyPollyEntity.this), (float) RollyPollyEntity.this.getAttributeValue(Attributes.ATTACK_DAMAGE)); + if (!hurt) { + return; + } + + double dx = RollyPollyEntity.this.getX() - target.getX(); + double dz = RollyPollyEntity.this.getZ() - target.getZ(); + target.knockback(AntarchySettings.rollyPollyBowlingKnockback(), dx, dz); + RollyPollyEntity.this.playSound(AntarchySoundEvents.ROLLY_POLLY_ROLL.get(), 1.0F, 0.8F + RollyPollyEntity.this.random.nextFloat() * 0.2F); + } + } + private class RollingStrollGoal extends Goal { @Nullable private Vec3 targetPos; @@ -668,7 +693,6 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { @Override public boolean canUse() { if (RollyPollyEntity.this.isRolled() - || RollyPollyEntity.this.isVehicle() || RollyPollyEntity.this.defensiveCurlTicks > 0 || RollyPollyEntity.this.hasCompost || RollyPollyEntity.this.rollTransitionTicks > 0) { @@ -685,7 +709,6 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { public boolean canContinueToUse() { return !this.finished && this.rollingTicks < this.maxRollingTicks - && !RollyPollyEntity.this.isVehicle() && !RollyPollyEntity.this.hasCompost; } @@ -739,7 +762,7 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { @Override public boolean canUse() { - if (!RollyPollyEntity.this.isTame() || RollyPollyEntity.this.isVehicle()) { + if (!RollyPollyEntity.this.isTame()) { return false; } if (!(RollyPollyEntity.this.getOwner() instanceof Player player) || !player.isSleeping()) { @@ -763,7 +786,6 @@ public class RollyPollyEntity extends TamableAnimal implements GeoEntity { @Override public boolean canContinueToUse() { return RollyPollyEntity.this.isTame() - && !RollyPollyEntity.this.isVehicle() && this.ownerPlayer != null && this.ownerPlayer.isSleeping() && this.bedPos != null; diff --git a/common/src/main/java/com/craisinlord/antarchy/content/entity/StinkBugEntity.java b/common/src/main/java/com/craisinlord/antarchy/content/entity/StinkBugEntity.java index eb16a6fb..7663e78a 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/entity/StinkBugEntity.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/entity/StinkBugEntity.java @@ -88,7 +88,7 @@ public class StinkBugEntity extends Animal implements GeoEntity { if (this.fartAnimationTicks > 0) { this.fartAnimationTicks--; if (this.fartAnimationTicks == FART_RELEASE_TICKS && this.pendingFartBurst && !this.level().isClientSide()) { - this.playSound(AntarchySoundEvents.STINK_BUG_FART.get(), 0.85F, 0.9F + this.random.nextFloat() * 0.1F); + this.playSound(AntarchySoundEvents.STINK_BUG_FART.get(), 1.7F, 0.9F + this.random.nextFloat() * 0.1F); StinkyBehavior.emitBurst(this, STINK_BURST_PARTICLES); StinkyBehavior.applyBurstStinkyEffect(this, STINK_BURST_RADIUS, STINK_BURST_DURATION_TICKS); this.pendingFartBurst = false; diff --git a/common/src/main/java/com/craisinlord/antarchy/content/item/CorneaEarItem.java b/common/src/main/java/com/craisinlord/antarchy/content/item/CorneaEarItem.java index 2f799797..74bf618d 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/item/CorneaEarItem.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/item/CorneaEarItem.java @@ -10,6 +10,7 @@ import net.minecraft.core.Direction; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionResult; import net.minecraft.world.effect.MobEffectInstance; @@ -58,6 +59,7 @@ public final class CorneaEarItem extends Item { } level.setBlock(plantPos, stalkState, Block.UPDATE_ALL); + level.playSound(null, plantPos, stalkState.getSoundType().getPlaceSound(), SoundSource.BLOCKS, 1.0F, 1.0F); ItemStack stack = context.getItemInHand(); Player player = context.getPlayer(); if (player == null || !player.getAbilities().instabuild) { diff --git a/common/src/main/java/com/craisinlord/antarchy/content/network/RollyPollyRollPayload.java b/common/src/main/java/com/craisinlord/antarchy/content/network/RollyPollyRollPayload.java deleted file mode 100644 index ab9c97da..00000000 --- a/common/src/main/java/com/craisinlord/antarchy/content/network/RollyPollyRollPayload.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.craisinlord.antarchy.content.network; - -import com.craisinlord.antarchy.Antarchy; -import io.netty.buffer.ByteBuf; -import net.minecraft.network.codec.StreamCodec; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; - -/** C2S: the rider pressed the roll keybind — toggle the rolly polly's wheel mode. */ -public record RollyPollyRollPayload() implements CustomPacketPayload { - public static final Type TYPE = - new Type<>(ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "rolly_polly_roll")); - public static final StreamCodec STREAM_CODEC = - StreamCodec.unit(new RollyPollyRollPayload()); - - @Override - public Type type() { - return TYPE; - } -} diff --git a/common/src/main/java/com/craisinlord/antarchy/content/worldgen/ants/TermiteNestFeature.java b/common/src/main/java/com/craisinlord/antarchy/content/worldgen/ants/TermiteNestFeature.java index dc49f044..03869782 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/worldgen/ants/TermiteNestFeature.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/worldgen/ants/TermiteNestFeature.java @@ -1,10 +1,56 @@ package com.craisinlord.antarchy.content.worldgen.ants; +import com.craisinlord.antarchy.Antarchy; import com.mojang.serialization.Codec; +import java.util.Optional; +import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration; public class TermiteNestFeature extends SurfaceAntNestFeature { + private static final ResourceLocation MYRMITE_ID = ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "myrmite"); + private static final ResourceLocation BROODSTONE_ID = ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "broodstone"); + public TermiteNestFeature(Codec codec) { super(codec); } + + @Override + protected boolean isValidNestGround(BlockState nestGroundState) { + return super.isValidNestGround(nestGroundState) + || nestGroundState.is(getBlock(MYRMITE_ID)) + || nestGroundState.is(getBlock(BROODSTONE_ID)); + } + + @Override + protected void decorateAroundNest(WorldGenLevel level, BlockPos center, RandomSource random) { + for (int xOffset = -1; xOffset <= 1; xOffset++) { + for (int zOffset = -1; zOffset <= 1; zOffset++) { + if (xOffset == 0 && zOffset == 0) { + continue; + } + + if (Math.abs(xOffset) == 1 && Math.abs(zOffset) == 1 && random.nextBoolean()) { + continue; + } + + BlockPos targetPos = center.offset(xOffset, 0, zOffset); + BlockState targetState = level.getBlockState(targetPos); + if (this.isValidNestGround(targetState)) { + level.setBlock(targetPos, Blocks.ROOTED_DIRT.defaultBlockState(), 2); + } + } + } + } + + private static Block getBlock(ResourceLocation id) { + Optional block = BuiltInRegistries.BLOCK.getOptional(id); + return block.orElse(null); + } } diff --git a/common/src/main/java/com/craisinlord/antarchy/content/worldgen/cavaryn/CavarynBileVeinFeature.java b/common/src/main/java/com/craisinlord/antarchy/content/worldgen/cavaryn/CavarynBileVeinFeature.java index 5cf07aa4..409e8996 100644 --- a/common/src/main/java/com/craisinlord/antarchy/content/worldgen/cavaryn/CavarynBileVeinFeature.java +++ b/common/src/main/java/com/craisinlord/antarchy/content/worldgen/cavaryn/CavarynBileVeinFeature.java @@ -29,6 +29,8 @@ public final class CavarynBileVeinFeature extends Feature codec) { super(codec); @@ -36,21 +38,25 @@ public final class CavarynBileVeinFeature extends Feature context) { - Block bileVeinBlock = getBlock(BILE_VEIN_ID); - Block bileBlock = getBlock(BILE_ID); - if (bileVeinBlock == null || !(bileBlock instanceof LiquidBlock)) { + try { + Block bileVeinBlock = getBlock(BILE_VEIN_ID); + Block bileBlock = getBlock(BILE_ID); + if (bileVeinBlock == null || !(bileBlock instanceof LiquidBlock)) { + return false; + } + + WorldGenLevel level = context.level(); + RandomSource random = context.random(); + + BlockPos start = findStart(level, context.origin(), random); + if (start == null) { + return false; + } + + return growVeinNetwork(level, start, bileVeinBlock, bileBlock, random); + } catch (RuntimeException exception) { return false; } - - WorldGenLevel level = context.level(); - RandomSource random = context.random(); - - BlockPos start = findStart(level, context.origin(), random); - if (start == null) { - return false; - } - - return growVeinNetwork(level, start, bileVeinBlock, bileBlock, random); } private static BlockPos findStart(WorldGenLevel level, BlockPos origin, RandomSource random) { @@ -81,12 +87,12 @@ public final class CavarynBileVeinFeature extends Feature MAX_DISTANCE_FROM_START_SQR) { + break; + } + if (visited.contains(current)) { current = current.relative(biasedNextDir(dir, random)); continue; diff --git a/common/src/main/java/com/craisinlord/antarchy/mixins/DreamSandFallingSpeedMixin.java b/common/src/main/java/com/craisinlord/antarchy/mixins/DreamSandFallingSpeedMixin.java new file mode 100644 index 00000000..d9194987 --- /dev/null +++ b/common/src/main/java/com/craisinlord/antarchy/mixins/DreamSandFallingSpeedMixin.java @@ -0,0 +1,27 @@ +package com.craisinlord.antarchy.mixins; + +import com.craisinlord.antarchy.Antarchy; +import com.craisinlord.antarchy.config.AntarchySettings; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(FallingBlockEntity.class) +public abstract class DreamSandFallingSpeedMixin { + private static final ResourceLocation DREAM_SAND_ID = ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "dream_sand"); + + @Shadow public abstract BlockState getBlockState(); + + @Inject(method = "getDefaultGravity", at = @At("RETURN"), cancellable = true) + private void antarchy$slowDreamSandFall(CallbackInfoReturnable cir) { + if (BuiltInRegistries.BLOCK.getKey(this.getBlockState().getBlock()).equals(DREAM_SAND_ID)) { + cir.setReturnValue(cir.getReturnValue() * AntarchySettings.dreamSandFallingBlockGravityMultiplier()); + } + } +} diff --git a/common/src/main/java/com/craisinlord/antarchy/mixins/ExperimentalSettingsLevelSummaryMixin.java b/common/src/main/java/com/craisinlord/antarchy/mixins/ExperimentalSettingsLevelSummaryMixin.java new file mode 100644 index 00000000..791d6f25 --- /dev/null +++ b/common/src/main/java/com/craisinlord/antarchy/mixins/ExperimentalSettingsLevelSummaryMixin.java @@ -0,0 +1,18 @@ +package com.craisinlord.antarchy.mixins; + +import com.craisinlord.antarchy.config.AntarchySettings; +import net.minecraft.world.level.storage.LevelSummary; +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.CallbackInfoReturnable; + +@Mixin(value = LevelSummary.class, priority = 1001) +public abstract class ExperimentalSettingsLevelSummaryMixin { + @Inject(method = "isExperimental", at = @At("RETURN"), cancellable = true) + private void antarchy$hideExperimentalStatus(CallbackInfoReturnable cir) { + if (AntarchySettings.experimentalSettingsPopupDisabled()) { + cir.setReturnValue(false); + } + } +} diff --git a/common/src/main/java/com/craisinlord/antarchy/mixins/SpongeAntiwaterMixin.java b/common/src/main/java/com/craisinlord/antarchy/mixins/SpongeAntiwaterMixin.java new file mode 100644 index 00000000..7da73f8a --- /dev/null +++ b/common/src/main/java/com/craisinlord/antarchy/mixins/SpongeAntiwaterMixin.java @@ -0,0 +1,76 @@ +package com.craisinlord.antarchy.mixins; + +import com.craisinlord.antarchy.content.AntarchyTags; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BucketPickup; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.LiquidBlock; +import net.minecraft.world.level.block.SpongeBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +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(SpongeBlock.class) +public abstract class SpongeAntiwaterMixin { + private static final int MAX_DEPTH = 6; + private static final int MAX_COUNT = 65; + private static final Direction[] ALL_DIRECTIONS = Direction.values(); + + @Inject(method = "tryAbsorbWater", at = @At("TAIL")) + private void antarchy$tryAbsorbAntiwater(Level level, BlockPos pos, CallbackInfo ci) { + if (!level.getBlockState(pos).is(Blocks.SPONGE)) { + return; + } + + if (antarchy$removeAntiwaterBreadthFirstSearch(level, pos) > 1) { + level.setBlock(pos, Blocks.WET_SPONGE.defaultBlockState(), 2); + level.playSound(null, pos, SoundEvents.SPONGE_ABSORB, SoundSource.BLOCKS, 1.0F, 1.0F); + } + } + + private static int antarchy$removeAntiwaterBreadthFirstSearch(Level level, BlockPos origin) { + return BlockPos.breadthFirstTraversal( + origin, + MAX_DEPTH, + MAX_COUNT, + (pos, consumer) -> { + for (Direction direction : ALL_DIRECTIONS) { + consumer.accept(pos.relative(direction)); + } + }, + pos -> antarchy$tryRemoveAntiwaterAt(level, origin, pos) + ); + } + + private static boolean antarchy$tryRemoveAntiwaterAt(Level level, BlockPos origin, BlockPos pos) { + if (pos.equals(origin)) { + return true; + } + + BlockState state = level.getBlockState(pos); + FluidState fluidState = level.getFluidState(pos); + if (!fluidState.is(AntarchyTags.Fluids.ANTIWATER)) { + return false; + } + + Block block = state.getBlock(); + if (block instanceof BucketPickup bucketPickup && !bucketPickup.pickupBlock(null, level, pos, state).isEmpty()) { + return true; + } + + if (block instanceof LiquidBlock) { + level.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); + return true; + } + + return false; + } +} diff --git a/common/src/main/java/com/craisinlord/antarchy/mixins/client/ExperimentalSettingsPopupMixin.java b/common/src/main/java/com/craisinlord/antarchy/mixins/client/ExperimentalSettingsPopupMixin.java new file mode 100644 index 00000000..a0e89d51 --- /dev/null +++ b/common/src/main/java/com/craisinlord/antarchy/mixins/client/ExperimentalSettingsPopupMixin.java @@ -0,0 +1,22 @@ +package com.craisinlord.antarchy.mixins.client; + +import com.craisinlord.antarchy.config.AntarchySettings; +import com.mojang.serialization.Lifecycle; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen; +import net.minecraft.client.gui.screens.worldselection.WorldOpenFlows; +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(WorldOpenFlows.class) +public abstract class ExperimentalSettingsPopupMixin { + @Inject(method = "confirmWorldCreation", at = @At("HEAD"), cancellable = true) + private static void antarchy$skipExperimentalSettingsPopup(Minecraft minecraft, CreateWorldScreen screen, Lifecycle lifecycle, Runnable callback, boolean skipWarnings, CallbackInfo ci) { + if (AntarchySettings.experimentalSettingsPopupDisabled() && lifecycle == Lifecycle.experimental() && !skipWarnings) { + callback.run(); + ci.cancel(); + } + } +} diff --git a/common/src/main/resources/antarchy-common.mixins.json b/common/src/main/resources/antarchy-common.mixins.json index 475b8ecc..e0632c81 100644 --- a/common/src/main/resources/antarchy-common.mixins.json +++ b/common/src/main/resources/antarchy-common.mixins.json @@ -10,6 +10,7 @@ "BlockEntityTypeSignMixin", "BloodglassMixin", "DreamFireBlockMixin", + "DreamSandFallingSpeedMixin", "DreamSandLowGravityMixin", "FireVisualBaseFireBlockMixin", "FireVisualEntityMixin", @@ -18,11 +19,13 @@ "FrogVariantBootstrapMixin", "GlowSquidLumenSpawnMixin", "GlowVinesUnderLeavesMixin", + "ExperimentalSettingsLevelSummaryMixin", "NightmareSwordDamageMixin", "PotionBrewingMixin", "VillagerTradesMixin", "WaterlilyLumenMixin", "ServerPlayerGameModeMixin", + "SpongeAntiwaterMixin", "SquidzookaEnchantMixin", "SquidzookaMultishotMixin", "gravity.AbstractArrowGravityMixin", @@ -61,6 +64,7 @@ "client.ElytraModelAccessor", "client.FrogRendererElythiaMixin", "client.GameRendererSwingThroughGrassMixin", + "client.ExperimentalSettingsPopupMixin", "client.KrakensGraspChargePoseMixin", "client.LightningBoltRendererMixin", "client.MountedVehicleCameraMixin", diff --git a/common/src/main/resources/assets/antarchy/lang/de_de.json b/common/src/main/resources/assets/antarchy/lang/de_de.json index fe1d96ec..7ea2f918 100644 --- a/common/src/main/resources/assets/antarchy/lang/de_de.json +++ b/common/src/main/resources/assets/antarchy/lang/de_de.json @@ -924,6 +924,9 @@ "subtitles.antarchy.stink_bug_fart": "Stinkwanze furzt", "subtitles.antarchy.stink_bug_idle": "Stinkwanze ist zu hören", "subtitles.antarchy.rolly_polly_idle": "Rollassel ist zu hören", + "subtitles.antarchy.rolly_polly_wheel_mode": "Rollassel rollt sich ein", + "subtitles.antarchy.rolly_polly_normal_mode": "Rollassel rollt sich aus", + "subtitles.antarchy.rolly_polly_roll": "Rollassel rollt", "subtitles.antarchy.hercules_beetle_idle": "Herkuleskäfer ist zu hören", "subtitles.antarchy.hercules_beetle_hurt": "Herkuleskäfer wird verletzt", "subtitles.antarchy.hercules_beetle_attack": "Herkuleskäfer greift an", 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 5cd093a0..2e11bea9 100644 --- a/common/src/main/resources/assets/antarchy/lang/en_us.json +++ b/common/src/main/resources/assets/antarchy/lang/en_us.json @@ -925,6 +925,9 @@ "subtitles.antarchy.stink_bug_fart": "Stink Bug farts", "subtitles.antarchy.stink_bug_idle": "Stink Bug idles", "subtitles.antarchy.rolly_polly_idle": "Rolly Polly idles", + "subtitles.antarchy.rolly_polly_wheel_mode": "Rolly Polly curls up", + "subtitles.antarchy.rolly_polly_normal_mode": "Rolly Polly uncurls", + "subtitles.antarchy.rolly_polly_roll": "Rolly Polly rolls", "subtitles.antarchy.hercules_beetle_idle": "Hercules Beetle idles", "subtitles.antarchy.hercules_beetle_hurt": "Hercules Beetle hurts", "subtitles.antarchy.hercules_beetle_attack": "Hercules Beetle attacks", diff --git a/common/src/main/resources/assets/antarchy/lang/es_es.json b/common/src/main/resources/assets/antarchy/lang/es_es.json index 1b7899d2..20a0869f 100644 --- a/common/src/main/resources/assets/antarchy/lang/es_es.json +++ b/common/src/main/resources/assets/antarchy/lang/es_es.json @@ -924,6 +924,9 @@ "subtitles.antarchy.stink_bug_fart": "Chinche apestosa se tira un pedo", "subtitles.antarchy.stink_bug_idle": "Chinche apestosa hace ruido", "subtitles.antarchy.rolly_polly_idle": "Cochinilla hace ruido", + "subtitles.antarchy.rolly_polly_wheel_mode": "La cochinilla se enrolla", + "subtitles.antarchy.rolly_polly_normal_mode": "La cochinilla se desenrolla", + "subtitles.antarchy.rolly_polly_roll": "La cochinilla rueda", "subtitles.antarchy.hercules_beetle_idle": "Escarabajo hércules hace ruido", "subtitles.antarchy.hercules_beetle_hurt": "Escarabajo hércules recibe daño", "subtitles.antarchy.hercules_beetle_attack": "Escarabajo hércules ataca", diff --git a/common/src/main/resources/assets/antarchy/lang/fr_fr.json b/common/src/main/resources/assets/antarchy/lang/fr_fr.json index f32de39b..f1ce6514 100644 --- a/common/src/main/resources/assets/antarchy/lang/fr_fr.json +++ b/common/src/main/resources/assets/antarchy/lang/fr_fr.json @@ -924,6 +924,9 @@ "subtitles.antarchy.stink_bug_fart": "Punaise puante pète", "subtitles.antarchy.stink_bug_idle": "Punaise puante se fait entendre", "subtitles.antarchy.rolly_polly_idle": "Cloporte se fait entendre", + "subtitles.antarchy.rolly_polly_wheel_mode": "Le cloporte s'enroule", + "subtitles.antarchy.rolly_polly_normal_mode": "Le cloporte se déroule", + "subtitles.antarchy.rolly_polly_roll": "Le cloporte roule", "subtitles.antarchy.hercules_beetle_idle": "Scarabée Hercule se fait entendre", "subtitles.antarchy.hercules_beetle_hurt": "Scarabée Hercule est blessé", "subtitles.antarchy.hercules_beetle_attack": "Scarabée Hercule attaque", diff --git a/common/src/main/resources/assets/antarchy/lang/it_it.json b/common/src/main/resources/assets/antarchy/lang/it_it.json index d5726af2..8f81036a 100644 --- a/common/src/main/resources/assets/antarchy/lang/it_it.json +++ b/common/src/main/resources/assets/antarchy/lang/it_it.json @@ -924,6 +924,9 @@ "subtitles.antarchy.stink_bug_fart": "La cimice puzzolente scoreggia", "subtitles.antarchy.stink_bug_idle": "La cimice puzzolente emette un verso", "subtitles.antarchy.rolly_polly_idle": "Il porcellino di terra emette un verso", + "subtitles.antarchy.rolly_polly_wheel_mode": "Il porcellino di terra si arrotola", + "subtitles.antarchy.rolly_polly_normal_mode": "Il porcellino di terra si srotola", + "subtitles.antarchy.rolly_polly_roll": "Il porcellino di terra rotola", "subtitles.antarchy.hercules_beetle_idle": "Lo scarabeo Ercole emette un verso", "subtitles.antarchy.hercules_beetle_hurt": "Lo scarabeo Ercole si ferisce", "subtitles.antarchy.hercules_beetle_attack": "Lo scarabeo Ercole attacca", diff --git a/common/src/main/resources/assets/antarchy/lang/ja_jp.json b/common/src/main/resources/assets/antarchy/lang/ja_jp.json index f00641bb..fa29e9fa 100644 --- a/common/src/main/resources/assets/antarchy/lang/ja_jp.json +++ b/common/src/main/resources/assets/antarchy/lang/ja_jp.json @@ -924,6 +924,9 @@ "subtitles.antarchy.stink_bug_fart": "カメムシが屁をする", "subtitles.antarchy.stink_bug_idle": "カメムシが鳴く", "subtitles.antarchy.rolly_polly_idle": "ダンゴムシが鳴く", + "subtitles.antarchy.rolly_polly_wheel_mode": "ダンゴムシが丸まる", + "subtitles.antarchy.rolly_polly_normal_mode": "ダンゴムシが伸びる", + "subtitles.antarchy.rolly_polly_roll": "ダンゴムシが転がる", "subtitles.antarchy.hercules_beetle_idle": "ヘラクレスオオカブトが鳴く", "subtitles.antarchy.hercules_beetle_hurt": "ヘラクレスオオカブトが傷つく", "subtitles.antarchy.hercules_beetle_attack": "ヘラクレスオオカブトが攻撃する", diff --git a/common/src/main/resources/assets/antarchy/lang/ko_kr.json b/common/src/main/resources/assets/antarchy/lang/ko_kr.json index 8fdaf453..482c2f4e 100644 --- a/common/src/main/resources/assets/antarchy/lang/ko_kr.json +++ b/common/src/main/resources/assets/antarchy/lang/ko_kr.json @@ -924,6 +924,9 @@ "subtitles.antarchy.stink_bug_fart": "노린재 방귀를 뀝니다", "subtitles.antarchy.stink_bug_idle": "노린재 소리를 냅니다", "subtitles.antarchy.rolly_polly_idle": "공벌레 소리를 냅니다", + "subtitles.antarchy.rolly_polly_wheel_mode": "공벌레가 몸을 맙니다", + "subtitles.antarchy.rolly_polly_normal_mode": "공벌레가 몸을 폅니다", + "subtitles.antarchy.rolly_polly_roll": "공벌레가 구릅니다", "subtitles.antarchy.hercules_beetle_idle": "헤라클레스장수풍뎅이 소리를 냅니다", "subtitles.antarchy.hercules_beetle_hurt": "헤라클레스장수풍뎅이 다칩니다", "subtitles.antarchy.hercules_beetle_attack": "헤라클레스장수풍뎅이 공격합니다", diff --git a/common/src/main/resources/assets/antarchy/lang/pt_br.json b/common/src/main/resources/assets/antarchy/lang/pt_br.json index c889f9f5..ed9225e4 100644 --- a/common/src/main/resources/assets/antarchy/lang/pt_br.json +++ b/common/src/main/resources/assets/antarchy/lang/pt_br.json @@ -924,6 +924,9 @@ "subtitles.antarchy.stink_bug_fart": "Percevejo-fedorento solta pum", "subtitles.antarchy.stink_bug_idle": "Percevejo-fedorento faz barulho", "subtitles.antarchy.rolly_polly_idle": "Tatuzinho-de-jardim faz barulho", + "subtitles.antarchy.rolly_polly_wheel_mode": "Tatuzinho-de-jardim se enrola", + "subtitles.antarchy.rolly_polly_normal_mode": "Tatuzinho-de-jardim se desenrola", + "subtitles.antarchy.rolly_polly_roll": "Tatuzinho-de-jardim rola", "subtitles.antarchy.hercules_beetle_idle": "Besouro-hércules faz barulho", "subtitles.antarchy.hercules_beetle_hurt": "Besouro-hércules se machuca", "subtitles.antarchy.hercules_beetle_attack": "Besouro-hércules ataca", diff --git a/common/src/main/resources/assets/antarchy/lang/zh_cn.json b/common/src/main/resources/assets/antarchy/lang/zh_cn.json index 206dd81e..6ee17d2c 100644 --- a/common/src/main/resources/assets/antarchy/lang/zh_cn.json +++ b/common/src/main/resources/assets/antarchy/lang/zh_cn.json @@ -924,6 +924,9 @@ "subtitles.antarchy.stink_bug_fart": "臭屁虫放屁", "subtitles.antarchy.stink_bug_idle": "臭屁虫发出动静", "subtitles.antarchy.rolly_polly_idle": "鼠妇发出动静", + "subtitles.antarchy.rolly_polly_wheel_mode": "鼠妇蜷缩起来", + "subtitles.antarchy.rolly_polly_normal_mode": "鼠妇展开身体", + "subtitles.antarchy.rolly_polly_roll": "鼠妇滚动", "subtitles.antarchy.hercules_beetle_idle": "赫拉克勒斯甲虫发出动静", "subtitles.antarchy.hercules_beetle_hurt": "赫拉克勒斯甲虫受伤", "subtitles.antarchy.hercules_beetle_attack": "赫拉克勒斯甲虫攻击", diff --git a/common/src/main/resources/assets/antarchy/lang/zh_tw.json b/common/src/main/resources/assets/antarchy/lang/zh_tw.json index 0cd92756..4b28e833 100644 --- a/common/src/main/resources/assets/antarchy/lang/zh_tw.json +++ b/common/src/main/resources/assets/antarchy/lang/zh_tw.json @@ -924,6 +924,9 @@ "subtitles.antarchy.stink_bug_fart": "臭屁蟲放屁", "subtitles.antarchy.stink_bug_idle": "臭屁蟲發出動靜", "subtitles.antarchy.rolly_polly_idle": "鼠婦發出動靜", + "subtitles.antarchy.rolly_polly_wheel_mode": "鼠婦蜷縮起來", + "subtitles.antarchy.rolly_polly_normal_mode": "鼠婦展開身體", + "subtitles.antarchy.rolly_polly_roll": "鼠婦滾動", "subtitles.antarchy.hercules_beetle_idle": "赫拉克勒斯甲蟲發出動靜", "subtitles.antarchy.hercules_beetle_hurt": "赫拉克勒斯甲蟲受傷", "subtitles.antarchy.hercules_beetle_attack": "赫拉克勒斯甲蟲攻擊", diff --git a/common/src/main/resources/assets/antarchy/sounds.json b/common/src/main/resources/assets/antarchy/sounds.json index 381cf565..03bfe42d 100644 --- a/common/src/main/resources/assets/antarchy/sounds.json +++ b/common/src/main/resources/assets/antarchy/sounds.json @@ -660,6 +660,30 @@ } ] }, + "rolly_polly_wheel_mode": { + "subtitle": "subtitles.antarchy.rolly_polly_wheel_mode", + "sounds": [ + { + "name": "antarchy:mob/rolly_polly/wheel_mode" + } + ] + }, + "rolly_polly_normal_mode": { + "subtitle": "subtitles.antarchy.rolly_polly_normal_mode", + "sounds": [ + { + "name": "antarchy:mob/rolly_polly/nromal_mode" + } + ] + }, + "rolly_polly_roll": { + "subtitle": "subtitles.antarchy.rolly_polly_roll", + "sounds": [ + { + "name": "antarchy:mob/rolly_polly/roll1" + } + ] + }, "thoraxis_nightmare_wastes_ambient": { "subtitle": "subtitles.antarchy.thoraxis_nightmare_wastes_ambient", "sounds": [ diff --git a/common/src/main/resources/assets/antarchy/sounds/mob/rolly_polly/nromal_mode.ogg b/common/src/main/resources/assets/antarchy/sounds/mob/rolly_polly/nromal_mode.ogg new file mode 100644 index 00000000..06bb33b5 Binary files /dev/null and b/common/src/main/resources/assets/antarchy/sounds/mob/rolly_polly/nromal_mode.ogg differ diff --git a/common/src/main/resources/assets/antarchy/sounds/mob/rolly_polly/roll1.ogg b/common/src/main/resources/assets/antarchy/sounds/mob/rolly_polly/roll1.ogg new file mode 100644 index 00000000..d9f41451 Binary files /dev/null and b/common/src/main/resources/assets/antarchy/sounds/mob/rolly_polly/roll1.ogg differ diff --git a/common/src/main/resources/assets/antarchy/sounds/mob/rolly_polly/wheel_mode.ogg b/common/src/main/resources/assets/antarchy/sounds/mob/rolly_polly/wheel_mode.ogg new file mode 100644 index 00000000..374adaff Binary files /dev/null and b/common/src/main/resources/assets/antarchy/sounds/mob/rolly_polly/wheel_mode.ogg differ diff --git a/common/src/main/resources/assets/antarchy/textures/block/cornea/cornea_stalk_stage2_emissive.png b/common/src/main/resources/assets/antarchy/textures/block/cornea/cornea_stalk_stage2_emissive.png new file mode 100644 index 00000000..69ddcc72 Binary files /dev/null and b/common/src/main/resources/assets/antarchy/textures/block/cornea/cornea_stalk_stage2_emissive.png differ diff --git a/common/src/main/resources/assets/antarchy/textures/block/cornea/cornea_stalk_stage2_emissive.png.mcmeta b/common/src/main/resources/assets/antarchy/textures/block/cornea/cornea_stalk_stage2_emissive.png.mcmeta new file mode 100644 index 00000000..bbd61c1f --- /dev/null +++ b/common/src/main/resources/assets/antarchy/textures/block/cornea/cornea_stalk_stage2_emissive.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 7 + } +} diff --git a/common/src/main/resources/data/antarchy/loot_table/entities/bed_bug.json b/common/src/main/resources/data/antarchy/loot_table/entities/bed_bug.json new file mode 100644 index 00000000..eb13f53d --- /dev/null +++ b/common/src/main/resources/data/antarchy/loot_table/entities/bed_bug.json @@ -0,0 +1,39 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "antarchy:raw_bug_meat", + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 1.0, + "max": 2.0 + } + }, + { + "function": "minecraft:enchanted_count_increase", + "enchantment": "minecraft:looting", + "count": { + "type": "minecraft:uniform", + "min": 0.0, + "max": 1.0 + } + } + ] + } + ], + "conditions": [ + { + "condition": "minecraft:killed_by_player" + } + ] + } + ], + "random_sequence": "antarchy:entities/bed_bug" +} diff --git a/common/src/main/resources/data/antarchy/tags/fluid/antiwater.json b/common/src/main/resources/data/antarchy/tags/fluid/antiwater.json new file mode 100644 index 00000000..cb0c3b1f --- /dev/null +++ b/common/src/main/resources/data/antarchy/tags/fluid/antiwater.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "antarchy:antiwater", + "antarchy:flowing_antiwater" + ] +} diff --git a/common/src/main/resources/data/antarchy/worldgen/configured_feature/cornea_stalk_cluster.json b/common/src/main/resources/data/antarchy/worldgen/configured_feature/cornea_stalk_cluster.json index 50f6a811..c171b3e2 100644 --- a/common/src/main/resources/data/antarchy/worldgen/configured_feature/cornea_stalk_cluster.json +++ b/common/src/main/resources/data/antarchy/worldgen/configured_feature/cornea_stalk_cluster.json @@ -1,8 +1,8 @@ { "type": "minecraft:random_patch", "config": { - "tries": 6, - "xz_spread": 3, + "tries": 12, + "xz_spread": 4, "y_spread": 1, "feature": "antarchy:cornea_stalk_single" } diff --git a/common/src/main/resources/data/antarchy/worldgen/configured_feature/patch_ceiling_cornea_stalk_cluster.json b/common/src/main/resources/data/antarchy/worldgen/configured_feature/patch_ceiling_cornea_stalk_cluster.json index 79c98da9..f48eee6a 100644 --- a/common/src/main/resources/data/antarchy/worldgen/configured_feature/patch_ceiling_cornea_stalk_cluster.json +++ b/common/src/main/resources/data/antarchy/worldgen/configured_feature/patch_ceiling_cornea_stalk_cluster.json @@ -1,8 +1,8 @@ { "type": "minecraft:random_patch", "config": { - "tries": 6, - "xz_spread": 3, + "tries": 12, + "xz_spread": 4, "y_spread": 1, "feature": "antarchy:patch_ceiling_cornea_stalk_single" } diff --git a/common/src/main/resources/data/antarchy/worldgen/placed_feature/corn_patch.json b/common/src/main/resources/data/antarchy/worldgen/placed_feature/corn_patch.json index 7549c008..3220e420 100644 --- a/common/src/main/resources/data/antarchy/worldgen/placed_feature/corn_patch.json +++ b/common/src/main/resources/data/antarchy/worldgen/placed_feature/corn_patch.json @@ -3,7 +3,7 @@ "placement": [ { "type": "minecraft:rarity_filter", - "chance": 36 + "chance": 144 }, { "type": "minecraft:in_square" diff --git a/common/src/main/resources/data/antarchy/worldgen/placed_feature/star_coral_patch.json b/common/src/main/resources/data/antarchy/worldgen/placed_feature/star_coral_patch.json index 4d42abb9..836db8d3 100644 --- a/common/src/main/resources/data/antarchy/worldgen/placed_feature/star_coral_patch.json +++ b/common/src/main/resources/data/antarchy/worldgen/placed_feature/star_coral_patch.json @@ -3,7 +3,7 @@ "placement": [ { "type": "minecraft:rarity_filter", - "chance": 14 + "chance": 56 }, { "type": "minecraft:in_square" diff --git a/common/src/main/resources/data/minecraft/tags/entity_type/arthropod.json b/common/src/main/resources/data/minecraft/tags/entity_type/arthropod.json index 26157504..445a31c7 100644 --- a/common/src/main/resources/data/minecraft/tags/entity_type/arthropod.json +++ b/common/src/main/resources/data/minecraft/tags/entity_type/arthropod.json @@ -15,6 +15,7 @@ "antarchy:hercules_beetle", "antarchy:creeping_horror", "antarchy:lurking_terror", + "antarchy:rolly_polly", "antarchy:scorpion", "antarchy:emperor_scorpion" ] 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 8ffcfb09..8b30b89f 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyConfigModuleFabric.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyConfigModuleFabric.java @@ -180,6 +180,8 @@ public final class AntarchyConfigModuleFabric { || name.equals("glowingTorchflowers") || name.equals("glowVinesUnderLeaves") || name.equals("swingThroughGrassEnabled") + || name.equals("fabricKeybindingConflictFixEnabled") + || name.equals("experimentalSettingsPopupDisabled") || name.equals("entitySpecificFireOverlayEnabled") || name.equals("dreamSandEnabled") || name.startsWith("dreamSand") diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabric.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabric.java index 06cc3954..7faeb08a 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabric.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabric.java @@ -299,7 +299,7 @@ public final class AntarchyFabric implements ModInitializer { BiomeSelectors.tag(GOLDEN_APPLE_COW_SPAWN_BIOMES), net.minecraft.world.entity.MobCategory.CREATURE, AntarchyFabricEntities.GOLDEN_APPLE_COW.get(), - 3, 1, 3 + 1, 1, 3 ); BiomeModifications.addSpawn( BiomeSelectors.tag(FLYING_SQUIRREL_SPAWN_BIOMES), 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 83925437..9d521093 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricContent.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricContent.java @@ -269,7 +269,10 @@ public final class AntarchyFabricContent { AntarchyFabricSounds.JUMPY_BUG_JUMP, AntarchyFabricSounds.SPIT_BUG_HURT, AntarchyFabricSounds.SPIT_BUG_SPIT, - AntarchyFabricSounds.BRUTALFLY_SPIT + AntarchyFabricSounds.BRUTALFLY_SPIT, + AntarchyFabricSounds.ROLLY_POLLY_WHEEL_MODE, + AntarchyFabricSounds.ROLLY_POLLY_NORMAL_MODE, + AntarchyFabricSounds.ROLLY_POLLY_ROLL ); AntarchyObjects.setOctopusBomb(AntarchyFabricEntities.OCTOPUS_BOMB); diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricDispenserBehaviors.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricDispenserBehaviors.java new file mode 100644 index 00000000..42cf6792 --- /dev/null +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricDispenserBehaviors.java @@ -0,0 +1,59 @@ +package com.craisinlord.antarchy.fabric; + +import com.craisinlord.antarchy.Antarchy; +import com.craisinlord.antarchy.fabric.registry.AntarchyFabricItems; +import net.minecraft.core.Direction; +import net.minecraft.core.dispenser.BlockSource; +import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; +import net.minecraft.core.dispenser.DispenseItemBehavior; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.SpawnEggItem; +import net.minecraft.world.level.block.DispenserBlock; +import net.minecraft.world.level.gameevent.GameEvent; + +public final class AntarchyFabricDispenserBehaviors { + private static final DispenseItemBehavior SPAWN_EGG_BEHAVIOR = new DefaultDispenseItemBehavior() { + @Override + public ItemStack execute(BlockSource source, ItemStack stack) { + Direction direction = source.state().getValue(DispenserBlock.FACING); + EntityType entityType = ((SpawnEggItem) stack.getItem()).getType(stack); + + try { + entityType.spawn(source.level(), stack, null, source.pos().relative(direction), MobSpawnType.DISPENSER, direction != Direction.UP, false); + } catch (Exception exception) { + Antarchy.LOGGER.error("Error while dispensing spawn egg from dispenser at {}", source.pos(), exception); + return ItemStack.EMPTY; + } + + stack.shrink(1); + source.level().gameEvent(null, GameEvent.ENTITY_PLACE, source.pos()); + return stack; + } + }; + + private AntarchyFabricDispenserBehaviors() { + } + + public static void register() { + registerSpawnEggs(); + registerPotions(); + } + + private static void registerSpawnEggs() { + for (var holder : AntarchyFabricItems.ITEMS.getEntries()) { + Item item = holder.get(); + if (item instanceof SpawnEggItem) { + DispenserBlock.registerBehavior(item, SPAWN_EGG_BEHAVIOR); + } + } + } + + private static void registerPotions() { + DispenserBlock.registerProjectileBehavior(Items.SPLASH_POTION); + DispenserBlock.registerProjectileBehavior(Items.LINGERING_POTION); + } +} diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricEvents.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricEvents.java index cb9d4ba4..4ae7cd7e 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricEvents.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/AntarchyFabricEvents.java @@ -25,6 +25,7 @@ import net.fabricmc.fabric.api.event.player.AttackEntityCallback; import net.minecraft.server.level.ServerPlayer; import com.craisinlord.antarchy.content.SquidzookaDispenseBehavior; import com.craisinlord.antarchy.content.RpoLauncherDispenseBehavior; +import com.craisinlord.antarchy.content.SizeRayDispenseBehavior; import com.craisinlord.antarchy.content.WaterCannonDispenseBehavior; import net.minecraft.world.level.block.ComposterBlock; import net.minecraft.world.level.block.DispenserBlock; @@ -58,6 +59,9 @@ public final class AntarchyFabricEvents { DispenserBlock.registerBehavior(AntarchyFabricItems.SQUIDZOOKA.get(), new SquidzookaDispenseBehavior()); DispenserBlock.registerBehavior(AntarchyFabricItems.RPO_LAUNCHER.get(), new RpoLauncherDispenseBehavior()); DispenserBlock.registerBehavior(AntarchyFabricItems.WATER_CANNON.get(), new WaterCannonDispenseBehavior()); + DispenserBlock.registerBehavior(AntarchyFabricItems.SHRINK_RAY.get(), new SizeRayDispenseBehavior()); + DispenserBlock.registerBehavior(AntarchyFabricItems.GROWTH_RAY.get(), new SizeRayDispenseBehavior()); + AntarchyFabricDispenserBehaviors.register(); ComposterBlock.COMPOSTABLES.put(AntarchyFabricBlocks.UMBRAL_MOSS_BLOCK.get().asItem(), 0.65f); ComposterBlock.COMPOSTABLES.put(AntarchyFabricBlocks.UMBRAL_MOSS_CARPET.get().asItem(), 0.3f); diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClientBootstrap.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClientBootstrap.java index 94b1f241..05a18146 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClientBootstrap.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyFabricClientBootstrap.java @@ -135,7 +135,7 @@ public final class AntarchyFabricClientBootstrap { 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(), RollyPollyRenderer::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.CREEPING_HORROR.get(), CreepingHorrorRenderer::new); EntityRendererRegistry.register(AntarchyFabricEntities.LURKING_TERROR.get(), LurkingTerrorRenderer::new); @@ -448,7 +448,6 @@ public final class AntarchyFabricClientBootstrap { ScorpionWhipTetherRenderHandler.tick(); DorrieJumpClientHandler.tick(); HerculesBeetleClientHandler.tick(); - RollyPollyClientHandler.tick(); }); BigBerthaClientHandler.register(); diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyKeyBindings.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyKeyBindings.java index a5d945d6..592f64ea 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyKeyBindings.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/AntarchyKeyBindings.java @@ -31,20 +31,12 @@ public final class AntarchyKeyBindings { CATEGORY ); - public static final KeyMapping ROLLY_POLLY_ROLL = new KeyMapping( - "key.antarchy.rolly_polly_roll", - InputConstants.Type.KEYSYM, - GLFW.GLFW_KEY_R, - CATEGORY - ); - private AntarchyKeyBindings() {} public static void register() { KeyBindingHelper.registerKeyBinding(BRUTALFLY_FLAP); KeyBindingHelper.registerKeyBinding(DORRIE_CHARGE_JUMP); KeyBindingHelper.registerKeyBinding(HERCULES_BEETLE_CHARGE); - KeyBindingHelper.registerKeyBinding(ROLLY_POLLY_ROLL); } public static boolean isBrutalflyFlapPressed() { diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/KeybindingConflictFixStore.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/KeybindingConflictFixStore.java new file mode 100644 index 00000000..ee5e3766 --- /dev/null +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/KeybindingConflictFixStore.java @@ -0,0 +1,40 @@ +package com.craisinlord.antarchy.fabric.client; + +import com.mojang.blaze3d.platform.InputConstants; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import net.minecraft.client.KeyMapping; + +public final class KeybindingConflictFixStore { + private static final Map> MAPPINGS = new HashMap<>(); + + private KeybindingConflictFixStore() { + } + + public static void add(InputConstants.Key key, KeyMapping mapping) { + List mappings = MAPPINGS.computeIfAbsent(key, ignored -> new ArrayList<>()); + if (!mappings.contains(mapping)) { + mappings.add(mapping); + } + } + + public static void clear() { + MAPPINGS.clear(); + } + + public static List others(InputConstants.Key key, KeyMapping active) { + List mappings = MAPPINGS.get(key); + if (mappings == null || mappings.size() < 2) { + return List.of(); + } + List others = new ArrayList<>(mappings.size() - 1); + for (KeyMapping mapping : mappings) { + if (mapping != active) { + others.add(mapping); + } + } + return others; + } +} diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/RollyPollyClientHandler.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/RollyPollyClientHandler.java deleted file mode 100644 index f8bc1c44..00000000 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/client/RollyPollyClientHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.craisinlord.antarchy.fabric.client; - -import com.craisinlord.antarchy.content.entity.RollyPollyEntity; -import com.craisinlord.antarchy.content.network.RollyPollyRollPayload; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; - -public final class RollyPollyClientHandler { - private static boolean wasPressingRoll; - - private RollyPollyClientHandler() { - } - - public static void tick() { - Minecraft mc = Minecraft.getInstance(); - LocalPlayer player = mc.player; - if (player == null || mc.screen != null || !(player.getVehicle() instanceof RollyPollyEntity)) { - wasPressingRoll = false; - return; - } - - boolean pressingRoll = AntarchyKeyBindings.ROLLY_POLLY_ROLL.isDown(); - if (pressingRoll && !wasPressingRoll) { - ClientPlayNetworking.send(new RollyPollyRollPayload()); - } - wasPressingRoll = pressingRoll; - } -} diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/mixin/DreamSandMovementMixin.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/mixin/DreamSandMovementMixin.java new file mode 100644 index 00000000..66f9f874 --- /dev/null +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/mixin/DreamSandMovementMixin.java @@ -0,0 +1,99 @@ +package com.craisinlord.antarchy.fabric.mixin; + +import com.craisinlord.antarchy.config.AntarchySettings; +import com.craisinlord.antarchy.content.AntarchyTags; +import com.craisinlord.antarchy.content.movement.DreamSandLowGravityAccess; +import com.craisinlord.antarchy.fabric.registry.AntarchyFabricBlocks; +import net.minecraft.world.damagesource.DamageSource; +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; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(LivingEntity.class) +public abstract class DreamSandMovementMixin { + @Inject(method = "jumpFromGround", at = @At("TAIL")) + private void antarchy$handleDreamSandJump(CallbackInfo ci) { + LivingEntity self = (LivingEntity) (Object) this; + if (self.level().isClientSide()) return; + + DreamSandLowGravityAccess access = (DreamSandLowGravityAccess) self; + if (!AntarchySettings.dreamSandEnabled() || antarchy$isDreamSandLowGravityBlacklisted(self)) { + access.antarchy$clearDreamSandLowGravity(); + } else if (antarchy$isStandingOnDreamSand(self)) { + self.setDeltaMovement( + self.getDeltaMovement().x, + self.getDeltaMovement().y * AntarchySettings.dreamSandJumpVelocityMultiplier(), + self.getDeltaMovement().z + ); + access.antarchy$setDreamSandLowGravityActive(true); + access.antarchy$setDreamSandLowGravityTicksRemaining((int) Math.max(1L, Math.round(AntarchySettings.dreamSandEffectDurationSeconds() * 20.0D))); + access.antarchy$setDreamSandLandingGraceTicks(0); + } + } + + @Inject(method = "tick", at = @At("TAIL")) + private void antarchy$tickDreamSandLowGravity(CallbackInfo ci) { + LivingEntity self = (LivingEntity) (Object) this; + if (self.level().isClientSide()) return; + + DreamSandLowGravityAccess access = (DreamSandLowGravityAccess) self; + int landingGraceTicks = access.antarchy$getDreamSandLandingGraceTicks(); + if (landingGraceTicks > 0) { + access.antarchy$setDreamSandLandingGraceTicks(landingGraceTicks - 1); + } + + if (!AntarchySettings.dreamSandEnabled() || antarchy$isDreamSandLowGravityBlacklisted(self) || !access.antarchy$isDreamSandLowGravityActive()) { + return; + } + + int remainingTicks = access.antarchy$getDreamSandLowGravityTicksRemaining(); + if (remainingTicks > 0) { + access.antarchy$setDreamSandLowGravityTicksRemaining(remainingTicks - 1); + } + if (access.antarchy$getDreamSandLowGravityTicksRemaining() <= 0) { + access.antarchy$clearDreamSandLowGravity(); + return; + } + + if (antarchy$isOnSolidGround(self)) { + access.antarchy$setDreamSandLowGravityActive(false); + access.antarchy$setDreamSandLowGravityTicksRemaining(0); + access.antarchy$setDreamSandLandingGraceTicks(2); + } else if (!self.onGround() && self.getDeltaMovement().y < 0.0D) { + self.setDeltaMovement( + self.getDeltaMovement().x, + self.getDeltaMovement().y * AntarchySettings.dreamSandGravityMultiplier(), + self.getDeltaMovement().z + ); + } + } + + @Inject(method = "causeFallDamage", at = @At("HEAD"), cancellable = true) + private void antarchy$handleDreamSandFall(float fallDistance, float multiplier, DamageSource source, CallbackInfoReturnable cir) { + LivingEntity self = (LivingEntity) (Object) this; + DreamSandLowGravityAccess access = (DreamSandLowGravityAccess) self; + if (!AntarchySettings.dreamSandEnabled() + || antarchy$isDreamSandLowGravityBlacklisted(self) + || (!access.antarchy$isDreamSandLowGravityActive() && access.antarchy$getDreamSandLandingGraceTicks() <= 0)) { + return; + } + + self.resetFallDistance(); + cir.setReturnValue(false); + } + + private static boolean antarchy$isOnSolidGround(LivingEntity livingEntity) { + return livingEntity.onGround() && livingEntity.getBlockStateOn().blocksMotion(); + } + + private static boolean antarchy$isStandingOnDreamSand(LivingEntity livingEntity) { + return livingEntity.level().getBlockState(livingEntity.getOnPosLegacy()).is(AntarchyFabricBlocks.DREAM_SAND.get()); + } + + private static boolean antarchy$isDreamSandLowGravityBlacklisted(LivingEntity livingEntity) { + return livingEntity.getType().is(AntarchyTags.Entities.DREAM_SAND_LOW_GRAVITY_BLACKLIST); + } +} diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/mixin/client/KeybindingConflictFixMixin.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/mixin/client/KeybindingConflictFixMixin.java new file mode 100644 index 00000000..c9e59b6f --- /dev/null +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/mixin/client/KeybindingConflictFixMixin.java @@ -0,0 +1,68 @@ +package com.craisinlord.antarchy.fabric.mixin.client; + +import com.craisinlord.antarchy.config.AntarchySettings; +import com.craisinlord.antarchy.fabric.client.KeybindingConflictFixStore; +import com.mojang.blaze3d.platform.InputConstants; +import java.util.Map; +import net.minecraft.client.KeyMapping; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +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.callback.CallbackInfo; + +@Mixin(KeyMapping.class) +public abstract class KeybindingConflictFixMixin { + @Shadow @Final private static Map MAP; + @Shadow @Final private static Map ALL; + @Shadow private InputConstants.Key key; + @Shadow private boolean isDown; + @Shadow private int clickCount; + + @Inject(method = "(Ljava/lang/String;Lcom/mojang/blaze3d/platform/InputConstants$Type;ILjava/lang/String;)V", at = @At("TAIL")) + private void antarchy$addInitialMapping(String name, InputConstants.Type type, int key, String category, CallbackInfo ci) { + KeybindingConflictFixStore.add(this.key, (KeyMapping) (Object) this); + } + + @Inject(method = "resetMapping", at = @At("TAIL")) + private static void antarchy$rebuildMappings(CallbackInfo ci) { + KeybindingConflictFixStore.clear(); + for (KeyMapping mapping : ALL.values()) { + KeybindingConflictFixStore.add(((KeybindingConflictFixMixin) (Object) mapping).key, mapping); + } + } + + @Inject(method = "click", at = @At("TAIL")) + private static void antarchy$clickConflicts(InputConstants.Key key, CallbackInfo ci) { + if (!AntarchySettings.fabricKeybindingConflictFixEnabled()) { + return; + } + KeyMapping active = MAP.get(key); + for (KeyMapping mapping : KeybindingConflictFixStore.others(key, active)) { + ((KeybindingConflictFixMixin) (Object) mapping).antarchy$click(); + } + } + + @Inject(method = "set", at = @At("TAIL")) + private static void antarchy$setConflicts(InputConstants.Key key, boolean down, CallbackInfo ci) { + if (!AntarchySettings.fabricKeybindingConflictFixEnabled()) { + return; + } + KeyMapping active = MAP.get(key); + for (KeyMapping mapping : KeybindingConflictFixStore.others(key, active)) { + ((KeybindingConflictFixMixin) (Object) mapping).antarchy$setDown(down); + } + } + + @Unique + private void antarchy$click() { + this.clickCount++; + } + + @Unique + private void antarchy$setDown(boolean down) { + this.isDown = down; + } +} diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/network/AntarchyFabricNetworking.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/network/AntarchyFabricNetworking.java index ed500544..0c81b210 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/network/AntarchyFabricNetworking.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/network/AntarchyFabricNetworking.java @@ -88,7 +88,6 @@ public final class AntarchyFabricNetworking { PayloadTypeRegistry.playC2S().register(HerculesBeetleJumpInputPayload.TYPE, HerculesBeetleJumpInputPayload.STREAM_CODEC); PayloadTypeRegistry.playC2S().register(HerculesBeetleMountedAttackPayload.TYPE, HerculesBeetleMountedAttackPayload.STREAM_CODEC); PayloadTypeRegistry.playC2S().register(HerculesBeetleMountedChargePayload.TYPE, HerculesBeetleMountedChargePayload.STREAM_CODEC); - PayloadTypeRegistry.playC2S().register(com.craisinlord.antarchy.content.network.RollyPollyRollPayload.TYPE, com.craisinlord.antarchy.content.network.RollyPollyRollPayload.STREAM_CODEC); PayloadTypeRegistry.playC2S().register(MultipartAttackPayload.TYPE, MultipartAttackPayload.STREAM_CODEC); PayloadTypeRegistry.playC2S().register(MultipartInteractPayload.TYPE, MultipartInteractPayload.STREAM_CODEC); } @@ -116,8 +115,6 @@ public final class AntarchyFabricNetworking { context.server().execute(() -> handleHerculesBeetleMountedAttack(context.player(), payload))); ServerPlayNetworking.registerGlobalReceiver(HerculesBeetleMountedChargePayload.TYPE, (payload, context) -> context.server().execute(() -> handleHerculesBeetleMountedCharge(context.player(), payload))); - ServerPlayNetworking.registerGlobalReceiver(com.craisinlord.antarchy.content.network.RollyPollyRollPayload.TYPE, (payload, context) -> - context.server().execute(() -> handleRollyPollyRoll(context.player()))); ServerPlayNetworking.registerGlobalReceiver(MultipartAttackPayload.TYPE, (payload, context) -> context.server().execute(() -> handleMultipartAttack(context.player(), payload))); ServerPlayNetworking.registerGlobalReceiver(MultipartInteractPayload.TYPE, (payload, context) -> @@ -397,12 +394,6 @@ public final class AntarchyFabricNetworking { } } - private static void handleRollyPollyRoll(ServerPlayer player) { - if (player.getVehicle() instanceof com.craisinlord.antarchy.content.entity.RollyPollyEntity rollyPolly) { - rollyPolly.handleRollToggle(player); - } - } - public static void triggerHerculesBeetleImpactShake(int durationTicks) { HerculesBeetleImpactShakeClientState.trigger(durationTicks); } diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricEntities.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricEntities.java index f93a9ac2..af2c704d 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricEntities.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricEntities.java @@ -278,11 +278,11 @@ public final class AntarchyFabricEntities { () -> buildAntType(com.craisinlord.antarchy.content.entity.ant.TermiteEntity::new, MobCategory.CREATURE, "termite")); -// public static final DeferredHolder, EntityType> ROLLY_POLLY = ENTITY_TYPES.register("rolly_polly", -// () -> EntityType.Builder.of(RollyPollyEntity::new, MobCategory.CREATURE) -// .sized(0.95F, 0.85F) -// .clientTrackingRange(10) -// .build("rolly_polly")); + public static final DeferredHolder, EntityType> ROLLY_POLLY = ENTITY_TYPES.register("rolly_polly", + () -> EntityType.Builder.of(RollyPollyEntity::new, MobCategory.CREATURE) + .sized(0.95F, 0.85F) + .clientTrackingRange(10) + .build("rolly_polly")); public static final DeferredHolder, EntityType> MOLEWORM = ENTITY_TYPES.register("moleworm", diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricEntityAttributes.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricEntityAttributes.java index eb79d2ce..cd20fd82 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricEntityAttributes.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricEntityAttributes.java @@ -303,7 +303,7 @@ public final class AntarchyFabricEntityAttributes { FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.SPIT_BUG.get(), com.craisinlord.antarchy.content.entity.SpitBugEntity.createAttributes().build()); FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.MANTIS.get(), MantisEntity.createAttributes().build()); FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.ALPHA_MANTIS.get(), AlphaMantisEntity.createAttributes().build()); -// FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.ROLLY_POLLY.get(), RollyPollyEntity.createAttributes().build()); + FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.ROLLY_POLLY.get(), RollyPollyEntity.createAttributes().build()); FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.TRIFFID.get(), TriffidEntity.createAttributes().build()); FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.LUCID.get(), LucidEntity.createAttributes().build()); FabricDefaultAttributeRegistry.register(AntarchyFabricEntities.SCORPION.get(), ScorpionEntity.createAttributes().build()); diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricItems.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricItems.java index e7f8b303..a10e7dfc 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricItems.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricItems.java @@ -1436,8 +1436,8 @@ public final class AntarchyFabricItems { () -> new DeferredSpawnEggItem(AntarchyFabricEntities.ALPHA_MANTIS, 0x8FDD6C, 0x2F5D22, new Item.Properties())); -// public static final DeferredItem ROLLY_POLLY_SPAWN_EGG = ITEMS.register("rolly_polly_spawn_egg", -// () -> new DeferredSpawnEggItem(AntarchyFabricEntities.ROLLY_POLLY, 0x7284A3, 0xBCC8DB, new Item.Properties())); + public static final DeferredItem ROLLY_POLLY_SPAWN_EGG = ITEMS.register("rolly_polly_spawn_egg", + () -> new DeferredSpawnEggItem(AntarchyFabricEntities.ROLLY_POLLY, 0x7284A3, 0xBCC8DB, new Item.Properties())); public static final DeferredItem MOLEVORE_SPAWN_EGG = ITEMS.register("molevore_spawn_egg", diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricSounds.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricSounds.java index 88c3f313..00a1839e 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricSounds.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricSounds.java @@ -635,6 +635,9 @@ public final class AntarchyFabricSounds { public static final DeferredHolder ROLLY_POLLY_IDLE = registerSoundEvent("rolly_polly_idle"); + public static final DeferredHolder ROLLY_POLLY_WHEEL_MODE = registerSoundEvent("rolly_polly_wheel_mode"); + public static final DeferredHolder ROLLY_POLLY_NORMAL_MODE = registerSoundEvent("rolly_polly_normal_mode"); + public static final DeferredHolder ROLLY_POLLY_ROLL = registerSoundEvent("rolly_polly_roll"); public static final DeferredHolder CREEPING_HORROR_GROWL = registerSoundEvent("creeping_horror_growl"); diff --git a/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricSpawnPlacements.java b/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricSpawnPlacements.java index 63916156..3d8245fa 100644 --- a/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricSpawnPlacements.java +++ b/fabric/src/main/java/com/craisinlord/antarchy/fabric/registry/AntarchyFabricSpawnPlacements.java @@ -294,7 +294,7 @@ public final class AntarchyFabricSpawnPlacements { SpawnPlacements.register(AntarchyFabricEntities.CREEPING_HORROR.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.CreepingHorrorEntity::canSpawn); SpawnPlacements.register(AntarchyFabricEntities.LURKING_TERROR.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.LurkingTerrorEntity::canSpawn); SpawnPlacements.register(AntarchyFabricEntities.TERMITE.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, net.minecraft.world.entity.animal.Animal::checkAnimalSpawnRules); -// SpawnPlacements.register(AntarchyFabricEntities.ROLLY_POLLY.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.RollyPollyEntity::canSpawn); + SpawnPlacements.register(AntarchyFabricEntities.ROLLY_POLLY.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.RollyPollyEntity::canSpawn); } } diff --git a/fabric/src/main/resources/antarchy-fabric.mixins.json b/fabric/src/main/resources/antarchy-fabric.mixins.json index 2a161455..acbb192d 100644 --- a/fabric/src/main/resources/antarchy-fabric.mixins.json +++ b/fabric/src/main/resources/antarchy-fabric.mixins.json @@ -14,6 +14,7 @@ "BloodglassEffectMixin", "BloodglassRespawnMixin", "DreamCampfireBlockEntityMixin", + "DreamSandMovementMixin", "JumpyBootsFallDamageMixin", "entity.MultipartEntityLevelRegistryMixin", "WoodTypeInvoker", @@ -24,6 +25,7 @@ "client.DuctTapeInputMixin", "client.AntiwaterFogMixin", "client.GravityGunMouseScrollMixin", + "client.KeybindingConflictFixMixin", "client.CrossbowArmPoseMixin", "client.MultipartClientSpawnMixin", "client.MultipartEntityLevelRegistryMixin" 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 36c98bd3..ecc5c49a 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyConfigModuleNeoforge.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyConfigModuleNeoforge.java @@ -124,6 +124,10 @@ public final class AntarchyConfigModuleNeoforge { AntarchySettings.setRollyPollyRollSpeedMultiplier(AntarchyMobsConfig.rollyPollyRollSpeedMultiplier()); AntarchySettings.setRollyPollyTumbleDamage(AntarchyMobsConfig.rollyPollyTumbleDamage()); AntarchySettings.setRollyPollyTameChance(AntarchyMobsConfig.rollyPollyTameChance()); + AntarchySettings.setRollyPollyBowlingDamage(AntarchyMobsConfig.rollyPollyBowlingDamage()); + AntarchySettings.setRollyPollyBowlingKnockback(AntarchyMobsConfig.rollyPollyBowlingKnockback()); + AntarchySettings.setRollyPollyArmor(AntarchyMobsConfig.rollyPollyArmor()); + AntarchySettings.setRollyPollyRolledArmorBonus(AntarchyMobsConfig.rollyPollyRolledArmorBonus()); AntarchySettings.setTriffidHealth(AntarchyMobsConfig.triffidHealth()); AntarchySettings.setTriffidAttackDamage(AntarchyMobsConfig.triffidAttackDamage()); @@ -390,6 +394,8 @@ public final class AntarchyConfigModuleNeoforge { AntarchySettings.setGlowingTorchflowers(AntarchyMiscConfig.glowingTorchflowers()); AntarchySettings.setGlowVinesUnderLeaves(AntarchyMiscConfig.glowVinesUnderLeaves()); AntarchySettings.setSwingThroughGrassEnabled(AntarchyMiscConfig.swingThroughGrassEnabled()); + AntarchySettings.setFabricKeybindingConflictFixEnabled(AntarchyMiscConfig.fabricKeybindingConflictFixEnabled()); + AntarchySettings.setExperimentalSettingsPopupDisabled(AntarchyMiscConfig.experimentalSettingsPopupDisabled()); AntarchySettings.setEntitySpecificFireOverlayEnabled(AntarchyMiscConfig.entitySpecificFireOverlayEnabled()); AntarchySettings.setBloodCrystalArmorShieldRechargeTicks(AntarchyToolsConfig.bloodCrystalArmorShieldRechargeTicks()); diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMiscConfig.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMiscConfig.java index 04369feb..aae5a0dc 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMiscConfig.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMiscConfig.java @@ -48,6 +48,8 @@ public final class AntarchyMiscConfig { private static final ModConfigSpec.BooleanValue GLOWING_TORCHFLOWERS; private static final ModConfigSpec.BooleanValue GLOW_VINES_UNDER_LEAVES; private static final ModConfigSpec.BooleanValue SWING_THROUGH_GRASS_ENABLED; + private static final ModConfigSpec.BooleanValue FABRIC_KEYBINDING_CONFLICT_FIX_ENABLED; + private static final ModConfigSpec.BooleanValue EXPERIMENTAL_SETTINGS_POPUP_DISABLED; private static final ModConfigSpec.BooleanValue ENTITY_SPECIFIC_FIRE_OVERLAY_ENABLED; static { @@ -140,6 +142,8 @@ public final class AntarchyMiscConfig { GLOWING_TORCHFLOWERS = b.comment("Whether fully-grown torchflower blocks emit light.") .define("glowingTorchflowers", true); GLOW_VINES_UNDER_LEAVES = b.comment("Whether glow vines can be placed and survive when attached under leaf blocks.") .define("glowVinesUnderLeaves", true); SWING_THROUGH_GRASS_ENABLED = b.comment("If true, empty collision plants like grass do not block melee target picking.") .define("swingThroughGrassEnabled", true); + FABRIC_KEYBINDING_CONFLICT_FIX_ENABLED = b.define("fabricKeybindingConflictFixEnabled", true); + EXPERIMENTAL_SETTINGS_POPUP_DISABLED = b.define("experimentalSettingsPopupDisabled", true); ENTITY_SPECIFIC_FIRE_OVERLAY_ENABLED = b.comment("If true, burning entities use soul fire / dream fire overlays where appropriate.") .define("entitySpecificFireOverlayEnabled", true); b.pop(); @@ -162,6 +166,8 @@ public final class AntarchyMiscConfig { static boolean glowingTorchflowers() { return GLOWING_TORCHFLOWERS.get(); } static boolean glowVinesUnderLeaves() { return GLOW_VINES_UNDER_LEAVES.get(); } static boolean swingThroughGrassEnabled() { return SWING_THROUGH_GRASS_ENABLED.get(); } + static boolean fabricKeybindingConflictFixEnabled() { return FABRIC_KEYBINDING_CONFLICT_FIX_ENABLED.get(); } + static boolean experimentalSettingsPopupDisabled() { return EXPERIMENTAL_SETTINGS_POPUP_DISABLED.get(); } static boolean entitySpecificFireOverlayEnabled() { return ENTITY_SPECIFIC_FIRE_OVERLAY_ENABLED.get(); } static double hushweedSporeLifetimeSeconds() { return HUSHWEED_SPORE_LIFETIME_SECONDS.get(); } diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMobsConfig.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMobsConfig.java index f153b6c5..2d66fcba 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMobsConfig.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyMobsConfig.java @@ -108,6 +108,10 @@ public final class AntarchyMobsConfig { private static final ModConfigSpec.DoubleValue ROLLY_POLLY_ROLL_SPEED_MULTIPLIER; private static final ModConfigSpec.DoubleValue ROLLY_POLLY_TUMBLE_DAMAGE; private static final ModConfigSpec.IntValue ROLLY_POLLY_TAME_CHANCE; + private static final ModConfigSpec.DoubleValue ROLLY_POLLY_BOWLING_DAMAGE; + private static final ModConfigSpec.DoubleValue ROLLY_POLLY_BOWLING_KNOCKBACK; + private static final ModConfigSpec.DoubleValue ROLLY_POLLY_ARMOR; + private static final ModConfigSpec.DoubleValue ROLLY_POLLY_ROLLED_ARMOR_BONUS; // Triffid @@ -414,11 +418,15 @@ public final class AntarchyMobsConfig { // Rolly Polly b.push("rollyPolly"); - ROLLY_POLLY_HEALTH = b.comment("Base max health.") .defineInRange("health", 12.0D, 1.0D, 32768.0D); + ROLLY_POLLY_HEALTH = b.comment("Base max health.") .defineInRange("health", 25.0D, 1.0D, 32768.0D); ROLLY_POLLY_MOVEMENT_SPEED = b.comment("Base movement speed.") .defineInRange("movementSpeed", 0.3D, 0.0D, 10.0D); - ROLLY_POLLY_ROLL_SPEED_MULTIPLIER = b.comment("Speed multiplier while rolled up and ridden.") .defineInRange("rollSpeedMultiplier", 2.2D, 0.1D, 20.0D); - ROLLY_POLLY_TUMBLE_DAMAGE = b.comment("Damage dealt to a helmetless rider while rolling. 0 disables.") .defineInRange("tumbleDamage", 1.0D, 0.0D, 1024.0D); + ROLLY_POLLY_ROLL_SPEED_MULTIPLIER = b.comment("Speed multiplier while rolled up.") .defineInRange("rollSpeedMultiplier", 2.2D, 0.1D, 20.0D); + ROLLY_POLLY_TUMBLE_DAMAGE = b.comment("Unused (riding removed). Retained for config compatibility.") .defineInRange("tumbleDamage", 1.0D, 0.0D, 1024.0D); ROLLY_POLLY_TAME_CHANCE = b.comment("Taming succeeds with a 1-in-N chance per food item.") .defineInRange("tameChance", 3, 1, 100); + ROLLY_POLLY_BOWLING_DAMAGE = b.comment("Damage dealt by a tamed rolly polly's rolling bowling attack.") .defineInRange("bowlingDamage", 3.0D, 0.0D, 1024.0D); + ROLLY_POLLY_BOWLING_KNOCKBACK = b.comment("Knockback strength of a tamed rolly polly's rolling bowling attack.") .defineInRange("bowlingKnockback", 0.8D, 0.0D, 20.0D); + ROLLY_POLLY_ARMOR = b.comment("Base armor value.") .defineInRange("armor", 2.0D, 0.0D, 100.0D); + ROLLY_POLLY_ROLLED_ARMOR_BONUS = b.comment("Additional armor gained while rolled up.") .defineInRange("rolledArmorBonus", 16.0D, 0.0D, 100.0D); b.pop(); @@ -663,6 +671,10 @@ public final class AntarchyMobsConfig { static double rollyPollyRollSpeedMultiplier() { return ROLLY_POLLY_ROLL_SPEED_MULTIPLIER.get(); } static double rollyPollyTumbleDamage() { return ROLLY_POLLY_TUMBLE_DAMAGE.get(); } static int rollyPollyTameChance() { return ROLLY_POLLY_TAME_CHANCE.get(); } + static double rollyPollyBowlingDamage() { return ROLLY_POLLY_BOWLING_DAMAGE.get(); } + static double rollyPollyBowlingKnockback() { return ROLLY_POLLY_BOWLING_KNOCKBACK.get(); } + static double rollyPollyArmor() { return ROLLY_POLLY_ARMOR.get(); } + static double rollyPollyRolledArmorBonus() { return ROLLY_POLLY_ROLLED_ARMOR_BONUS.get(); } static double triffidHealth() { return TRIFFID_HEALTH.get(); } static double triffidAttackDamage() { return TRIFFID_ATTACK_DAMAGE.get(); } 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 129ac179..4b3f0739 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyNeoforge.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyNeoforge.java @@ -173,7 +173,10 @@ public class AntarchyNeoforge { AntarchyNeoforgeSounds.JUMPY_BUG_JUMP, AntarchyNeoforgeSounds.SPIT_BUG_HURT, AntarchyNeoforgeSounds.SPIT_BUG_SPIT, - AntarchyNeoforgeSounds.BRUTALFLY_SPIT + AntarchyNeoforgeSounds.BRUTALFLY_SPIT, + AntarchyNeoforgeSounds.ROLLY_POLLY_WHEEL_MODE, + AntarchyNeoforgeSounds.ROLLY_POLLY_NORMAL_MODE, + AntarchyNeoforgeSounds.ROLLY_POLLY_ROLL ); bindCommonObjects(); ScorpionWhipTetherSync.setSink((player, targetId) -> PacketDistributor.sendToPlayersTrackingEntityAndSelf( diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyToolsConfig.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyToolsConfig.java index fd05a416..5e48ba93 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyToolsConfig.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/AntarchyToolsConfig.java @@ -305,7 +305,7 @@ public final class AntarchyToolsConfig { // Battle Axe b.push("battleAxe"); - BATTLE_AXE_ATTACK_DAMAGE = b.comment("Attack damage of the Battle Axe.").defineInRange("attackDamage", 44.0D, 0.0D, 4096.0D); + BATTLE_AXE_ATTACK_DAMAGE = b.comment("Attack damage of the Battle Axe.").defineInRange("attackDamage", 46.0D, 0.0D, 4096.0D); BATTLE_AXE_ATTACK_SPEED = b.comment("Attack speed of the Battle Axe.") .defineInRange("attackSpeed", -3.1D, -10.0D, 10.0D); b.pop(); @@ -324,7 +324,7 @@ public final class AntarchyToolsConfig { b.pop(); b.push("attitudeAdjuster"); - ATTITUDE_ADJUSTER_BASE_DAMAGE = b.comment("Base attack damage of the Attitude Adjuster.").defineInRange("baseDamage", 40.0D, 0.0D, 4096.0D); + ATTITUDE_ADJUSTER_BASE_DAMAGE = b.comment("Base attack damage of the Attitude Adjuster.").defineInRange("baseDamage", 47.0D, 0.0D, 4096.0D); ATTITUDE_ADJUSTER_BREAKS_BLOCKS = b.comment("If true, player ground slams can break a small patch of blocks on impact.").define("breaksBlocks", true); b.pop(); diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyKeyBindings.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyKeyBindings.java index 8560fb9b..a73ff650 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyKeyBindings.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyKeyBindings.java @@ -37,14 +37,6 @@ public final class AntarchyKeyBindings { CATEGORY ); - public static final KeyMapping ROLLY_POLLY_ROLL = new KeyMapping( - "key.antarchy.rolly_polly_roll", - KeyConflictContext.IN_GAME, - InputConstants.Type.KEYSYM, - InputConstants.KEY_R, - CATEGORY - ); - private AntarchyKeyBindings() {} @SubscribeEvent @@ -52,6 +44,5 @@ public final class AntarchyKeyBindings { event.register(BRUTALFLY_FLAP); event.register(DORRIE_CHARGE_JUMP); event.register(HERCULES_BEETLE_CHARGE); - event.register(ROLLY_POLLY_ROLL); } } diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyNeoForgeClient.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyNeoForgeClient.java index 606a7889..0fb72b54 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyNeoForgeClient.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/client/AntarchyNeoForgeClient.java @@ -139,7 +139,7 @@ public final class AntarchyNeoForgeClient { event.registerEntityRenderer(AntarchyNeoforgeEntites.OURANWOOD_DEER.get(), context -> new com.craisinlord.antarchy.content.client.renderer.OuranwoodDeerRenderer(context)); event.registerEntityRenderer(AntarchyNeoforgeEntites.GLIMMER.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.glimmer.GlimmerRenderer(context))); event.registerEntityRenderer(AntarchyNeoforgeEntites.ELKA.get(), context -> new com.craisinlord.antarchy.content.client.renderer.ElkaRenderer(context)); -// event.registerEntityRenderer(AntarchyNeoforgeEntites.ROLLY_POLLY.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.RollyPollyRenderer(context))); + event.registerEntityRenderer(AntarchyNeoforgeEntites.ROLLY_POLLY.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.RollyPollyRenderer(context))); event.registerEntityRenderer(AntarchyNeoforgeEntites.TERMITE.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.TermiteRenderer(context))); event.registerEntityRenderer(AntarchyNeoforgeEntites.CREEPING_HORROR.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.CreepingHorrorRenderer(context))); event.registerEntityRenderer(AntarchyNeoforgeEntites.LURKING_TERROR.get(), context -> withParalyzedGeoLayer(new com.craisinlord.antarchy.content.client.renderer.LurkingTerrorRenderer(context))); diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/client/RollyPollyClientHandler.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/client/RollyPollyClientHandler.java deleted file mode 100644 index e636a92b..00000000 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/client/RollyPollyClientHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.craisinlord.antarchy.neoforge.client; - -import com.craisinlord.antarchy.Antarchy; -import com.craisinlord.antarchy.content.entity.RollyPollyEntity; -import com.craisinlord.antarchy.content.network.RollyPollyRollPayload; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; -import net.neoforged.api.distmarker.Dist; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.EventBusSubscriber; -import net.neoforged.neoforge.client.event.ClientTickEvent; -import net.neoforged.neoforge.network.PacketDistributor; - -@EventBusSubscriber(modid = Antarchy.MODID, value = Dist.CLIENT) -public final class RollyPollyClientHandler { - private static boolean wasPressingRoll; - - private RollyPollyClientHandler() { - } - - @SubscribeEvent - public static void onClientTick(ClientTickEvent.Post event) { - Minecraft mc = Minecraft.getInstance(); - LocalPlayer player = mc.player; - if (player == null || mc.screen != null || !(player.getVehicle() instanceof RollyPollyEntity)) { - wasPressingRoll = false; - return; - } - - boolean pressingRoll = AntarchyKeyBindings.ROLLY_POLLY_ROLL.isDown(); - if (pressingRoll && !wasPressingRoll) { - PacketDistributor.sendToServer(new RollyPollyRollPayload()); - } - wasPressingRoll = pressingRoll; - } -} diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/network/RollyPollyNetworking.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/network/RollyPollyNetworking.java deleted file mode 100644 index 778bee23..00000000 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/network/RollyPollyNetworking.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.craisinlord.antarchy.neoforge.network; - -import com.craisinlord.antarchy.content.entity.RollyPollyEntity; -import com.craisinlord.antarchy.content.network.RollyPollyRollPayload; -import net.minecraft.server.level.ServerPlayer; -import net.neoforged.neoforge.network.handling.IPayloadContext; -import net.neoforged.neoforge.network.registration.PayloadRegistrar; - -public final class RollyPollyNetworking { - private RollyPollyNetworking() { - } - - public static void register(PayloadRegistrar registrar) { - registrar.playToServer( - RollyPollyRollPayload.TYPE, - RollyPollyRollPayload.STREAM_CODEC, - RollyPollyNetworking::handleRollToggle - ); - } - - private static void handleRollToggle(RollyPollyRollPayload payload, IPayloadContext context) { - context.enqueueWork(() -> { - if (!(context.player() instanceof ServerPlayer player)) { - return; - } - if (player.getVehicle() instanceof RollyPollyEntity rollyPolly) { - rollyPolly.handleRollToggle(player); - } - }); - } -} 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 e4c2bbc2..d280e27b 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 @@ -63,7 +63,7 @@ public class AntarchyNeoforgeCreativeModeTabs { event.accept(AntarchyNeoforgeItems.MOLEWORM_SPAWN_EGG.get()); event.accept(AntarchyNeoforgeItems.MANTIS_SPAWN_EGG.get()); event.accept(AntarchyNeoforgeItems.ALPHA_MANTIS_SPAWN_EGG.get()); -// event.accept(AntarchyNeoforgeItems.ROLLY_POLLY_SPAWN_EGG.get()); + event.accept(AntarchyNeoforgeItems.ROLLY_POLLY_SPAWN_EGG.get()); event.accept(AntarchyNeoforgeItems.MOLEVORE_SPAWN_EGG.get()); event.accept(AntarchyNeoforgeItems.TRIFFID_SPAWN_EGG.get()); event.accept(AntarchyNeoforgeItems.APPLE_COW_SPAWN_EGG.get()); 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 06349069..5908cab6 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 @@ -107,11 +107,11 @@ public final class AntarchyNeoforgeEntites { .sized(4.25F, 3.35F) .clientTrackingRange(10) .build("alpha_mantis")); -// public static final DeferredHolder, EntityType> ROLLY_POLLY = ENTITY_TYPES.register("rolly_polly", -// () -> EntityType.Builder.of(RollyPollyEntity::new, MobCategory.CREATURE) -// .sized(0.95F, 0.85F) -// .clientTrackingRange(10) -// .build("rolly_polly")); + public static final DeferredHolder, EntityType> ROLLY_POLLY = ENTITY_TYPES.register("rolly_polly", + () -> EntityType.Builder.of(RollyPollyEntity::new, MobCategory.CREATURE) + .sized(0.95F, 0.85F) + .clientTrackingRange(10) + .build("rolly_polly")); public static final DeferredHolder, EntityType> OURANWOOD_BOAT_ENTITY = ENTITY_TYPES.register("ouranwood_boat", () -> EntityType.Builder.of(OuranwoodBoatEntity::new, MobCategory.MISC) .sized(1.375F, 0.5625F) diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeEntityAttributes.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeEntityAttributes.java index 4b568753..ba13ab9b 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeEntityAttributes.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeEntityAttributes.java @@ -46,7 +46,7 @@ public class AntarchyNeoforgeEntityAttributes { AntarchySettings.termiteMovementSpeed(), AntarchySettings.termiteAttackDamage() ).build()); -// event.put(AntarchyNeoforgeEntites.ROLLY_POLLY.get(), RollyPollyEntity.createAttributes().build()); + event.put(AntarchyNeoforgeEntites.ROLLY_POLLY.get(), RollyPollyEntity.createAttributes().build()); event.put(AntarchyNeoforgeEntites.DR_TRAYAURUS.get(), Villager.createAttributes().build()); event.put(AntarchyNeoforgeEntites.CLOUD_SHARK.get(), CloudSharkEntity.createAttributes().build()); event.put(AntarchyNeoforgeEntites.KRAKEN.get(), KrakenEntity.createAttributes().build()); 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 a08489e7..404577c3 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 @@ -711,8 +711,8 @@ public final class AntarchyNeoforgeItems { () -> new DeferredSpawnEggItem(AntarchyNeoforgeEntites.MANTIS, 0xF8F8F2, 0x63B44A, new Item.Properties())); public static final DeferredItem ALPHA_MANTIS_SPAWN_EGG = ITEMS.register("alpha_mantis_spawn_egg", () -> new DeferredSpawnEggItem(AntarchyNeoforgeEntites.ALPHA_MANTIS, 0x8FDD6C, 0x2F5D22, new Item.Properties().rarity(Rarity.UNCOMMON))); -// public static final DeferredItem ROLLY_POLLY_SPAWN_EGG = ITEMS.register("rolly_polly_spawn_egg", -// () -> new DeferredSpawnEggItem(AntarchyNeoforgeEntites.ROLLY_POLLY, 0x7284A3, 0xBCC8DB, new Item.Properties())); + public static final DeferredItem ROLLY_POLLY_SPAWN_EGG = ITEMS.register("rolly_polly_spawn_egg", + () -> new DeferredSpawnEggItem(AntarchyNeoforgeEntites.ROLLY_POLLY, 0x7284A3, 0xBCC8DB, new Item.Properties())); public static final DeferredItem MOLEVORE_SPAWN_EGG = ITEMS.register("molevore_spawn_egg", () -> new DeferredSpawnEggItem(AntarchyNeoforgeEntites.MOLEVORE, 0x4A4A4A, 0x6B4A2B, new Item.Properties().rarity(Rarity.UNCOMMON))); public static final DeferredItem TRIFFID_SPAWN_EGG = ITEMS.register("triffid_spawn_egg", diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgePayloadHandlers.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgePayloadHandlers.java index 5db65355..c98e10cc 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgePayloadHandlers.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgePayloadHandlers.java @@ -24,7 +24,6 @@ public class AntarchyNeoforgePayloadHandlers { JumpyBootsNetworking.register(registrar); DorrieJumpNetworking.register(registrar); HerculesBeetleNetworking.register(registrar); - com.craisinlord.antarchy.neoforge.network.RollyPollyNetworking.register(registrar); registrar.playToClient( com.craisinlord.antarchy.content.network.BloodglassStatePayload.TYPE, com.craisinlord.antarchy.content.network.BloodglassStatePayload.STREAM_CODEC, 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 6c54accf..11675cac 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 @@ -137,6 +137,9 @@ public final class AntarchyNeoforgeSounds { public static final DeferredHolder STINK_BUG_FART = registerSoundEvent("stink_bug_fart"); public static final DeferredHolder STINK_BUG_IDLE = registerSoundEvent("stink_bug_idle"); public static final DeferredHolder ROLLY_POLLY_IDLE = registerSoundEvent("rolly_polly_idle"); + public static final DeferredHolder ROLLY_POLLY_WHEEL_MODE = registerSoundEvent("rolly_polly_wheel_mode"); + public static final DeferredHolder ROLLY_POLLY_NORMAL_MODE = registerSoundEvent("rolly_polly_normal_mode"); + public static final DeferredHolder ROLLY_POLLY_ROLL = registerSoundEvent("rolly_polly_roll"); public static final DeferredHolder CREEPING_HORROR_GROWL = registerSoundEvent("creeping_horror_growl"); public static final DeferredHolder CREEPING_HORROR_HURT = registerSoundEvent("creeping_horror_hurt"); public static final DeferredHolder CREEPING_HORROR_BITE = registerSoundEvent("creeping_horror_bite"); diff --git a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeSpawnPlacements.java b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeSpawnPlacements.java index 85f1feb2..678491f3 100644 --- a/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeSpawnPlacements.java +++ b/neoforge/src/main/java/com/craisinlord/antarchy/neoforge/registry/AntarchyNeoforgeSpawnPlacements.java @@ -53,7 +53,7 @@ public class AntarchyNeoforgeSpawnPlacements { event.register(AntarchyNeoforgeEntites.CREEPING_HORROR.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, CreepingHorrorEntity::canSpawn, RegisterSpawnPlacementsEvent.Operation.OR); event.register(AntarchyNeoforgeEntites.LURKING_TERROR.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, LurkingTerrorEntity::canSpawn, RegisterSpawnPlacementsEvent.Operation.OR); event.register(AntarchyNeoforgeEntites.TERMITE.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, net.minecraft.world.entity.animal.Animal::checkAnimalSpawnRules, RegisterSpawnPlacementsEvent.Operation.OR); -// event.register(AntarchyNeoforgeEntites.ROLLY_POLLY.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.RollyPollyEntity::canSpawn, RegisterSpawnPlacementsEvent.Operation.OR); + event.register(AntarchyNeoforgeEntites.ROLLY_POLLY.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, com.craisinlord.antarchy.content.entity.RollyPollyEntity::canSpawn, RegisterSpawnPlacementsEvent.Operation.OR); event.register(AntarchyNeoforgeEntites.CHEEP.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, AbstractFish::checkSurfaceWaterAnimalSpawnRules, RegisterSpawnPlacementsEvent.Operation.OR); event.register(AntarchyNeoforgeEntites.DORRIE.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, net.minecraft.world.entity.animal.Animal::checkAnimalSpawnRules, RegisterSpawnPlacementsEvent.Operation.OR); event.register(AntarchyNeoforgeEntites.OURANWOOD_DEER.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, net.minecraft.world.entity.animal.Animal::checkAnimalSpawnRules, RegisterSpawnPlacementsEvent.Operation.OR); diff --git a/neoforge/src/main/resources/data/antarchy/neoforge/biome_modifier/golden_apple_cow_spawns.json b/neoforge/src/main/resources/data/antarchy/neoforge/biome_modifier/golden_apple_cow_spawns.json index bb996235..fae16f0e 100644 --- a/neoforge/src/main/resources/data/antarchy/neoforge/biome_modifier/golden_apple_cow_spawns.json +++ b/neoforge/src/main/resources/data/antarchy/neoforge/biome_modifier/golden_apple_cow_spawns.json @@ -4,7 +4,7 @@ "spawners": [ { "type": "antarchy:golden_apple_cow", - "weight": 3, + "weight": 1, "minCount": 1, "maxCount": 3 }