Compare commits

..
2 Commits
Author SHA1 Message Date
Zereff06 834d7b9d4a add setting to config-> disable butterflies spawn
+ default disable is false
2023-03-09 11:34:07 +02:00
Zereff06 3d55aa887f bs 2023-03-09 00:14:54 +02:00
8 changed files with 12 additions and 37 deletions

No files matched your search

@@ -43,10 +43,6 @@ public class DefaultBeeModifier implements IBeeModifier {
return false;
}
public boolean isSelfUnlighted() {
return false;
}
public boolean isSunlightSimulated() {
return false;
}
@@ -54,17 +54,10 @@ public interface IBeeModifier {
boolean isSealed();
/**
* @return Boolean indicating if housing can ignore darkness/night. Cannot be used together with SelfUnlighted
* @return Boolean indicating if housing can ignore darkness/night
*/
boolean isSelfLighted();
/**
* @return Boolean indicating if housing can ignore lightness/day. Cannot be used together with SelfLighted
*/
default boolean isSelfUnlighted() {
return false;
}
/**
* @return Boolean indicating if housing can ignore not seeing the sky
*/
@@ -94,16 +94,6 @@ public class BeeHousingModifier implements IBeeModifier {
return false;
}
@Override
public boolean isSelfUnlighted() {
for (IBeeModifier modifier : beeHousing.getBeeModifiers()) {
if (modifier.isSelfUnlighted()) {
return true;
}
}
return false;
}
@Override
public boolean isSunlightSimulated() {
for (IBeeModifier modifier : beeHousing.getBeeModifiers()) {
@@ -248,7 +248,7 @@ public class Bee extends IndividualLiving implements IBee {
// / Night or darkness requires nocturnal species
if (world.isDaytime()) {
if (!canWorkDuringDay(beeModifier)) {
if (!canWorkDuringDay()) {
errorStates.add(EnumErrorCode.NOT_NIGHT);
}
} else {
@@ -258,7 +258,7 @@ public class Bee extends IndividualLiving implements IBee {
}
if (housing.getBlockLightValue() > Constants.APIARY_MIN_LEVEL_LIGHT) {
if (!canWorkDuringDay(beeModifier)) {
if (!canWorkDuringDay()) {
errorStates.add(EnumErrorCode.NOT_GLOOMY);
}
} else {
@@ -308,16 +308,12 @@ public class Bee extends IndividualLiving implements IBee {
return errorStates;
}
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
private boolean canWorkAtNight(IBeeModifier beeModifier) {
return (genome.getPrimary().isNocturnal() || genome.getNocturnal() || beeModifier.isSelfLighted())
&& !(beeModifier.isSelfUnlighted() && beeModifier.isSelfLighted());
return genome.getPrimary().isNocturnal() || genome.getNocturnal() || beeModifier.isSelfLighted();
}
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
private boolean canWorkDuringDay(IBeeModifier beeModifier) {
return (!genome.getPrimary().isNocturnal() || genome.getNocturnal() || beeModifier.isSelfUnlighted())
&& !(beeModifier.isSelfUnlighted() && beeModifier.isSelfLighted());
private boolean canWorkDuringDay() {
return !genome.getPrimary().isNocturnal() || genome.getNocturnal();
}
private boolean canWorkUnderground(IBeeModifier beeModifier) {
@@ -31,7 +31,7 @@ import forestry.mail.gui.GuiMailboxInfo;
public class Config {
public static boolean disableButterfly;
public static Boolean DISABLE_BUTTERFLY;
public static final String CATEGORY_COMMON = "common";
public static final String CATEGORY_FLUIDS = "fluids";
@@ -147,7 +147,7 @@ public class Config {
configCommon = new LocalizedConfiguration(configFileCommon, "1.2.0");
disableButterfly = configCommon.getBooleanLocalized("mobs", "disable.butterfly", false);
DISABLE_BUTTERFLY = configCommon.getBooleanLocalized("mobs", "disable.butterfly", false);
gameMode = configCommon
.getStringLocalized("difficulty", "game.mode", "EASY", new String[] { "OP, EASY, NORMAL, HARD" });
@@ -23,7 +23,7 @@ public class ButterflySpawner implements ILeafTickHandler {
@Override
public boolean onRandomLeafTick(ITree tree, World world, int x, int y, int z, boolean isDestroyed) {
if (Config.disableButterfly) {
if (Config.DISABLE_BUTTERFLY) {
return false;
}
@@ -370,7 +370,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
@Override
protected boolean canDespawn() {
if (Config.disableButterfly) {
if (Config.DISABLE_BUTTERFLY) {
this.setDead();
}
return ticksExisted > MAX_LIFESPAN;
@@ -92,7 +92,7 @@ public class ItemButterflyGE extends ItemGE {
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) {
super.addInformation(itemstack, player, list, flag);
if (Config.disableButterfly && type == EnumFlutterType.BUTTERFLY) list.add(ChatFormatting.RED + "Disabled");
if (Config.DISABLE_BUTTERFLY && type == EnumFlutterType.BUTTERFLY) list.add(ChatFormatting.RED + "Disabled");
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -115,7 +115,7 @@ public class ItemButterflyGE extends ItemGE {
@Override
public boolean onEntityItemUpdate(EntityItem entityItem) {
if (type != EnumFlutterType.BUTTERFLY || Config.disableButterfly) {
if (type != EnumFlutterType.BUTTERFLY || Config.DISABLE_BUTTERFLY) {
return false;
}
if (entityItem.worldObj.isRemote || entityItem.ticksExisted < 80) {