File tree Expand file tree Collapse file tree 4 files changed +36
-3
lines changed
java/multiteam/multicore_lib/setup/utilities Expand file tree Collapse file tree 4 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 66MultiCoreLib is a library mod for several tools and utils, used by most multiteam mods.
77
88## Credits
9- - LazTheArtist [ TeleportTool - HoverTextItemTool ]
9+ - LazTheArtist [ HoverTextItemTool - ItemGroupTool - ItemManagementTool - MathF - RegistrationTool - TeleportTool ]
1010- Qboi [ Maven Setup]
1111
1212## Community
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ apply plugin: 'eclipse'
1515apply plugin : ' maven'
1616apply plugin : ' maven-publish'
1717
18- version = ' 1.16.5-0.0.1.5 '
18+ version = ' 1.16.5-0.0.1.7 '
1919group = ' multiteam.multicorelib' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
2020archivesBaseName = ' multicore_lib'
2121
Original file line number Diff line number Diff line change 1+ package multiteam .multicore_lib .setup .utilities ;
2+
3+ import net .minecraft .entity .player .PlayerInventory ;
4+ import net .minecraft .item .Item ;
5+ import net .minecraft .item .ItemStack ;
6+
7+ public class ItemManagementTool {
8+
9+ //Returns the count of a specific item in an inventory/container.
10+ //Note that if theres multiple stacks of items, it will count them all, so the return might result in bigger amounts than 64.
11+ public int getCountOfItemInInventory (PlayerInventory inv , Item itemToCount ){
12+ int count = 0 ;
13+ for (int i = 0 ; i < inv .getContainerSize (); i ++){
14+ ItemStack currentStack = inv .getItem (i );
15+ if (currentStack .getItem () == itemToCount ){
16+ count +=currentStack .getCount ();
17+ }
18+ }
19+ return count ;
20+ }
21+
22+ //does the exact same thing except it static because idk java lol
23+ public static int getCountOfItemInInventory_ (PlayerInventory inv , Item itemToCount ){
24+ int count = 0 ;
25+ for (int i = 0 ; i < inv .getContainerSize (); i ++){
26+ ItemStack currentStack = inv .getItem (i );
27+ if (currentStack .getItem () == itemToCount ){
28+ count +=currentStack .getCount ();
29+ }
30+ }
31+ return count ;
32+ }
33+ }
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ authors="LazTheArtist" #optional
3636description ='''
3737This mod is a Library, for tools and helpers, to make coding mods faster and easier.
3838
39- LazTheArtist [HoverTextItemTool - TeleportTool - ItemGroupTool - MathF]
39+ LazTheArtist [HoverTextItemTool - ItemGroupTool - ItemManagementTool - MathF - RegistrationTool - TeleportTool ]
4040Qboi [Maven Setup]
4141'''
4242# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
You can’t perform that action at this time.
0 commit comments