Skip to content

Commit

Permalink
fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-1F committed Jan 23, 2021
1 parent 663da8b commit 3f8fcf9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.10.8

# Mod Properties
mod_version = 1.3.0
mod_version = 1.3.1
maven_group = villagerhelper
archives_base_name = villagerhelper

Expand Down
12 changes: 10 additions & 2 deletions src/main/java/me/ivan/villagerhelper/VillagerHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class VillagerHelper {
private static BlockPos home;
private static BlockPos jobSite;

private static ListTag listTag;
private static ListTag listTag = null;

public static VillagerHelper getInstance() {
return INSTANCE;
Expand All @@ -50,12 +50,20 @@ public void renderVillagerInfo(float tickDelta) {

if (!tagQueue.isEmpty()) listTag = tagQueue.poll().getList("data", 10);

if (listTag == null) return;
if (mc.player == null) return;

Iterator tagIterator = listTag.iterator();
int tagPos = 0;
while (tagIterator.hasNext()) {
CompoundTag tag = listTag.getCompound(tagPos);
DimensionType dimension = DimensionType.byRawId(tag.getInt("Dimension"));
if (mc.player.dimension != dimension) continue;
DimensionType playerDimension = mc.player.dimension;
if (!dimension.equals(playerDimension)) {
tagIterator.next();
tagPos ++;
continue;
}
// Get villager data
enchantmentBookTrade = CompoundTagParser.getFirstEnchantmentBookTrade(tag);
villagerPos = CompoundTagParser.getPos(tag);
Expand Down

0 comments on commit 3f8fcf9

Please sign in to comment.