Apotheosis

Apotheosis

79M Downloads

[1.20.1] Apotheosis | Apotheosis performance issue

Crankonator opened this issue ยท 2 comments

commented

Hello, we are experiencing some performance issues with Apotheosis.
We believe the issue to be on your end and believe it would be worth looking into.

I have attached a spark log to show what's going on.
https://spark.lucko.me/9fFxCNWMGy

commented

@Shadows-of-Fire

a lot of it is from the shield breaker test
the checks seem to be for the equipment sound
might be best to call handItems.set(EquipmentSlot.OFFHAND.getIndex(), shield) instead

   public void setItemSlot(EquipmentSlot pSlot, ItemStack pStack) {
      this.verifyEquippedItem(pStack);
      switch (pSlot.getType()) {
         case HAND:
            this.onEquipItem(pSlot, this.handItems.set(pSlot.getIndex(), pStack), pStack);
            break;
         case ARMOR:
            this.onEquipItem(pSlot, this.armorItems.set(pSlot.getIndex(), pStack), pStack);
      }

   }
   public void onEquipItem(EquipmentSlot p_238393_, ItemStack p_238394_, ItemStack p_238395_) {
      boolean flag = p_238395_.isEmpty() && p_238394_.isEmpty();
      if (!flag && !ItemStack.isSameIgnoreDurability(p_238394_, p_238395_) && !this.firstTick) {
         if (p_238393_.getType() == EquipmentSlot.Type.ARMOR) {
            this.playEquipSound(p_238395_);
         }

         if (this.doesEmitEquipEvent(p_238393_)) {
            this.gameEvent(GameEvent.EQUIP);
         }

      }
   }
commented

I think it will be sufficient to just set it once at the initial instantiation of the zombie. Hopefully it doesn't get lost.

Stupid forge capability system strikes again with expensive comparison operations (in vanilla this code path would be trivial).