Re-balance Stages
Twine/pipeline/head This commit looks good Details

This commit is contained in:
TheBrokenRail 2020-06-15 17:31:15 -04:00
parent 3974c12dd8
commit 5eb72dbab7
5 changed files with 21 additions and 8 deletions

View File

@ -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)

View File

@ -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();
}
}

View File

@ -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<LivingEntity> {
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<LivingEntity> {
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();
}
}

View File

@ -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();

View File

@ -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;
}