net.minecraft.entity.ai.brain.Activity Java Examples
The following examples show how to use
net.minecraft.entity.ai.brain.Activity.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EvolvedZombieEntity.java From Galacticraft-Rewoven with MIT License | 5 votes |
public EvolvedZombieEntity(EntityType<? extends EvolvedZombieEntity> entityType, World world) { super(entityType, world); this.setHealth(20); this.initGoals(); this.setCanPickUpLoot(true); this.brain.setDefaultActivity(Activity.CORE); HashSet<Activity> otherActivities = new HashSet<>(); otherActivities.add(Activity.IDLE); this.brain.setCoreActivities(otherActivities); }
Example #2
Source File: MixinActivity.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
@Override public IForgeRegistryEntry<Activity> setRegistryName(Identifier name) { this.registryName = name; return this; }
Example #3
Source File: MixinActivity.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public Identifier getRegistryName() { Activity activity = (Activity) (Object) this; return Identifiers.getOrFallback(Registry.ACTIVITY, activity, registryName); }
Example #4
Source File: MixinActivity.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public Class<Activity> getRegistryType() { return Activity.class; }
Example #5
Source File: VillagerEntity_aiMixin.java From fabric-carpet with MIT License | 4 votes |
@Inject(method = "tick", at = @At("HEAD")) private void ontick(CallbackInfo ci) { if (MobAI.isTracking(this, MobAI.TrackingType.IRON_GOLEM_SPAWNING)) { long time; Optional<Long> optional_1 = this.brain.getOptionalMemory(MemoryModuleType.GOLEM_LAST_SEEN_TIME); if (!optional_1.isPresent()) { time = 0; } else { Long long_2 = optional_1.get(); time = long_2+600 - getEntityWorld().getTime(); } boolean recentlySeen = hasSeenGolemRecently(getEntityWorld().getTime()); Optional<Timestamp> optional_11 = this.brain.getOptionalMemory(MemoryModuleType.LAST_SLEPT); Optional<Timestamp> optional_22 = this.brain.getOptionalMemory(MemoryModuleType.LAST_WORKED_AT_POI); boolean work = false; boolean sleep = false; boolean panic = this.brain.hasActivity(Activity.PANIC); long currentTime = this.world.getTime(); if (optional_11.isPresent()) { sleep = (currentTime - optional_11.get().getTime()) < 24000L; } if (optional_22.isPresent()) { work = (currentTime - optional_22.get().getTime()) < 36000L; } this.setCustomName(Messenger.c( (sleep?"eb ":"fb ")+"\u263d ", (work?"eb ":"fb ")+"\u2692 ",//"\u26CF ", (panic?"lb ":"fb ")+"\u2623 ",//"\u2622 \u2620 \u26A1 ", (recentlySeen?"rb ":"lb ")+time )); this.setCustomNameVisible(true); } else if (MobAI.isTracking(this, MobAI.TrackingType.VILLAGER_BREEDING)) { if (age % 50 == 0 || age < 20) { totalFood = getAvailableFood() / 12; hasBed = this.brain.getOptionalMemory(MemoryModuleType.HOME).isPresent(); displayAge = getBreedingAge(); } if (Math.abs(displayAge) < 100 && displayAge !=0) displayAge = getBreedingAge(); this.setCustomName(Messenger.c( (hasBed?"eb ":"fb ")+"\u2616 ",//"\u263d ", (totalFood>0?"eb ":"fb ")+"\u2668",(totalFood>0?"e ":"f ")+totalFood+" ", (displayAge==0?"eb ":"fb ")+"\u2661",(displayAge==0?"e ":"f "+displayAge) )); this.setCustomNameVisible(true); } }