-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement wither targeting AI tweak, closes #179
- Loading branch information
Showing
6 changed files
with
67 additions
and
0 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
32 changes: 32 additions & 0 deletions
32
src/main/java/mod/acgaming/universaltweaks/tweaks/entities/ai/wither/UTWitherAI.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,32 @@ | ||
package mod.acgaming.universaltweaks.tweaks.entities.ai.wither; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.ai.EntityAIHurtByTarget; | ||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; | ||
import net.minecraft.entity.boss.EntityWither; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraftforge.event.entity.EntityJoinWorldEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
|
||
import mod.acgaming.universaltweaks.UniversalTweaks; | ||
import mod.acgaming.universaltweaks.config.UTConfig; | ||
|
||
@Mod.EventBusSubscriber(modid = UniversalTweaks.MODID) | ||
public class UTWitherAI | ||
{ | ||
@SubscribeEvent | ||
public static void utWitherAI(EntityJoinWorldEvent event) | ||
{ | ||
if (!UTConfig.TWEAKS_ENTITIES.utWitherAIToggle) return; | ||
if (UTConfig.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTWitherAI ::: Entity join world event"); | ||
Entity entity = event.getEntity(); | ||
if (entity instanceof EntityWither) | ||
{ | ||
EntityWither wither = (EntityWither) entity; | ||
wither.targetTasks.taskEntries.clear(); | ||
wither.targetTasks.addTask(1, new EntityAIHurtByTarget(wither, false)); | ||
wither.targetTasks.addTask(2, new EntityAINearestAttackableTarget<>(wither, EntityPlayer.class, false, false)); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...in/java/mod/acgaming/universaltweaks/tweaks/entities/ai/wither/mixin/UTWitherAIMixin.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,18 @@ | ||
package mod.acgaming.universaltweaks.tweaks.entities.ai.wither.mixin; | ||
|
||
import net.minecraft.entity.boss.EntityWither; | ||
|
||
import mod.acgaming.universaltweaks.config.UTConfig; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import zone.rong.mixinextras.injector.WrapWithCondition; | ||
|
||
@Mixin(EntityWither.class) | ||
public class UTWitherAIMixin | ||
{ | ||
@WrapWithCondition(method = "updateAITasks", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/boss/EntityWither;updateWatchedTargetId(II)V", ordinal = 3)) | ||
public boolean utWitherAI(EntityWither instance, int targetOffset, int newId) | ||
{ | ||
return !UTConfig.TWEAKS_ENTITIES.utWitherAIToggle; | ||
} | ||
} |
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,7 @@ | ||
{ | ||
"package": "mod.acgaming.universaltweaks.tweaks.entities.ai.wither.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTWitherAIMixin"] | ||
} |