Update energy api
This commit is contained in:
parent
7e05b0da12
commit
a4a578917d
6 changed files with 21 additions and 11 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue