Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Commit

Permalink
fix trinket problems
Browse files Browse the repository at this point in the history
  • Loading branch information
gbl committed Sep 26, 2023
1 parent 7873c99 commit 6292ff3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ dependencies {
modImplementation "de.guntram.mcmod:GBfabrictools:${Versions['gbfabrictools_version']}"
include "de.guntram.mcmod:GBfabrictools:${Versions['gbfabrictools_version']}"

modImplementation "dev.emi:trinkets:3.0.0"
modImplementation "dev.emi:trinkets:3.7.0"
// these two are only needed due to a bug in the trinkets build.gradle, remove them later -- 20230629
modImplementation include("dev.onyxstudios.cardinal-components-api:cardinal-components-base:5.2.0")
modImplementation include("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:5.2.0")
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ public GuiItemDurability() {
try {
Class.forName("dev.emi.trinkets.api.TrinketsApi");
LOGGER.info("Using trinkets in DurabilityViewer");
haveTrinketsApi = true;
trinketWarners = new ItemBreakingWarner[getTrinketSlotCount(minecraft.player)];
int slotCount = getTrinketSlotCount(minecraft.player);
haveTrinketsApi = (slotCount > 0);
trinketWarners = new ItemBreakingWarner[slotCount];
for (int i=0; i<trinketWarners.length; i++) {
trinketWarners[i]=new ItemBreakingWarner();
}
Expand Down Expand Up @@ -393,16 +394,14 @@ public int getTrinketSlotCount(LivingEntity player) {
if (component.isEmpty()) {
return 0;
}
// return component.get().getEquipped(prdct -> true).size();
return 0;
return component.get().getEquipped(prdct -> true).size();
}

public List<ItemStack> getTrinkets(LivingEntity player) {
Optional<TrinketComponent> component = TrinketsApi.getTrinketComponent(player);
if (component.isEmpty()) {
return null;
}
// return component.get().getEquipped(prdct -> true).stream().map(pair -> pair.getRight()).toList();
return null;
return component.get().getEquipped(prdct -> true).stream().map(pair -> pair.getRight()).toList();
}
}

0 comments on commit 6292ff3

Please sign in to comment.