Created
May 2, 2015 15:47
-
-
Save ryantheleach/9cba877e77cd39505cdd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public Optional<HungerOverrideData> fill(DataHolder dataHolder, DataPriority overlap) { | |
HungerOverrideData man = new HungerOverrideData(this); | |
HungerOverrideData hold = dataHolder.getData(HungerOverrideData.class).orNull(); | |
HungerOverrideData out = null; | |
switch (overlap){ | |
case DATA_HOLDER: | |
out = hold; | |
break; | |
case DATA_MANIPULATOR: | |
out = man; | |
//fallthrough | |
case PRE_MERGE: | |
out = man; | |
if(dataHolder.getData(HungerOverrideData.class).isPresent()){ | |
out.amount =+ hold.amount; | |
} | |
break; | |
case POST_MERGE: | |
out = hold; | |
out.amount =+ man.amount; | |
break; | |
} | |
return Optional.of(out); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment