Skip to content

Commit 710babe

Browse files
0.0.1.7
1 parent 4d6b7ae commit 710babe

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
MultiCoreLib 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

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ apply plugin: 'eclipse'
1515
apply plugin: 'maven'
1616
apply plugin: 'maven-publish'
1717

18-
version = '1.16.5-0.0.1.5'
18+
version = '1.16.5-0.0.1.7'
1919
group = 'multiteam.multicorelib' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
2020
archivesBaseName = 'multicore_lib'
2121

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
}

src/main/resources/META-INF/mods.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ authors="LazTheArtist" #optional
3636
description='''
3737
This 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]
4040
Qboi [Maven Setup]
4141
'''
4242
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.

0 commit comments

Comments
 (0)