diff options
| author | BuildTools <james.jenour@protonmail.com> | 2021-06-04 01:18:28 +0800 |
|---|---|---|
| committer | BuildTools <james.jenour@protonmail.com> | 2021-06-04 01:18:28 +0800 |
| commit | a1fa5a67caebf754a0fcc43168672823ede0db93 (patch) | |
| tree | c0d7d78dfffaa659835a59952cac6edd2592be87 /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CollectionLogManager.java | |
| parent | 1b172089ce502803f7644611afd618ce00dcb860 (diff) | |
| download | notenoughupdates-a1fa5a67caebf754a0fcc43168672823ede0db93.tar.gz notenoughupdates-a1fa5a67caebf754a0fcc43168672823ede0db93.tar.bz2 notenoughupdates-a1fa5a67caebf754a0fcc43168672823ede0db93.zip | |
merge is pain
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CollectionLogManager.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CollectionLogManager.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CollectionLogManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CollectionLogManager.java new file mode 100644 index 00000000..00809d87 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CollectionLogManager.java @@ -0,0 +1,46 @@ +package io.github.moulberry.notenoughupdates.miscfeatures; + +import io.github.moulberry.notenoughupdates.collectionlog.CollectionConstant; +import io.github.moulberry.notenoughupdates.util.Constants; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; + +import java.util.regex.Matcher; + +public class CollectionLogManager { + + private static CollectionLogManager INSTANCE = new CollectionLogManager(); + + public static CollectionLogManager getInstance() { + return INSTANCE; + } + + public void onEntityMetadataUpdated(int entityId) { + System.out.println("entity created:"+entityId); + WorldClient world = Minecraft.getMinecraft().theWorld; + if(world != null) { + Entity entity = world.getEntityByID(entityId); + + if(entity instanceof EntityArmorStand && entity.hasCustomName()) { + String customName = entity.getName(); + System.out.println("got name:"+customName); + for(CollectionConstant.DropEntry entry : Constants.COLLECTIONLOG.dropdata) { + System.out.println("iter entry"); + if(entry.type.equalsIgnoreCase("itemdrop")) { + Matcher matcher = entry.regex.matcher(customName); + if(matcher.matches()) { + System.out.println("Match found!"); + System.out.println("Count: "+matcher.group("count")); + System.out.println("Name: "+matcher.group("itemname")); + } else { + System.out.println("Doesn't match: " + customName); + } + } + } + } + } + } + +} |
