From 763523d1c04c4ed94f81f8f2242076a61425711b Mon Sep 17 00:00:00 2001 From: Magnus Jensen Date: Fri, 14 Oct 2022 18:18:43 +0200 Subject: [PATCH] [1.18.x] Fix NPE when feeding cats and wolves (#9075) --- .../net/minecraft/world/entity/animal/Cat.java.patch | 5 +++-- .../net/minecraft/world/entity/animal/Wolf.java.patch | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch index 88dde64765..69bdb53c13 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch @@ -1,11 +1,12 @@ --- a/net/minecraft/world/entity/animal/Cat.java +++ b/net/minecraft/world/entity/animal/Cat.java -@@ -400,7 +_,7 @@ +@@ -399,8 +_,8 @@ + if (this.m_21830_(p_28153_)) { if (!(item instanceof DyeItem)) { if (item.m_41472_() && this.m_6898_(itemstack) && this.m_21223_() < this.m_21233_()) { ++ this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_()); this.m_142075_(p_28153_, p_28154_, itemstack); - this.m_5634_((float)item.m_41473_().m_38744_()); -+ this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_()); return InteractionResult.CONSUME; } diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch index 4fcf6575db..c5279ae546 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch @@ -1,11 +1,15 @@ --- a/net/minecraft/world/entity/animal/Wolf.java +++ b/net/minecraft/world/entity/animal/Wolf.java -@@ -329,7 +_,7 @@ +@@ -325,11 +_,11 @@ + } else { + if (this.m_21824_()) { + if (this.m_6898_(itemstack) && this.m_21223_() < this.m_21233_()) { ++ this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_()); + if (!p_30412_.m_150110_().f_35937_) { itemstack.m_41774_(1); } - this.m_5634_((float)item.m_41473_().m_38744_()); -+ this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_()); this.m_146859_(GameEvent.f_157771_, this.m_146901_()); return InteractionResult.SUCCESS; }