Skip to content

Commit

Permalink
avoid ticking empty item states, closes #50
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIllusiveC4 committed May 31, 2020
1 parent 6d904e2 commit 47ba6c7
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,19 @@ public void onCurioTick(LivingEvent.LivingUpdateEvent evt) {

for (int i = 0; i < stackHandler.getSlots(); i++) {
ItemStack stack = stackHandler.getStackInSlot(i);
stack.inventoryTick(entitylivingbase.world, entitylivingbase, -1, false);
LazyOptional<ICurio> currentCurio = CuriosAPI.getCurio(stack);
final int index = i;
currentCurio.ifPresent(curio -> {
curio.onCurioTick(identifier, index, entitylivingbase);

if (entitylivingbase.world.isRemote) {
curio.onCurioAnimate(identifier, index, entitylivingbase);
}
});
if (!stack.isEmpty()) {
stack.inventoryTick(entitylivingbase.world, entitylivingbase, -1, false);
currentCurio.ifPresent(curio -> {
curio.onCurioTick(identifier, index, entitylivingbase);

if (entitylivingbase.world.isRemote) {
curio.onCurioAnimate(identifier, index, entitylivingbase);
}
});
}

if (!entitylivingbase.world.isRemote) {
ItemStack prevStack = stackHandler.getPreviousStackInSlot(i);
Expand Down

0 comments on commit 47ba6c7

Please sign in to comment.