mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d96669f5f7 |
No files matched your search
@@ -43,6 +43,10 @@ public class DefaultBeeModifier implements IBeeModifier {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSelfUnlighted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSunlightSimulated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -54,10 +54,17 @@ public interface IBeeModifier {
|
||||
boolean isSealed();
|
||||
|
||||
/**
|
||||
* @return Boolean indicating if housing can ignore darkness/night
|
||||
* @return Boolean indicating if housing can ignore darkness/night. Cannot be used together with SelfUnlighted
|
||||
*/
|
||||
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,6 +94,16 @@ 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()) {
|
||||
if (!canWorkDuringDay(beeModifier)) {
|
||||
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()) {
|
||||
if (!canWorkDuringDay(beeModifier)) {
|
||||
errorStates.add(EnumErrorCode.NOT_GLOOMY);
|
||||
}
|
||||
} else {
|
||||
@@ -308,12 +308,16 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return errorStates;
|
||||
}
|
||||
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
private boolean canWorkAtNight(IBeeModifier beeModifier) {
|
||||
return genome.getPrimary().isNocturnal() || genome.getNocturnal() || beeModifier.isSelfLighted();
|
||||
return (genome.getPrimary().isNocturnal() || genome.getNocturnal() || beeModifier.isSelfLighted())
|
||||
&& !(beeModifier.isSelfUnlighted() && beeModifier.isSelfLighted());
|
||||
}
|
||||
|
||||
private boolean canWorkDuringDay() {
|
||||
return !genome.getPrimary().isNocturnal() || genome.getNocturnal();
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
private boolean canWorkDuringDay(IBeeModifier beeModifier) {
|
||||
return (!genome.getPrimary().isNocturnal() || genome.getNocturnal() || beeModifier.isSelfUnlighted())
|
||||
&& !(beeModifier.isSelfUnlighted() && beeModifier.isSelfLighted());
|
||||
}
|
||||
|
||||
private boolean canWorkUnderground(IBeeModifier beeModifier) {
|
||||
|
||||
Reference in new issue
Block a user