From e96abb3c41a3ba54fe169744d562931043a4d62d Mon Sep 17 00:00:00 2001 From: Defeatomizer Date: Sun, 25 Feb 2024 20:29:46 +0300 Subject: [PATCH] Fix world dependency misuse by flight attack AI task conditions (#4651) --- .../generator-1.19.4/forge-1.19.4/aitasks/attack_fly.java.ftl | 2 ++ .../generator-1.20.1/forge-1.20.1/aitasks/attack_fly.java.ftl | 2 ++ .../ref-forge-1.20.1/aitasks/attack_fly.java.ftl | 2 ++ 3 files changed, 6 insertions(+) diff --git a/plugins/generator-1.19.4/forge-1.19.4/aitasks/attack_fly.java.ftl b/plugins/generator-1.19.4/forge-1.19.4/aitasks/attack_fly.java.ftl index 664db27da43..4199f2337af 100644 --- a/plugins/generator-1.19.4/forge-1.19.4/aitasks/attack_fly.java.ftl +++ b/plugins/generator-1.19.4/forge-1.19.4/aitasks/attack_fly.java.ftl @@ -17,6 +17,7 @@ this.goalSelector.addGoal(${cbi+1}, new Goal() { double y = ${name}Entity.this.getY(); double z = ${name}Entity.this.getZ(); Entity entity = ${name}Entity.this; + Level world = ${name}Entity.this.level(); return <#if hasProcedure(conditions[0])><@procedureOBJToConditionCode conditions[0]/><#else>true; } else { @@ -30,6 +31,7 @@ this.goalSelector.addGoal(${cbi+1}, new Goal() { double y = ${name}Entity.this.getY(); double z = ${name}Entity.this.getZ(); Entity entity = ${name}Entity.this; + Level world = ${name}Entity.this.level(); return <#if hasProcedure(conditions[1])><@procedureOBJToConditionCode conditions[1]/> && ${name}Entity.this.getMoveControl().hasWanted() && ${name}Entity.this.getTarget() != null && ${name}Entity.this.getTarget().isAlive(); diff --git a/plugins/generator-1.20.1/forge-1.20.1/aitasks/attack_fly.java.ftl b/plugins/generator-1.20.1/forge-1.20.1/aitasks/attack_fly.java.ftl index 664db27da43..4199f2337af 100644 --- a/plugins/generator-1.20.1/forge-1.20.1/aitasks/attack_fly.java.ftl +++ b/plugins/generator-1.20.1/forge-1.20.1/aitasks/attack_fly.java.ftl @@ -17,6 +17,7 @@ this.goalSelector.addGoal(${cbi+1}, new Goal() { double y = ${name}Entity.this.getY(); double z = ${name}Entity.this.getZ(); Entity entity = ${name}Entity.this; + Level world = ${name}Entity.this.level(); return <#if hasProcedure(conditions[0])><@procedureOBJToConditionCode conditions[0]/><#else>true; } else { @@ -30,6 +31,7 @@ this.goalSelector.addGoal(${cbi+1}, new Goal() { double y = ${name}Entity.this.getY(); double z = ${name}Entity.this.getZ(); Entity entity = ${name}Entity.this; + Level world = ${name}Entity.this.level(); return <#if hasProcedure(conditions[1])><@procedureOBJToConditionCode conditions[1]/> && ${name}Entity.this.getMoveControl().hasWanted() && ${name}Entity.this.getTarget() != null && ${name}Entity.this.getTarget().isAlive(); diff --git a/plugins/generator-reference-1.20.1/ref-forge-1.20.1/aitasks/attack_fly.java.ftl b/plugins/generator-reference-1.20.1/ref-forge-1.20.1/aitasks/attack_fly.java.ftl index 664db27da43..4199f2337af 100644 --- a/plugins/generator-reference-1.20.1/ref-forge-1.20.1/aitasks/attack_fly.java.ftl +++ b/plugins/generator-reference-1.20.1/ref-forge-1.20.1/aitasks/attack_fly.java.ftl @@ -17,6 +17,7 @@ this.goalSelector.addGoal(${cbi+1}, new Goal() { double y = ${name}Entity.this.getY(); double z = ${name}Entity.this.getZ(); Entity entity = ${name}Entity.this; + Level world = ${name}Entity.this.level(); return <#if hasProcedure(conditions[0])><@procedureOBJToConditionCode conditions[0]/><#else>true; } else { @@ -30,6 +31,7 @@ this.goalSelector.addGoal(${cbi+1}, new Goal() { double y = ${name}Entity.this.getY(); double z = ${name}Entity.this.getZ(); Entity entity = ${name}Entity.this; + Level world = ${name}Entity.this.level(); return <#if hasProcedure(conditions[1])><@procedureOBJToConditionCode conditions[1]/> && ${name}Entity.this.getMoveControl().hasWanted() && ${name}Entity.this.getTarget() != null && ${name}Entity.this.getTarget().isAlive();