From 81b47c15faa093a02732803e56266f79210a9588 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Tue, 2 Jan 2024 20:55:49 -0500 Subject: [PATCH] fix null checking :wacko: --- .../automation/block/be/FeedingTroughBlockEntity.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/violetmoon/quark/content/automation/block/be/FeedingTroughBlockEntity.java b/src/main/java/org/violetmoon/quark/content/automation/block/be/FeedingTroughBlockEntity.java index 93427df89a..670516c3f0 100644 --- a/src/main/java/org/violetmoon/quark/content/automation/block/be/FeedingTroughBlockEntity.java +++ b/src/main/java/org/violetmoon/quark/content/automation/block/be/FeedingTroughBlockEntity.java @@ -82,11 +82,9 @@ public FeedResult tryFeedingAnimal(Animal animal) { ItemStack stack = this.getItem(i); if(animal.isFood(stack)) { SoundEvent soundEvent = animal.getEatingSound(stack); - // Try and catch this in case soundEvent is null somewhere (Its cleaner then null checking soundEvent - // after warping it) - try { + if (soundEvent != null) { // Null check is kinda required, don't remove :) animal.playSound(soundEvent, 0.5F + 0.5F * level.random.nextInt(2), (level.random.nextFloat() - level.random.nextFloat()) * 0.2F + 1.0F); - } catch (NullPointerException ignored) {} + } this.addItemParticles(animal, stack, 16);