mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 02:25:57 +01:00
Fix rabbit evil variant not setting goals with useMinecraftAI turned on
This commit is contained in:
parent
3563413c06
commit
809ef01b5d
@ -222,14 +222,19 @@ public class RabbitController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRabbitType(int i) {
|
||||
if (npc != null) {
|
||||
if (NMSImpl.getRabbitTypeField() == null)
|
||||
return;
|
||||
this.datawatcher.set(NMSImpl.getRabbitTypeField(), i);
|
||||
public void setRabbitType(int type) {
|
||||
if (npc == null) {
|
||||
super.setRabbitType(type);
|
||||
return;
|
||||
}
|
||||
super.setRabbitType(i);
|
||||
if (npc.useMinecraftAI()) {
|
||||
if (goalSelector.c().count() == 0) {
|
||||
initPathfinder(); // make sure the evil goals include the default AI goals
|
||||
}
|
||||
super.setRabbitType(type);
|
||||
} else if (NMSImpl.getRabbitTypeField() != null) {
|
||||
datawatcher.set(NMSImpl.getRabbitTypeField(), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,14 +222,19 @@ public class RabbitController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRabbitType(int i) {
|
||||
if (npc != null) {
|
||||
if (NMSImpl.getRabbitTypeField() == null)
|
||||
return;
|
||||
this.datawatcher.set(NMSImpl.getRabbitTypeField(), i);
|
||||
public void setRabbitType(int type) {
|
||||
if (npc == null) {
|
||||
super.setRabbitType(type);
|
||||
return;
|
||||
}
|
||||
super.setRabbitType(i);
|
||||
if (npc.useMinecraftAI()) {
|
||||
if (goalSelector.c().count() == 0) {
|
||||
initPathfinder(); // make sure the evil goals include the default AI goals
|
||||
}
|
||||
super.setRabbitType(type);
|
||||
} else if (NMSImpl.getRabbitTypeField() != null) {
|
||||
datawatcher.set(NMSImpl.getRabbitTypeField(), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,14 +222,19 @@ public class RabbitController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRabbitType(int i) {
|
||||
if (npc != null) {
|
||||
if (NMSImpl.getRabbitTypeField() == null)
|
||||
return;
|
||||
this.datawatcher.set(NMSImpl.getRabbitTypeField(), i);
|
||||
public void setRabbitType(int type) {
|
||||
if (npc == null) {
|
||||
super.setRabbitType(type);
|
||||
return;
|
||||
}
|
||||
super.setRabbitType(i);
|
||||
if (npc.useMinecraftAI()) {
|
||||
if (goalSelector.d().count() == 0) {
|
||||
initPathfinder(); // make sure the evil goals include the default AI goals
|
||||
}
|
||||
super.setRabbitType(type);
|
||||
} else if (NMSImpl.getRabbitTypeField() != null) {
|
||||
datawatcher.set(NMSImpl.getRabbitTypeField(), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,14 +206,19 @@ public class RabbitController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRabbitType(int i) {
|
||||
if (npc != null) {
|
||||
if (NMSImpl.getRabbitTypeField() == null)
|
||||
return;
|
||||
this.entityData.set(NMSImpl.getRabbitTypeField(), i);
|
||||
public void setRabbitType(int type) {
|
||||
if (npc == null) {
|
||||
super.setRabbitType(type);
|
||||
return;
|
||||
}
|
||||
super.setRabbitType(i);
|
||||
if (npc.useMinecraftAI()) {
|
||||
if (goalSelector.getAvailableGoals().size() == 0) {
|
||||
registerGoals(); // make sure the evil goals include the default AI goals
|
||||
}
|
||||
super.setRabbitType(type);
|
||||
} else if (NMSImpl.getRabbitTypeField() != null) {
|
||||
entityData.set(NMSImpl.getRabbitTypeField(), type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -207,14 +207,19 @@ public class RabbitController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRabbitType(int i) {
|
||||
if (npc != null) {
|
||||
if (NMSImpl.getRabbitTypeField() == null)
|
||||
return;
|
||||
this.entityData.set(NMSImpl.getRabbitTypeField(), i);
|
||||
public void setRabbitType(int type) {
|
||||
if (npc == null) {
|
||||
super.setRabbitType(type);
|
||||
return;
|
||||
}
|
||||
super.setRabbitType(i);
|
||||
if (npc.useMinecraftAI()) {
|
||||
if (goalSelector.getAvailableGoals().size() == 0) {
|
||||
registerGoals(); // make sure the evil goals include the default AI goals
|
||||
}
|
||||
super.setRabbitType(type);
|
||||
} else if (NMSImpl.getRabbitTypeField() != null) {
|
||||
entityData.set(NMSImpl.getRabbitTypeField(), type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -209,13 +209,18 @@ public class RabbitController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void setVariant(Variant variant) {
|
||||
if (npc != null) {
|
||||
if (NMSImpl.getRabbitTypeField() == null)
|
||||
return;
|
||||
this.entityData.set(NMSImpl.getRabbitTypeField(), variant.id());
|
||||
if (npc == null) {
|
||||
super.setVariant(variant);
|
||||
return;
|
||||
}
|
||||
super.setVariant(variant);
|
||||
if (npc.useMinecraftAI()) {
|
||||
if (goalSelector.getAvailableGoals().size() == 0) {
|
||||
registerGoals(); // make sure the evil goals include the default AI goals
|
||||
}
|
||||
super.setVariant(variant);
|
||||
} else if (NMSImpl.getRabbitTypeField() != null) {
|
||||
entityData.set(NMSImpl.getRabbitTypeField(), variant.id());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -199,13 +199,18 @@ public class RabbitController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void setVariant(Variant variant) {
|
||||
if (npc != null) {
|
||||
if (NMSImpl.RABBIT_TYPE_DATAWATCHER == null)
|
||||
return;
|
||||
this.entityData.set(NMSImpl.RABBIT_TYPE_DATAWATCHER, variant.id());
|
||||
if (npc == null) {
|
||||
super.setVariant(variant);
|
||||
return;
|
||||
}
|
||||
super.setVariant(variant);
|
||||
if (npc.useMinecraftAI()) {
|
||||
if (goalSelector.getAvailableGoals().size() == 0) {
|
||||
registerGoals(); // make sure the evil goals include the default AI goals
|
||||
}
|
||||
super.setVariant(variant);
|
||||
} else if (NMSImpl.RABBIT_TYPE_DATAWATCHER != null) {
|
||||
entityData.set(NMSImpl.RABBIT_TYPE_DATAWATCHER, variant.id());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2553,7 +2553,6 @@ public class NMSImpl implements NMSBridge {
|
||||
|
||||
private static final MethodHandle ADVANCEMENTS_PLAYER_SETTER = NMS.getFirstFinalSetter(ServerPlayer.class,
|
||||
PlayerAdvancements.class);
|
||||
|
||||
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP = NMS.getFirstGetter(AttributeSupplier.class, Map.class);
|
||||
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP_SETTER = NMS.getFirstFinalSetter(AttributeSupplier.class,
|
||||
Map.class);
|
||||
|
Loading…
Reference in New Issue
Block a user