From e82f2eb4c992460f7b5cd68ccdd6ea5b8f318e61 Mon Sep 17 00:00:00 2001 From: miozune Date: Thu, 4 Aug 2022 10:07:59 +0900 Subject: [PATCH] Add null check (#50) --- .../java/tconstruct/library/weaponry/BowBaseAmmo.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/tconstruct/library/weaponry/BowBaseAmmo.java b/src/main/java/tconstruct/library/weaponry/BowBaseAmmo.java index ae05ef3b..f9c2b2ea 100644 --- a/src/main/java/tconstruct/library/weaponry/BowBaseAmmo.java +++ b/src/main/java/tconstruct/library/weaponry/BowBaseAmmo.java @@ -1,8 +1,8 @@ package tconstruct.library.weaponry; import tconstruct.library.TConstructRegistry; -import tconstruct.library.tools.BowMaterial; import tconstruct.library.tools.BowstringMaterial; +import tconstruct.library.tools.CustomMaterial; import tconstruct.weaponry.ammo.ArrowAmmo; import tconstruct.weaponry.entity.ArrowEntity; import net.minecraft.enchantment.Enchantment; @@ -175,8 +175,12 @@ public abstract class BowBaseAmmo extends ProjectileWeapon { @Override protected int getDefaultColor(int renderPass, int materialID) { // bowstring uses custom material - if(renderPass == 0) - return TConstructRegistry.getCustomMaterial(materialID, BowstringMaterial.class).color; + if (renderPass == 0) { + CustomMaterial material = TConstructRegistry.getCustomMaterial(materialID, BowstringMaterial.class); + if (material != null) { + return material.color; + } + } return super.getDefaultColor(renderPass, materialID); }