Skip to content

Commit 433bf8a

Browse files
committed
Fix not nerfing the baby stray's projectile shots, and move the modifier to a config option
1 parent 9c21d94 commit 433bf8a

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

src/additions/java/mekanism/additions/common/config/AdditionsConfig.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class AdditionsConfig extends BaseMekanismConfig {
3030

3131
public final CachedIntValue obsidianTNTDelay;
3232
public final CachedFloatValue obsidianTNTBlastRadius;
33+
public final CachedDoubleValue babyArrowDamageMultiplier;
3334
public final CachedBooleanValue voiceServerEnabled;
3435
public final CachedIntValue voicePort;
3536
private final Map<BabyType, SpawnConfig> spawnConfigs = new EnumMap<>(BabyType.class);
@@ -43,6 +44,9 @@ public class AdditionsConfig extends BaseMekanismConfig {
4344
obsidianTNTBlastRadius = CachedFloatValue.wrap(this, builder.comment("Radius of the explosion of Obsidian TNT.")
4445
.defineInRange("obsidianTNTBlastRadius", 12, 0.1, 1_000));
4546

47+
babyArrowDamageMultiplier = CachedDoubleValue.wrap(this, builder.comment("Damage multiplier of arrows shot by baby mobs.")
48+
.defineInRange("babyArrowDamageMultiplier", 0.25, 0.1, 10));
49+
4650
voiceServerEnabled = CachedBooleanValue.wrap(this, builder.comment("Enables the voice server for Walkie Talkies.").worldRestart()
4751
.define("voiceServerEnabled", false));
4852
voicePort = CachedIntValue.wrap(this, builder.comment("TCP port for the Voice server to listen on.")

src/additions/java/mekanism/additions/common/entity/baby/EntityBabyBogged.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package mekanism.additions.common.entity.baby;
22

3+
import mekanism.additions.common.config.MekanismAdditionsConfig;
34
import mekanism.additions.common.registries.AdditionsEntityTypes;
45
import net.minecraft.util.RandomSource;
56
import net.minecraft.world.DifficultyInstance;
@@ -34,15 +35,16 @@ public EntityDimensions getDefaultDimensions(@NotNull Pose pose) {
3435
return getType().getDimensions();
3536
}
3637

38+
@NotNull
3739
@Override
38-
protected AbstractArrow getArrow(ItemStack arrow, float velocity, @Nullable ItemStack weapon) {
40+
protected AbstractArrow getArrow(@NotNull ItemStack arrow, float velocity, @Nullable ItemStack weapon) {
3941
AbstractArrow projectile = super.getArrow(arrow, velocity, weapon);
40-
projectile.setBaseDamage(projectile.getBaseDamage() * 0.25);
42+
projectile.setBaseDamage(projectile.getBaseDamage() * MekanismAdditionsConfig.additions.babyArrowDamageMultiplier.get());
4143
return projectile;
4244
}
4345

4446
@Override
45-
protected void populateDefaultEquipmentSlots(RandomSource random, DifficultyInstance difficulty) {
47+
protected void populateDefaultEquipmentSlots(@NotNull RandomSource random, @NotNull DifficultyInstance difficulty) {
4648
super.populateDefaultEquipmentSlots(random, difficulty);
4749
for (EquipmentSlot slot : EquipmentSlot.values()) {
4850
if (slot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {

src/additions/java/mekanism/additions/common/entity/baby/EntityBabySkeleton.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package mekanism.additions.common.entity.baby;
22

3+
import mekanism.additions.common.config.MekanismAdditionsConfig;
34
import mekanism.additions.common.registries.AdditionsEntityTypes;
45
import net.minecraft.util.RandomSource;
56
import net.minecraft.world.DifficultyInstance;
@@ -43,15 +44,16 @@ protected void doFreezeConversion() {
4344
}
4445
}
4546

47+
@NotNull
4648
@Override
47-
protected AbstractArrow getArrow(ItemStack arrow, float velocity, @Nullable ItemStack weapon) {
49+
protected AbstractArrow getArrow(@NotNull ItemStack arrow, float velocity, @Nullable ItemStack weapon) {
4850
AbstractArrow projectile = super.getArrow(arrow, velocity, weapon);
49-
projectile.setBaseDamage(projectile.getBaseDamage() * 0.25);
51+
projectile.setBaseDamage(projectile.getBaseDamage() * MekanismAdditionsConfig.additions.babyArrowDamageMultiplier.get());
5052
return projectile;
5153
}
5254

5355
@Override
54-
protected void populateDefaultEquipmentSlots(RandomSource random, DifficultyInstance difficulty) {
56+
protected void populateDefaultEquipmentSlots(@NotNull RandomSource random, @NotNull DifficultyInstance difficulty) {
5557
super.populateDefaultEquipmentSlots(random, difficulty);
5658
for (EquipmentSlot slot : EquipmentSlot.values()) {
5759
if (slot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {

src/additions/java/mekanism/additions/common/entity/baby/EntityBabyStray.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package mekanism.additions.common.entity.baby;
22

3+
import mekanism.additions.common.config.MekanismAdditionsConfig;
34
import mekanism.additions.common.registries.AdditionsEntityTypes;
45
import net.minecraft.core.BlockPos;
56
import net.minecraft.core.Direction;
@@ -11,11 +12,13 @@
1112
import net.minecraft.world.entity.MobSpawnType;
1213
import net.minecraft.world.entity.Pose;
1314
import net.minecraft.world.entity.monster.Stray;
15+
import net.minecraft.world.entity.projectile.AbstractArrow;
1416
import net.minecraft.world.item.ItemStack;
1517
import net.minecraft.world.level.Level;
1618
import net.minecraft.world.level.ServerLevelAccessor;
1719
import net.minecraft.world.level.block.Blocks;
1820
import org.jetbrains.annotations.NotNull;
21+
import org.jetbrains.annotations.Nullable;
1922

2023
public class EntityBabyStray extends Stray {
2124

@@ -53,8 +56,16 @@ public EntityDimensions getDefaultDimensions(@NotNull Pose pose) {
5356
return getType().getDimensions();
5457
}
5558

59+
@NotNull
60+
@Override
61+
protected AbstractArrow getArrow(@NotNull ItemStack arrow, float velocity, @Nullable ItemStack weapon) {
62+
AbstractArrow projectile = super.getArrow(arrow, velocity, weapon);
63+
projectile.setBaseDamage(projectile.getBaseDamage() * MekanismAdditionsConfig.additions.babyArrowDamageMultiplier.get());
64+
return projectile;
65+
}
66+
5667
@Override
57-
protected void populateDefaultEquipmentSlots(RandomSource random, DifficultyInstance difficulty) {
68+
protected void populateDefaultEquipmentSlots(@NotNull RandomSource random, @NotNull DifficultyInstance difficulty) {
5869
super.populateDefaultEquipmentSlots(random, difficulty);
5970
for (EquipmentSlot slot : EquipmentSlot.values()) {
6071
if (slot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {

src/additions/java/mekanism/additions/common/entity/baby/EntityBabyWitherSkeleton.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public EntityDimensions getDefaultDimensions(@NotNull Pose pose) {
3333
}
3434

3535
@Override
36-
protected void populateDefaultEquipmentSlots(RandomSource random, DifficultyInstance difficulty) {
36+
protected void populateDefaultEquipmentSlots(@NotNull RandomSource random, @NotNull DifficultyInstance difficulty) {
3737
super.populateDefaultEquipmentSlots(random, difficulty);
3838
for (EquipmentSlot slot : EquipmentSlot.values()) {
3939
if (slot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {

0 commit comments

Comments
 (0)