Mobs Are Guaranteed To Have At Least One Piece OF Armor
All checks were successful
Twine/pipeline/head This commit looks good
All checks were successful
Twine/pipeline/head This commit looks good
This commit is contained in:
parent
7da5501008
commit
f93d8932d5
@ -37,6 +37,7 @@ 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
|
||||
|
||||
### Stage 3
|
||||
- Hostile Mobs Attack Passive Mobs
|
||||
|
@ -49,7 +49,7 @@ public class MixinBoatEntity implements BoatUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Ljava/util/List;size()I"), method = "updatePassengerPosition")
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Ljava/util/List;size()I"), method = "updatePassengerPosition", allow = 2, require = 2)
|
||||
public int updatePassengerPosition(List<Entity> list) {
|
||||
if (hasChest() != BoatChestMode.NONE) {
|
||||
return list.size() + 1;
|
||||
|
@ -19,9 +19,12 @@ 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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Mixin(MobEntity.class)
|
||||
public class MixinMobEntity {
|
||||
@ -68,4 +71,16 @@ public class MixinMobEntity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Ljava/util/Random;nextFloat()F", ordinal = 0), method = "initEquipment", allow = 1)
|
||||
public float initEquipment(Random random) {
|
||||
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) {
|
||||
return -1f;
|
||||
} else {
|
||||
return random.nextFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user