mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-13 15:56:38 +01:00
Fix deployer anti agro not working, and switch away from deprecated event (#6072)
* Fix agro, switch to non deprecated event as well * spaces -> tabs
This commit is contained in:
parent
866b619767
commit
8ffc4ef96a
1 changed files with 8 additions and 7 deletions
|
@ -6,6 +6,8 @@ import java.util.UUID;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import net.minecraftforge.event.entity.living.LivingChangeTargetEvent;
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
@ -110,7 +112,7 @@ public class DeployerFakePlayer extends FakePlayer {
|
||||||
public UUID getUUID() {
|
public UUID getUUID() {
|
||||||
return owner == null ? super.getUUID() : owner;
|
return owner == null ? super.getUUID() : owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void deployerHasEyesOnHisFeet(EntityEvent.Size event) {
|
public static void deployerHasEyesOnHisFeet(EntityEvent.Size event) {
|
||||||
if (event.getEntity() instanceof DeployerFakePlayer)
|
if (event.getEntity() instanceof DeployerFakePlayer)
|
||||||
|
@ -149,23 +151,22 @@ public class DeployerFakePlayer extends FakePlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void entitiesDontRetaliate(LivingSetAttackTargetEvent event) {
|
public static void entitiesDontRetaliate(LivingChangeTargetEvent event) {
|
||||||
if (!(event.getTarget() instanceof DeployerFakePlayer))
|
if (!(event.getOriginalTarget() instanceof DeployerFakePlayer))
|
||||||
return;
|
return;
|
||||||
LivingEntity entityLiving = event.getEntityLiving();
|
LivingEntity entityLiving = event.getEntityLiving();
|
||||||
if (!(entityLiving instanceof Mob))
|
if (!(entityLiving instanceof Mob mob))
|
||||||
return;
|
return;
|
||||||
Mob mob = (Mob) entityLiving;
|
|
||||||
|
|
||||||
CKinetics.DeployerAggroSetting setting = AllConfigs.server().kinetics.ignoreDeployerAttacks.get();
|
CKinetics.DeployerAggroSetting setting = AllConfigs.server().kinetics.ignoreDeployerAttacks.get();
|
||||||
|
|
||||||
switch (setting) {
|
switch (setting) {
|
||||||
case ALL:
|
case ALL:
|
||||||
mob.setTarget(null);
|
event.setCanceled(true);
|
||||||
break;
|
break;
|
||||||
case CREEPERS:
|
case CREEPERS:
|
||||||
if (mob instanceof Creeper)
|
if (mob instanceof Creeper)
|
||||||
mob.setTarget(null);
|
event.setCanceled(true);
|
||||||
break;
|
break;
|
||||||
case NONE:
|
case NONE:
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue