diff --git a/src/main/java/pokecube/core/items/megastuff/WearablesCompat.java b/src/main/java/pokecube/core/items/megastuff/WearablesCompat.java index 4306bdd42f..a4169e7026 100644 --- a/src/main/java/pokecube/core/items/megastuff/WearablesCompat.java +++ b/src/main/java/pokecube/core/items/megastuff/WearablesCompat.java @@ -160,6 +160,7 @@ public void renderWearable(final MatrixStack mat, final IRenderTypeBuffer buff, this.strap = new ResourceLocation(PokecubeMod.ID, "textures/worn/megabelt_2.png"); this.watch = new ResourceLocation(PokecubeMod.ID, "textures/worn/watch.png"); } + if (!this.model.isLoaded() || !this.model.isValid()) return; float s, sy, sx, sz, dx, dy, dz; dx = 0.f; dy = .06f; @@ -221,10 +222,10 @@ public void renderWearable(final MatrixStack mat, final IRenderTypeBuffer buff, mat.scale(s, s, s); mat.rotate(net.minecraft.client.renderer.Vector3f.YP.rotationDegrees(90)); buf = ModelRing.makeBuilder(buff, ModelRing.texture_1); - ring.pass = 1; + this.ring.pass = 1; this.ring.render(mat, buf, brightness, overlay, 1, 1, 1, 1); buf = ModelRing.makeBuilder(buff, ModelRing.texture_2); - ring.pass = 2; + this.ring.pass = 2; this.ring.render(mat, buf, brightness, overlay, 1, 1, 1, 1); } }); @@ -251,6 +252,7 @@ public void renderWearable(final MatrixStack mat, final IRenderTypeBuffer buff, this.keystone = new ResourceLocation(PokecubeMod.ID, "textures/worn/keystone.png"); this.belt_2 = new ResourceLocation(PokecubeMod.ID, "textures/worn/megabelt_2.png"); } + if (!this.belt.isLoaded() || !this.belt.isValid()) return; float s, dx, dy, dz; dx = 0; dy = -.0f; @@ -298,6 +300,7 @@ public void renderWearable(final MatrixStack mat, final IRenderTypeBuffer buff, if (slot != EnumWearable.HAT) return; if (this.hat == null) this.hat = new X3dModel(new ResourceLocation(PokecubeMod.ID, "models/worn/hat.x3d")); + if (!this.hat.isLoaded() || !this.hat.isValid()) return; Hat.renderHat(mat, buff, wearer, stack, this.hat, this.TEX, brightness, overlay); } }); @@ -310,11 +313,8 @@ public static void init() final Set worn = thut.wearables.ThutWearables.getWearables(player).getWearables(); for (final ItemStack stack1 : worn) if (stack1 != null) if (MegaCapability.matches(stack1, toEvolve)) return true; - for (int i = 0; i < player.inventory.armorInventory.size(); i++) - { - final ItemStack stack2 = player.inventory.armorInventory.get(i); + for (final ItemStack stack2 : player.inventory.armorInventory) if (stack2 != null) if (MegaCapability.matches(stack2, toEvolve)) return true; - } return false; }; } diff --git a/src/main/java/thut/bling/client/render/Ankle.java b/src/main/java/thut/bling/client/render/Ankle.java index 95367dc96e..21e6c3fa29 100644 --- a/src/main/java/thut/bling/client/render/Ankle.java +++ b/src/main/java/thut/bling/client/render/Ankle.java @@ -15,6 +15,7 @@ public static void renderAnkle(final MatrixStack mat, final IRenderTypeBuffer bu final ItemStack stack, final IModel model, final ResourceLocation[] textures, final int brightness, final int overlay) { + if (!model.isLoaded() || !model.isValid()) return; float s, sy, sx, sz, dx, dy, dz; dx = 0.f; dy = .06f; diff --git a/src/main/java/thut/bling/client/render/Back.java b/src/main/java/thut/bling/client/render/Back.java index ff211065f7..e4881bf18c 100644 --- a/src/main/java/thut/bling/client/render/Back.java +++ b/src/main/java/thut/bling/client/render/Back.java @@ -22,6 +22,7 @@ public static void renderBack(final MatrixStack mat, final IRenderTypeBuffer buf final int overlay) { if (!(model instanceof IModelCustom)) return; + if (!model.isLoaded() || !model.isValid()) return; final IModelCustom renderable = (IModelCustom) model; DyeColor ret; diff --git a/src/main/java/thut/bling/client/render/Ear.java b/src/main/java/thut/bling/client/render/Ear.java index 628333b6ac..cc5f59e22f 100644 --- a/src/main/java/thut/bling/client/render/Ear.java +++ b/src/main/java/thut/bling/client/render/Ear.java @@ -16,6 +16,7 @@ public static void renderEar(final MatrixStack mat, final IRenderTypeBuffer buff final ItemStack stack, final IModel model, final ResourceLocation[] textures, final int brightness, final int overlay) { + if (!model.isLoaded() || !model.isValid()) return; float s, dx, dy, dz; dx = 0.0f; dy = .175f; diff --git a/src/main/java/thut/bling/client/render/Eye.java b/src/main/java/thut/bling/client/render/Eye.java index a5373c258e..b5ea8864e5 100644 --- a/src/main/java/thut/bling/client/render/Eye.java +++ b/src/main/java/thut/bling/client/render/Eye.java @@ -33,6 +33,7 @@ public static void renderEye(final MatrixStack mat, final IRenderTypeBuffer buff final ItemStack stack, final IModel model, final ResourceLocation[] textures, final int brightness, final int overlay) { + if (!model.isLoaded() || !model.isValid()) return; // TODO eye by model instead of texture. mat.push(); mat.translate(-0.26, -0.175, -0.251); diff --git a/src/main/java/thut/bling/client/render/Finger.java b/src/main/java/thut/bling/client/render/Finger.java index ecc2b7e6e0..ec847cf85c 100644 --- a/src/main/java/thut/bling/client/render/Finger.java +++ b/src/main/java/thut/bling/client/render/Finger.java @@ -16,6 +16,7 @@ public static void renderFinger(final MatrixStack mat, final IRenderTypeBuffer b final ItemStack stack, final IModel model, final ResourceLocation[] textures, final int brightness, final int overlay) { + if (!model.isLoaded() || !model.isValid()) return; float s, dx, dy, dz; dx = 0.0f; dy = .175f; diff --git a/src/main/java/thut/bling/client/render/Hat.java b/src/main/java/thut/bling/client/render/Hat.java index 79f485ccf3..255942522b 100644 --- a/src/main/java/thut/bling/client/render/Hat.java +++ b/src/main/java/thut/bling/client/render/Hat.java @@ -26,6 +26,7 @@ public static void renderHat(final MatrixStack mat, final IRenderTypeBuffer buff { if (!(model instanceof IModelCustom)) return; final IModelCustom renderable = (IModelCustom) model; + if (!model.isLoaded() || !model.isValid()) return; DyeColor ret; Color colour; diff --git a/src/main/java/thut/bling/client/render/Neck.java b/src/main/java/thut/bling/client/render/Neck.java index 6d56cf741b..21f660e388 100644 --- a/src/main/java/thut/bling/client/render/Neck.java +++ b/src/main/java/thut/bling/client/render/Neck.java @@ -23,6 +23,7 @@ public static void renderNeck(final MatrixStack mat, final IRenderTypeBuffer buf final int overlay) { if (!(model instanceof IModelCustom)) return; + if (!model.isLoaded() || !model.isValid()) return; final ResourceLocation[] tex = textures.clone(); final IModelCustom renderable = (IModelCustom) model; DyeColor ret; diff --git a/src/main/java/thut/bling/client/render/Waist.java b/src/main/java/thut/bling/client/render/Waist.java index e6c96ca21b..e1abb8d2dc 100644 --- a/src/main/java/thut/bling/client/render/Waist.java +++ b/src/main/java/thut/bling/client/render/Waist.java @@ -16,6 +16,7 @@ public static void renderWaist(final MatrixStack mat, final IRenderTypeBuffer bu final ItemStack stack, final IModel model, final ResourceLocation[] textures, final int brightness, final int overlay) { + if (!model.isLoaded() || !model.isValid()) return; float s, dx, dy, dz; dx = 0; dy = -.0f; diff --git a/src/main/java/thut/bling/client/render/Wrist.java b/src/main/java/thut/bling/client/render/Wrist.java index aad4e218bb..6a672fabcf 100644 --- a/src/main/java/thut/bling/client/render/Wrist.java +++ b/src/main/java/thut/bling/client/render/Wrist.java @@ -15,6 +15,7 @@ public static void renderWrist(final MatrixStack mat, final IRenderTypeBuffer bu final ItemStack stack, final IModel model, final ResourceLocation[] textures, final int brightness, final int overlay) { + if (!model.isLoaded() || !model.isValid()) return; float s, sy, sx, sz, dx, dy, dz; dx = 0.f; dy = .06f;