diff --git a/README.md b/README.md index 5f4fa0f..af05c32 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,10 @@ Each player has a "personal" stage of an area, the highest online player's diffi - Normal Gameplay ### Stage 2 -- Mobs Are Guaranteed To Have At Least One Piece OF Armor +- Hostile Mobs Attack Passive Mobs ### Stage 3 -- Hostile Mobs Attack Passive Mobs +- Mobs Are Guaranteed To Have At Least One Piece Of Armor ### Stage 4 - Villages Kick You Out (Using Iron Golems) diff --git a/src/main/java/com/thebrokenrail/twine/entity/ExplodeArtificialBlockGoal.java b/src/main/java/com/thebrokenrail/twine/entity/ExplodeArtificialBlockGoal.java index e1b0bbd..b5b11b9 100644 --- a/src/main/java/com/thebrokenrail/twine/entity/ExplodeArtificialBlockGoal.java +++ b/src/main/java/com/thebrokenrail/twine/entity/ExplodeArtificialBlockGoal.java @@ -2,6 +2,7 @@ package com.thebrokenrail.twine.entity; import com.thebrokenrail.twine.Twine; import com.thebrokenrail.twine.component.StageDataComponent; +import com.thebrokenrail.twine.util.StageUtil; import net.minecraft.block.BlockState; import net.minecraft.entity.ai.goal.MoveToTargetPosGoal; import net.minecraft.entity.mob.CreeperEntity; @@ -59,6 +60,6 @@ public class ExplodeArtificialBlockGoal extends MoveToTargetPosGoal { BlockPos pos = mob.getBlockPos(); int stage = component.findEffectiveStageOfChunk((ServerWorld) mob.getEntityWorld(), pos); - return stage >= 3 && super.canStart(); + return stage >= StageUtil.CREEPERS_TARGET_ARTIFICIAL_BLOCKS && super.canStart(); } } diff --git a/src/main/java/com/thebrokenrail/twine/entity/FollowPassiveEntityGoal.java b/src/main/java/com/thebrokenrail/twine/entity/FollowPassiveEntityGoal.java index 9b5016e..51b24fe 100644 --- a/src/main/java/com/thebrokenrail/twine/entity/FollowPassiveEntityGoal.java +++ b/src/main/java/com/thebrokenrail/twine/entity/FollowPassiveEntityGoal.java @@ -1,6 +1,7 @@ package com.thebrokenrail.twine.entity; import com.thebrokenrail.twine.component.StageDataComponent; +import com.thebrokenrail.twine.util.StageUtil; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.ai.goal.FollowTargetGoal; import net.minecraft.entity.mob.Angerable; @@ -18,7 +19,7 @@ public class FollowPassiveEntityGoal extends FollowTargetGoal { BlockPos pos = mob.getBlockPos(); int stage = component.findEffectiveStageOfChunk((ServerWorld) mob.getEntityWorld(), pos); - return entity instanceof PassiveEntity || (entity instanceof PlayerEntity && stage >= 4); + return entity instanceof PassiveEntity || (entity instanceof PlayerEntity && stage >= StageUtil.NEUTRAL_MOBS_ARE_HOSTILE); }); } @@ -27,6 +28,6 @@ public class FollowPassiveEntityGoal extends FollowTargetGoal { BlockPos pos = mob.getBlockPos(); int stage = component.findEffectiveStageOfChunk((ServerWorld) mob.getEntityWorld(), pos); - return mob instanceof HostileEntity && (!(mob instanceof Angerable) || stage >= 4) && stage >= 2 && super.canStart(); + return mob instanceof HostileEntity && (!(mob instanceof Angerable) || stage >= StageUtil.NEUTRAL_MOBS_ARE_HOSTILE) && stage >= StageUtil.HOSTILE_MOBS_TARGET_PASSIVE_MOBS && super.canStart(); } } diff --git a/src/main/java/com/thebrokenrail/twine/mixin/MixinMobEntity.java b/src/main/java/com/thebrokenrail/twine/mixin/MixinMobEntity.java index bf98cfd..6f5d8c2 100644 --- a/src/main/java/com/thebrokenrail/twine/mixin/MixinMobEntity.java +++ b/src/main/java/com/thebrokenrail/twine/mixin/MixinMobEntity.java @@ -5,6 +5,7 @@ import com.thebrokenrail.twine.entity.ExplodeArtificialBlockGoal; import com.thebrokenrail.twine.entity.FleeEndRodGoal; import com.thebrokenrail.twine.entity.FollowPassiveEntityGoal; import com.thebrokenrail.twine.entity.StandOnGlowingObsidian; +import com.thebrokenrail.twine.util.StageUtil; import net.minecraft.entity.EntityType; import net.minecraft.entity.ai.goal.FollowTargetGoal; import net.minecraft.entity.ai.goal.GoalSelector; @@ -54,7 +55,7 @@ public class MixinMobEntity { BlockPos blockPos = ((IronGolemEntity) (Object) this).getBlockPos(); int stage = component.findEffectiveStageOfChunk((ServerWorld) (((IronGolemEntity) (Object) this).getEntityWorld()), blockPos); - return stage >= 3 && !((IronGolemEntity) (Object) this).isPlayerCreated(); + return stage >= StageUtil.IRON_GOLEMS_TARGET_PLAYERS && !((IronGolemEntity) (Object) this).isPlayerCreated(); })); } } @@ -66,7 +67,7 @@ public class MixinMobEntity { StageDataComponent component = StageDataComponent.getFromWorld((ServerWorld) ((MobEntity) (Object) this).getEntityWorld()); BlockPos blockPos = ((MobEntity) (Object) this).getBlockPos(); int stage = component.findEffectiveStageOfChunk((ServerWorld) ((MobEntity) (Object) this).getEntityWorld(), blockPos); - if (stage >= 5) { + if (stage >= StageUtil.MOBS_NO_LONGER_BURN_IN_SUNLIGHT) { info.setReturnValue(false); } } @@ -77,7 +78,7 @@ public class MixinMobEntity { StageDataComponent component = StageDataComponent.getFromWorld((ServerWorld) ((MobEntity) (Object) this).getEntityWorld()); BlockPos blockPos = ((MobEntity) (Object) this).getBlockPos(); int stage = component.findEffectiveStageOfChunk((ServerWorld) ((MobEntity) (Object) this).getEntityWorld(), blockPos); - if (stage >= 1) { + if (stage >= StageUtil.MOBS_GUARANTEED_ARMOR) { return -1f; } else { return random.nextFloat(); diff --git a/src/main/java/com/thebrokenrail/twine/util/StageUtil.java b/src/main/java/com/thebrokenrail/twine/util/StageUtil.java new file mode 100644 index 0000000..7510b15 --- /dev/null +++ b/src/main/java/com/thebrokenrail/twine/util/StageUtil.java @@ -0,0 +1,10 @@ +package com.thebrokenrail.twine.util; + +public class StageUtil { + public static final int NEUTRAL_MOBS_ARE_HOSTILE = 4; + public static final int CREEPERS_TARGET_ARTIFICIAL_BLOCKS = 3; + public static final int MOBS_GUARANTEED_ARMOR = 2; + public static final int HOSTILE_MOBS_TARGET_PASSIVE_MOBS = 1; + public static final int IRON_GOLEMS_TARGET_PLAYERS = 3; + public static final int MOBS_NO_LONGER_BURN_IN_SUNLIGHT = 5; +}