Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Goblin traders will now eat apples if health is low
- Loading branch information
1 parent
0b6371f
commit f982e9b
Showing
5 changed files
with
75 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
21 changes: 21 additions & 0 deletions
21
src/main/java/com/mrcrayfish/goblintraders/entity/ai/goal/EatAppleGoal.java
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,21 @@ | ||
package com.mrcrayfish.goblintraders.entity.ai.goal; | ||
|
||
import com.mrcrayfish.goblintraders.entity.AbstractGoblinEntity; | ||
import net.minecraft.entity.ai.goal.Goal; | ||
import net.minecraft.entity.ai.goal.UseItemGoal; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Items; | ||
|
||
import java.util.EnumSet; | ||
|
||
/** | ||
* Author: MrCrayfish | ||
*/ | ||
public class EatAppleGoal extends UseItemGoal<AbstractGoblinEntity> | ||
{ | ||
public EatAppleGoal(AbstractGoblinEntity entity) | ||
{ | ||
super(entity, new ItemStack(Items.APPLE), null, entity1 -> entity1.getHealth() < entity1.getMaxHealth() && entity1.getRNG().nextInt(40) == 0); //TODO change sound to a burp | ||
this.setMutexFlags(EnumSet.of(Goal.Flag.MOVE)); | ||
} | ||
} |
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