Update energy api

This commit is contained in:
modmuss50 2019-09-16 23:11:56 +01:00
parent 7e05b0da12
commit a4a578917d
6 changed files with 21 additions and 11 deletions

View file

@ -63,11 +63,13 @@ public class ItemCloakingDevice extends ItemTRArmour implements EnergyHolder {
PlayerEntity player = (PlayerEntity) entityIn;
if (Energy.valid(stack)) {
Energy.of(stack).use(usage, () -> player.setInvisible(true), () -> {
if(Energy.of(stack).use(usage)){
player.setInvisible(true);
} else {
if (!player.hasStatusEffect(StatusEffects.INVISIBILITY)) {
player.setInvisible(false);
}
});
}
}
}
}