Update forge to 40.2.1
This commit is contained in:
parent
e0b6dda5ed
commit
16a5f7413f
@ -21,6 +21,7 @@ import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.event.entity.living.LivingChangeTargetEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
||||
@ -135,9 +136,15 @@ public abstract class MobMixin extends LivingEntityMixin implements MobEntityBri
|
||||
livingEntity = null;
|
||||
}
|
||||
}
|
||||
this.target = livingEntity;
|
||||
ForgeHooks.onLivingSetAttackTarget((Mob) (Object) this, this.target);
|
||||
arclight$targetSuccess = true;
|
||||
var changeTargetEvent = ForgeHooks.onLivingChangeTarget((Mob) (Object) this, livingEntity, LivingChangeTargetEvent.LivingTargetType.MOB_TARGET);
|
||||
if (changeTargetEvent.isCanceled()) {
|
||||
this.target = changeTargetEvent.getNewTarget();
|
||||
// noinspection removal
|
||||
ForgeHooks.onLivingSetAttackTarget((Mob) (Object) this, this.target);
|
||||
arclight$targetSuccess = true;
|
||||
} else {
|
||||
arclight$targetSuccess = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setTarget(LivingEntity livingEntity, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
|
||||
@ -25,7 +25,14 @@ public class StartAttackingMixin<E extends Mob> {
|
||||
return;
|
||||
}
|
||||
livingEntity = ((event.getTarget() != null) ? ((CraftLivingEntity) event.getTarget()).getHandle() : null);
|
||||
var changeTargetEvent = net.minecraftforge.common.ForgeHooks.onLivingChangeTarget(mob, livingEntity, net.minecraftforge.event.entity.living.LivingChangeTargetEvent.LivingTargetType.BEHAVIOR_TARGET);
|
||||
if (changeTargetEvent.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
livingEntity = changeTargetEvent.getNewTarget();
|
||||
mob.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, livingEntity);
|
||||
mob.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
// noinspection removal
|
||||
net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(mob, livingEntity, net.minecraftforge.event.entity.living.LivingChangeTargetEvent.LivingTargetType.BEHAVIOR_TARGET);
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ allprojects {
|
||||
ext {
|
||||
agpVersion = '1.23'
|
||||
minecraftVersion = '1.18.2'
|
||||
forgeVersion = '40.1.80'
|
||||
forgeVersion = '40.2.1'
|
||||
apiVersion = '1.4.0'
|
||||
toolsVersion = '1.3.+'
|
||||
mixinVersion = '0.8.5'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user