Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added 1.16.4 living entity element support (#590)
* Added 1.16.4 mob element support (#4) Signed-off-by: KlemenDEV <klemen.pylo@gmail.com> * Made unit tests ignore AI tasks if not defined Signed-off-by: KlemenDEV <klemen.pylo@gmail.com> * Added AI Tasks (#591) * Fixed AI tasks Signed-off-by: KlemenDEV <klemen.pylo@gmail.com> Co-authored-by: Max094Reikeb <49318596+Max094Reikeb@users.noreply.github.com>
- Loading branch information
1 parent
9a1fb2c
commit e6bb0c0
Showing
32 changed files
with
1,102 additions
and
6 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
plugins/generator-1.16.4/forge-1.16.4/aitasks/attack_action.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.targetSelector.addGoal(${customBlockIndex+1}, new HurtByTargetGoal(this)<@conditionCode field$condition/> | ||
<#if field$callhelp?lower_case == "true">.setCallsForHelp(this.getClass())</#if>); |
4 changes: 4 additions & 0 deletions
4
plugins/generator-1.16.4/forge-1.16.4/aitasks/attack_entity.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.targetSelector.addGoal(${customBlockIndex+1}, | ||
new NearestAttackableTargetGoal(this, ${generator.map(field$entity, "entities")}.class, ${field$insight?lower_case}, | ||
${field$nearby?lower_case})<@conditionCode field$condition/>); |
57 changes: 57 additions & 0 deletions
57
plugins/generator-1.16.4/forge-1.16.4/aitasks/attack_fly.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<#-- @formatter:off --> | ||
<#include "procedures.java.ftl"> | ||
<#if field$condition?has_content> | ||
<#assign conditions = generator.procedureNamesToObjects(field$condition)> | ||
<#else> | ||
<#assign conditions = ["", ""]> | ||
</#if> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new Goal() { | ||
{ | ||
this.setMutexFlags(EnumSet.of(Goal.Flag.MOVE)); | ||
} | ||
|
||
public boolean shouldExecute() { | ||
if (CustomEntity.this.getAttackTarget() != null && !CustomEntity.this.getMoveHelper().isUpdating()) { | ||
<#if hasCondition(conditions[0])> | ||
double x = CustomEntity.this.getPosX(); | ||
double y = CustomEntity.this.getPosY(); | ||
double z = CustomEntity.this.getPosZ(); | ||
Entity entity = CustomEntity.this; | ||
</#if> | ||
return <#if hasCondition(conditions[0])><@procedureOBJToConditionCode conditions[0]/><#else>true</#if>; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
@Override public boolean shouldContinueExecuting() { | ||
<#if hasCondition(conditions[1])> | ||
double x = CustomEntity.this.getPosX(); | ||
double y = CustomEntity.this.getPosY(); | ||
double z = CustomEntity.this.getPosZ(); | ||
Entity entity = CustomEntity.this; | ||
</#if> | ||
return <#if hasCondition(conditions[1])><@procedureOBJToConditionCode conditions[1]/> &&</#if> | ||
CustomEntity.this.getMoveHelper().isUpdating() && CustomEntity.this.getAttackTarget() != null && CustomEntity.this.getAttackTarget().isAlive(); | ||
} | ||
|
||
@Override public void startExecuting() { | ||
LivingEntity livingentity = CustomEntity.this.getAttackTarget(); | ||
Vector3d vec3d = livingentity.getEyePosition(1); | ||
CustomEntity.this.moveController.setMoveTo(vec3d.x, vec3d.y, vec3d.z, ${field$speed}); | ||
} | ||
|
||
@Override public void tick() { | ||
LivingEntity livingentity = CustomEntity.this.getAttackTarget(); | ||
if (CustomEntity.this.getBoundingBox().intersects(livingentity.getBoundingBox())) { | ||
CustomEntity.this.attackEntityAsMob(livingentity); | ||
} else { | ||
double d0 = CustomEntity.this.getDistanceSq(livingentity); | ||
if (d0 < ${field$radius}) { | ||
Vector3d vec3d = livingentity.getEyePosition(1); | ||
CustomEntity.this.moveController.setMoveTo(vec3d.x, vec3d.y, vec3d.z, ${field$speed}); | ||
} | ||
} | ||
} | ||
}); | ||
<#-- @formatter:on --> |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/attack_on_collide.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new MeleeAttackGoal(this, ${field$speed}, ${field$longmemory?lower_case})<@conditionCode field$condition/>); |
3 changes: 3 additions & 0 deletions
3
plugins/generator-1.16.4/forge-1.16.4/aitasks/avoid_entity.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, | ||
new AvoidEntityGoal(this, ${generator.map(field$entity, "entities")}.class, (float)${field$radius}, ${field$farspeed}, ${field$nearspeed})<@conditionCode field$condition/>); |
4 changes: 4 additions & 0 deletions
4
plugins/generator-1.16.4/forge-1.16.4/aitasks/break_blocks.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<#include "mcitems.ftl"> | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new BreakBlockGoal(${mappedBlockToBlockStateCode(input$block)}.getBlock(), | ||
this, ${field$speed}, (int) ${field$y_max})<@conditionCode field$condition/>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<#if data.breedable> | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new BreedGoal(this, ${field$speed})<@conditionCode field$condition/>); | ||
</#if> |
4 changes: 4 additions & 0 deletions
4
plugins/generator-1.16.4/forge-1.16.4/aitasks/doors_break.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<#if !data.flyingMob> | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new BreakDoorGoal(this, e -> true)<@conditionCode field$condition/>); | ||
</#if> |
4 changes: 4 additions & 0 deletions
4
plugins/generator-1.16.4/forge-1.16.4/aitasks/doors_close.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<#if !data.flyingMob> | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new OpenDoorGoal(this, false)<@conditionCode field$condition/>); | ||
</#if> |
4 changes: 4 additions & 0 deletions
4
plugins/generator-1.16.4/forge-1.16.4/aitasks/doors_open.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<#if !data.flyingMob> | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new OpenDoorGoal(this, true)<@conditionCode field$condition/>); | ||
</#if> |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/eat_grass.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new EatGrassGoal(this)<@conditionCode field$condition/>); |
4 changes: 4 additions & 0 deletions
4
plugins/generator-1.16.4/forge-1.16.4/aitasks/fight_as_owner.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<#if data.tameable> | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new OwnerHurtTargetGoal(this)<@conditionCode field$condition/>); | ||
</#if> |
16 changes: 16 additions & 0 deletions
16
plugins/generator-1.16.4/forge-1.16.4/aitasks/fly.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<#-- @formatter:off --> | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new RandomWalkingGoal(this, ${field$speed}, 20) { | ||
|
||
@Override protected Vector3d getPosition() { | ||
Random random = CustomEntity.this.getRNG(); | ||
double dir_x = CustomEntity.this.getPosX() + ((random.nextFloat() * 2 - 1) * 16); | ||
double dir_y = CustomEntity.this.getPosY() + ((random.nextFloat() * 2 - 1) * 16); | ||
double dir_z = CustomEntity.this.getPosZ() + ((random.nextFloat() * 2 - 1) * 16); | ||
return new Vector3d(dir_x, dir_y, dir_z); | ||
} | ||
|
||
<@conditionCode field$condition false/> | ||
|
||
}); | ||
<#-- @formatter:on --> |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/follow_entity.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new FollowMobGoal(this, (float)${field$speed}, ${field$maxrange}, ${field$followarea})<@conditionCode field$condition/>); |
3 changes: 3 additions & 0 deletions
3
plugins/generator-1.16.4/forge-1.16.4/aitasks/follow_item_in_hands.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<#include "mcitems.ftl"> | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new TemptGoal(this, ${field$speed}, Ingredient.fromItems(${mappedMCItemToItem(input$item)}), ${field$scared?lower_case})<@conditionCode field$condition/>); |
4 changes: 4 additions & 0 deletions
4
plugins/generator-1.16.4/forge-1.16.4/aitasks/follow_owner.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<#if data.tameable> | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new FollowOwnerGoal(this, ${field$speed}, (float) ${field$min_distance}, (float) ${field$max_distance}, false)<@conditionCode field$condition/>); | ||
</#if> |
4 changes: 4 additions & 0 deletions
4
plugins/generator-1.16.4/forge-1.16.4/aitasks/follow_parent.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<#if data.breedable> | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new FollowParentGoal(this, ${field$speed})<@conditionCode field$condition/>); | ||
</#if> |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/leap_at_target.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new LeapAtTargetGoal(this, (float)${field$speed})<@conditionCode field$condition/>); |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/look_around.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new LookRandomlyGoal(this)<@conditionCode field$condition/>); |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/move_indoors.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new ReturnToVillageGoal(this, 0.6, false)<@conditionCode field$condition/>); |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/panic_when_attacked.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1},new PanicGoal(this, ${field$speed})<@conditionCode field$condition/>); |
4 changes: 4 additions & 0 deletions
4
plugins/generator-1.16.4/forge-1.16.4/aitasks/protect_owner.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<#if data.tameable> | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new OwnerHurtByTargetGoal(this)<@conditionCode field$condition/>); | ||
</#if> |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/restrict_sun.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new RestrictSunGoal(this)<@conditionCode field$condition/>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new RandomSwimmingGoal(this, ${field$speed}, 40)<@conditionCode field$condition/>); |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/swim_in_water.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new SwimGoal(this)<@conditionCode field$condition/>); |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/wander.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new RandomWalkingGoal(this, ${field$speed})<@conditionCode field$condition/>); |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/wander_avoid_water.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new WaterAvoidingRandomWalkingGoal(this, ${field$speed})<@conditionCode field$condition/>); |
2 changes: 2 additions & 0 deletions
2
plugins/generator-1.16.4/forge-1.16.4/aitasks/watch_closest_entity.java.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<#include "aiconditions.java.ftl"> | ||
this.goalSelector.addGoal(${customBlockIndex+1}, new LookAtGoal(this, ${generator.map(field$entity, "entities")}.class,(float)${field$radius})<@conditionCode field$condition/>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
templates: | ||
- template: mob.java.ftl | ||
name: "@SRCROOT/@BASEPACKAGEPATH/entity/@NAMEEntity.java" | ||
- template: json/spawn_egg.json.ftl | ||
writer: json | ||
name: "@MODASSETSROOT/models/item/@registryname_spawn_egg.json" | ||
condition: hasSpawnEgg | ||
deleteWhenConditionFalse: true | ||
|
||
localizationkeys: | ||
- key: item.@modid.@registryname_spawn_egg | ||
mapto: mobName | ||
suffix: " Spawn Egg" | ||
- key: entity.@modid.@registryname | ||
mapto: mobName |
3 changes: 3 additions & 0 deletions
3
plugins/generator-1.16.4/forge-1.16.4/templates/json/spawn_egg.json.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"parent": "item/template_spawn_egg" | ||
} |
Oops, something went wrong.