-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
705e80d
commit 09038ad
Showing
5 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/net/guavy/gravestones/compat/TrinketsCompat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package net.guavy.gravestones.compat; | ||
|
||
import dev.emi.trinkets.api.TrinketsApi; | ||
import net.guavy.gravestones.api.GravestonesApi; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.inventory.Inventory; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class TrinketsCompat implements GravestonesApi { | ||
@Override | ||
public List<ItemStack> getInventory(PlayerEntity entity) { | ||
Inventory inventory = TrinketsApi.getTrinketsInventory(entity); | ||
List<ItemStack> itemStacks = new ArrayList<>(); | ||
|
||
for(int i = 0; i < inventory.size(); i++) { | ||
itemStacks.add(inventory.getStack(i)); | ||
} | ||
|
||
return itemStacks; | ||
} | ||
|
||
@Override | ||
public List<ItemStack> setInventory(List<ItemStack> inventory, PlayerEntity entity) { | ||
for(ItemStack itemStack : inventory) { | ||
TrinketsApi.getTrinketComponent(entity).equip(itemStack); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public int getInventorySize(PlayerEntity entity) { | ||
return TrinketsApi.getTrinketsInventory(entity).size(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters