Fix two Greenhouse Crashes

This commit is contained in:
Nedelosk committed 2017-09-18 15:08:58 +02:00
1 parent a74b3c87c4
commit aa52b063b7
2 files changed
+7 -5

No files matched your search

@@ -43,7 +43,7 @@ public interface IClimateSource extends INbtWritable, INbtReadable {
IClimateState work(IClimateState previousState, IClimateState targetState, IClimateState currentState, final double sizeModifier, final boolean canWork);
/**
* @return true if source has changed the climate at the last work cicle.
* @return true if source has changed the climate at the last work circle.
*/
boolean isActive();
@@ -157,13 +157,15 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
} else if (ClimateStates.isNearTarget(currentState, targetState)) {
return change;
}
//If the state is not already zero, remove one change state from the state.
change = getChange(oppositeType, defaultState, currentState);
change = ClimateStates.INSTANCE.create(-change.getTemperature(), -change.getHumidity(), ClimateStateType.EXTENDED);
if(oppositeType != null) {
//If the state is not already zero, remove one change state from the state.
change = getChange(oppositeType, defaultState, currentState);
change = ClimateStates.INSTANCE.create(-change.getTemperature(), -change.getHumidity(), ClimateStateType.EXTENDED);
}
} else if (validType == null && oppositeType != null) {
//Remove the resources if the owner has enough resources and the state is not the default state.
removeResources(state, oppositeType);
} else {
} else if(validType != null){
change = getChange(validType, targetState, previousState);
IClimateState changedState = state.add(change.scale(1 / sizeModifier));
boolean couldWork = canWork(changedState, oppositeType);