Skip to content

Commit

Permalink
Fixed (possible) NullPointerException
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreSchwang committed Apr 20, 2021
1 parent 77edc66 commit 337c699
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void onEnable() {
}
this.blocksFile = new File(dataDirectory, "blockIDs.json");
this.updater = new BlockIdUpdater();
setItemRegistry(new ItemRegistry());
if (!blocksFile.exists()) {
updater.update(aBoolean -> {
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ private void injectTooltip(PlayerEntity playerIn, ITooltipFlag flag, CallbackInf
// Loop through all generated tooltips
for (int i = 0; i < data.size(); i++) {
ITextComponent component = data.get(i);
if(component == null) {
continue;
}
// If the raw line equals the minecraft key, append the ID to this line
if (component.getString().equals(Registry.ITEM.getKey(itemStack.getItem()).toString())) {
// Get the numeric id of the current item, check if an ID exists in the file, otherwise don't do anything
Expand Down

0 comments on commit 337c699

Please sign in to comment.