|
|
|
|
@ -115,39 +115,26 @@ public abstract class MixinLOTREntityAINearestAttackableTargetBasic extends Enti
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Inject(method = "isPlayerSuitableTarget", at = @At("HEAD"), cancellable = true, remap = false)
|
|
|
|
|
private void cinderloe$applyStealthModifier(EntityPlayer player, CallbackInfoReturnable<Boolean> cir) {
|
|
|
|
|
int stealthPieces = 0;
|
|
|
|
|
System.out.println("Test 1");
|
|
|
|
|
((EntityPlayer)player).addChatMessage(new ChatComponentText("Tested detection")); // Only if there is a player or target instance to refer to.
|
|
|
|
|
|
|
|
|
|
for (ItemStack armor : player.inventory.armorInventory) {
|
|
|
|
|
System.out.println("Checking armor piece");
|
|
|
|
|
if (armor != null && armor.getItem() instanceof LOTRItemArmor && armor.stackTagCompound != null) {
|
|
|
|
|
System.out.println("Found armor piece, testing if it has stealth modifier");
|
|
|
|
|
if (LOTREnchantmentHelper.hasEnchant(armor, LOTREnchantment.getEnchantmentByName("stealth"))) {
|
|
|
|
|
System.out.println("Found modifier on armor piece");
|
|
|
|
|
stealthPieces++;
|
|
|
|
|
private void cinderloe$applyStealthModifier(EntityPlayer player, CallbackInfoReturnable<Boolean> cir) {
|
|
|
|
|
int stealthPieces = 0;
|
|
|
|
|
|
|
|
|
|
for (ItemStack armor : player.inventory.armorInventory) {
|
|
|
|
|
if (armor != null && armor.getItem() instanceof LOTRItemArmor && armor.stackTagCompound != null) {
|
|
|
|
|
if (LOTREnchantmentHelper.hasEnchant(armor, LOTREnchantment.getEnchantmentByName("stealth"))) {
|
|
|
|
|
stealthPieces++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println("Test 2");
|
|
|
|
|
((EntityPlayer)player).addChatMessage(new ChatComponentText("Tested detection1")); // Only if there is a player or target instance to refer to.
|
|
|
|
|
|
|
|
|
|
if (stealthPieces > 0 && taskOwner != null) {
|
|
|
|
|
double baseDetectionRange = taskOwner.getEntityAttribute(net.minecraft.entity.SharedMonsterAttributes.followRange).getAttributeValue();
|
|
|
|
|
double multiplier = 1.0 - (0.15 * stealthPieces);
|
|
|
|
|
double effectiveRangeSq = (baseDetectionRange * multiplier) * (baseDetectionRange * multiplier);
|
|
|
|
|
double distanceSq = taskOwner.getDistanceSqToEntity(player);
|
|
|
|
|
if (stealthPieces > 0 && taskOwner != null) {
|
|
|
|
|
double baseDetectionRange = taskOwner.getEntityAttribute(net.minecraft.entity.SharedMonsterAttributes.followRange).getAttributeValue();
|
|
|
|
|
double multiplier = 1.0 - (0.15 * stealthPieces);
|
|
|
|
|
double effectiveRangeSq = (baseDetectionRange * multiplier) * (baseDetectionRange * multiplier);
|
|
|
|
|
double distanceSq = taskOwner.getDistanceSqToEntity(player);
|
|
|
|
|
|
|
|
|
|
System.out.println("Test 3");
|
|
|
|
|
((EntityPlayer)player).addChatMessage(new ChatComponentText("Tested detection3")); // Only if there is a player or target instance to refer to.
|
|
|
|
|
|
|
|
|
|
if (distanceSq > effectiveRangeSq) {
|
|
|
|
|
cir.setReturnValue(false);
|
|
|
|
|
if (distanceSq > effectiveRangeSq) {
|
|
|
|
|
cir.setReturnValue(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
System.out.println("Test 4");
|
|
|
|
|
((EntityPlayer)player).addChatMessage(new ChatComponentText("Tested detection4")); // Only if there is a player or target instance to refer to.
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|