├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── feature-request.yml │ └── report-a-bug.yml ├── dependabot.yml ├── pull_request_template.md └── workflows │ └── build.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── abstraction ├── build.gradle.kts └── src │ └── main │ └── java │ └── me │ └── gamercoder215 │ └── mobchip │ ├── abstraction │ └── ChipUtil.java │ └── bukkit │ ├── BukkitCreatureBehavior.java │ ├── BukkitDragonBehavior.java │ ├── BukkitEntityBehavior.java │ └── BukkitUpdatableCreatureBehavior.java ├── base ├── build.gradle.kts └── src │ ├── main │ ├── java │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ ├── DragonBrain.java │ │ │ ├── EntityBody.java │ │ │ ├── EntityBrain.java │ │ │ ├── VillagerBrain.java │ │ │ ├── ai │ │ │ ├── EntityAI.java │ │ │ ├── Probable.java │ │ │ ├── SpeedModifier.java │ │ │ ├── animation │ │ │ │ └── EntityAnimation.java │ │ │ ├── attribute │ │ │ │ ├── Attribute.java │ │ │ │ └── AttributeInstance.java │ │ │ ├── behavior │ │ │ │ ├── AllayBehavior.java │ │ │ │ ├── AxolotlBehavior.java │ │ │ │ ├── BehaviorResult.java │ │ │ │ ├── BreezeBehavior.java │ │ │ │ ├── CamelBehavior.java │ │ │ │ ├── CreatureBehavior.java │ │ │ │ ├── DragonBehavior.java │ │ │ │ ├── EntityBehavior.java │ │ │ │ ├── FrogBehavior.java │ │ │ │ ├── PiglinBehavior.java │ │ │ │ ├── VillagerBehavior.java │ │ │ │ └── WardenBehavior.java │ │ │ ├── controller │ │ │ │ ├── EntityController.java │ │ │ │ └── NaturalMoveType.java │ │ │ ├── enderdragon │ │ │ │ ├── CustomPhase.java │ │ │ │ └── DragonPhase.java │ │ │ ├── goal │ │ │ │ ├── Conditional.java │ │ │ │ ├── CustomPathfinder.java │ │ │ │ ├── Pathfinder.java │ │ │ │ ├── PathfinderAvoidEntity.java │ │ │ │ ├── PathfinderBeg.java │ │ │ │ ├── PathfinderBreakDoor.java │ │ │ │ ├── PathfinderBreathAir.java │ │ │ │ ├── PathfinderBreed.java │ │ │ │ ├── PathfinderClimbPowderedSnow.java │ │ │ │ ├── PathfinderDolphinJump.java │ │ │ │ ├── PathfinderEatTile.java │ │ │ │ ├── PathfinderFindWater.java │ │ │ │ ├── PathfinderFleeSun.java │ │ │ │ ├── PathfinderFloat.java │ │ │ │ ├── PathfinderFollowBoat.java │ │ │ │ ├── PathfinderFollowFishLeader.java │ │ │ │ ├── PathfinderFollowMob.java │ │ │ │ ├── PathfinderFollowOwner.java │ │ │ │ ├── PathfinderFollowParent.java │ │ │ │ ├── PathfinderInfo.java │ │ │ │ ├── PathfinderLeapAtTarget.java │ │ │ │ ├── PathfinderLlamaFollowCaravan.java │ │ │ │ ├── PathfinderLookAtEntity.java │ │ │ │ ├── PathfinderMeleeAttack.java │ │ │ │ ├── PathfinderMoveThroughVillage.java │ │ │ │ ├── PathfinderMoveToBlock.java │ │ │ │ ├── PathfinderMoveTowardsRestriction.java │ │ │ │ ├── PathfinderMoveTowardsTarget.java │ │ │ │ ├── PathfinderOcelotAttack.java │ │ │ │ ├── PathfinderOfferFlower.java │ │ │ │ ├── PathfinderOpenDoor.java │ │ │ │ ├── PathfinderPanic.java │ │ │ │ ├── PathfinderRandomLook.java │ │ │ │ ├── PathfinderRandomStand.java │ │ │ │ ├── PathfinderRandomStroll.java │ │ │ │ ├── PathfinderRandomStrollFlying.java │ │ │ │ ├── PathfinderRandomStrollInVillage.java │ │ │ │ ├── PathfinderRandomStrollLand.java │ │ │ │ ├── PathfinderRandomStrollThroughVillage.java │ │ │ │ ├── PathfinderRandomStrollToVillage.java │ │ │ │ ├── PathfinderRandomSwim.java │ │ │ │ ├── PathfinderRangedAttack.java │ │ │ │ ├── PathfinderRemoveBlock.java │ │ │ │ ├── PathfinderResetAnger.java │ │ │ │ ├── PathfinderRestrictSun.java │ │ │ │ ├── PathfinderRideShoulder.java │ │ │ │ ├── PathfinderSit.java │ │ │ │ ├── PathfinderSkeletonTrap.java │ │ │ │ ├── PathfinderSwellCreeper.java │ │ │ │ ├── PathfinderTameHorse.java │ │ │ │ ├── PathfinderTempt.java │ │ │ │ ├── PathfinderUseItem.java │ │ │ │ ├── PathfinderZombieAttack.java │ │ │ │ ├── Ranged.java │ │ │ │ ├── Repeated.java │ │ │ │ ├── WorldSpecific.java │ │ │ │ ├── WrappedPathfinder.java │ │ │ │ └── target │ │ │ │ │ ├── Filtering.java │ │ │ │ │ ├── PathfinderDefendVillage.java │ │ │ │ │ ├── PathfinderHurtByTarget.java │ │ │ │ │ ├── PathfinderNearestAttackableTarget.java │ │ │ │ │ ├── PathfinderOwnerHurtByTarget.java │ │ │ │ │ ├── PathfinderOwnerHurtTarget.java │ │ │ │ │ ├── PathfinderWildTarget.java │ │ │ │ │ ├── TargetPathfinder.java │ │ │ │ │ └── Targeting.java │ │ │ ├── gossip │ │ │ │ ├── EntityGossipContainer.java │ │ │ │ └── GossipType.java │ │ │ ├── memories │ │ │ │ ├── EntityMemory.java │ │ │ │ ├── Memory.java │ │ │ │ ├── MemoryStatus.java │ │ │ │ └── Unit.java │ │ │ ├── navigation │ │ │ │ ├── EntityNavigation.java │ │ │ │ └── NavigationPath.java │ │ │ ├── schedule │ │ │ │ ├── Activity.java │ │ │ │ ├── EntityScheduleManager.java │ │ │ │ ├── Schedule.java │ │ │ │ └── Updatable.java │ │ │ └── sensing │ │ │ │ ├── CustomSensor.java │ │ │ │ ├── EntitySenses.java │ │ │ │ └── Sensor.java │ │ │ ├── bosses │ │ │ ├── Boss.java │ │ │ ├── BossHandler.java │ │ │ ├── Minion.java │ │ │ └── annotations │ │ │ │ └── Repeatable.java │ │ │ ├── combat │ │ │ ├── CombatEntry.java │ │ │ ├── CombatLocation.java │ │ │ └── EntityCombatTracker.java │ │ │ └── util │ │ │ ├── Position.java │ │ │ ├── PositionPath.java │ │ │ └── Registration.java │ └── kotlin │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── util │ │ └── extensions.kt │ └── test │ └── java │ └── me │ └── gamercoder215 │ └── mobchip │ ├── ai │ ├── memories │ │ └── TestEntityMemory.java │ └── schedule │ │ └── TestSchedule.java │ └── util │ └── TestPosition.java ├── build.gradle.kts ├── bukkit ├── build.gradle.kts └── src │ └── main │ ├── java │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ ├── ai │ │ ├── attribute │ │ │ └── EntityAttribute.java │ │ ├── enderdragon │ │ │ └── DragonPhases.java │ │ ├── memories │ │ │ └── EntityMemories.java │ │ └── schedule │ │ │ └── DefaultSchedules.java │ │ └── bukkit │ │ ├── BukkitAI.java │ │ ├── BukkitBrain.java │ │ ├── BukkitDragonBrain.java │ │ ├── BukkitVillagerBrain.java │ │ └── events │ │ ├── BrainEvent.java │ │ ├── RestrictionSetEvent.java │ │ ├── memory │ │ ├── MemoryChangeEvent.java │ │ └── MemoryEvent.java │ │ └── pathfinder │ │ ├── PathfinderAddEvent.java │ │ ├── PathfinderClearEvent.java │ │ ├── PathfinderEvent.java │ │ └── PathfinderRemoveEvent.java │ ├── javadoc │ ├── me │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ ├── ai │ │ │ ├── animation │ │ │ │ └── package-info.java │ │ │ ├── attribute │ │ │ │ └── package-info.java │ │ │ ├── behavior │ │ │ │ └── package-info.java │ │ │ ├── controller │ │ │ │ └── package-info.java │ │ │ ├── enderdragon │ │ │ │ └── package-info.java │ │ │ ├── goal │ │ │ │ ├── package-info.java │ │ │ │ └── target │ │ │ │ │ └── package-info.java │ │ │ ├── gossip │ │ │ │ └── package-info.java │ │ │ ├── memories │ │ │ │ └── package-info.java │ │ │ ├── navigation │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── schedule │ │ │ │ └── package-info.java │ │ │ └── sensing │ │ │ │ └── package-info.java │ │ │ ├── bosses │ │ │ ├── annotations │ │ │ │ └── package-info.java │ │ │ └── package-info.java │ │ │ ├── bukkit │ │ │ ├── events │ │ │ │ ├── memory │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ └── pathfinder │ │ │ │ │ └── package-info.java │ │ │ └── package-info.java │ │ │ ├── combat │ │ │ └── package-info.java │ │ │ ├── nbt │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── util │ │ │ └── package-info.java │ └── overview.html │ └── kotlin │ └── me │ └── gamercoder215 │ └── mobchip │ ├── ai │ ├── attribute │ │ └── extensions.kt │ ├── controller │ │ └── extensions.kt │ ├── enderdragon │ │ └── extensions.kt │ └── memories │ │ └── extensions.kt │ └── bukkit │ └── extensions.kt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── javadoc.sh ├── jitpack.yml ├── nms ├── 1_17_R1 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ ├── abstraction │ │ │ └── v1_17_R1 │ │ │ │ ├── Attribute1_17_R1.java │ │ │ │ ├── AttributeInstance1_17_R1.java │ │ │ │ ├── BehaviorResult1_17_R1.java │ │ │ │ ├── ChipUtil1_17_R1.java │ │ │ │ ├── CustomGoal1_17_R1.java │ │ │ │ ├── DragonPhase1_17_R1.java │ │ │ │ ├── EntityBody1_17_R1.java │ │ │ │ ├── EntityCombatTracker1_17_R1.java │ │ │ │ ├── EntityController1_17_R1.java │ │ │ │ ├── EntityGossipContainer1_17_R1.java │ │ │ │ ├── EntityNavigation1_17_R1.java │ │ │ │ ├── EntityScheduleManager1_17_R1.java │ │ │ │ ├── EntitySenses1_17_R1.java │ │ │ │ ├── NavigationPath1_17_R1.java │ │ │ │ ├── Sensor1_17_R1.java │ │ │ │ └── SensorDefault1_17_R1.java │ │ │ ├── ai │ │ │ └── goal │ │ │ │ ├── PathfinderCatOnBed.java │ │ │ │ ├── PathfinderCatOnBlock.java │ │ │ │ ├── PathfinderLookAtTradingPlayer.java │ │ │ │ ├── PathfinderMoveToRaid.java │ │ │ │ ├── PathfinderRangedBowAttack.java │ │ │ │ ├── PathfinderRangedCrossbowAttack.java │ │ │ │ ├── PathfinderTradePlayer.java │ │ │ │ └── target │ │ │ │ ├── PathfinderNearestAttackableTargetRaider.java │ │ │ │ └── PathfinderNearestHealableRaider.java │ │ │ └── bukkit │ │ │ ├── BukkitAxolotlBehavior.java │ │ │ └── BukkitVillagerBehavior.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_17_R1 │ │ ├── OptimizedSmallEnumSet1_17_R1.java │ │ └── TestChipUtil1_17_R1.java ├── 1_18_R1 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ └── abstraction │ │ │ └── v1_18_R1 │ │ │ ├── Attribute1_18_R1.java │ │ │ ├── AttributeInstance1_18_R1.java │ │ │ ├── BehaviorResult1_18_R1.java │ │ │ ├── ChipUtil1_18_R1.java │ │ │ ├── CustomGoal1_18_R1.java │ │ │ ├── DragonPhase1_18_R1.java │ │ │ ├── EntityBody1_18_R1.java │ │ │ ├── EntityCombatTracker1_18_R1.java │ │ │ ├── EntityController1_18_R1.java │ │ │ ├── EntityGossipContainer1_18_R1.java │ │ │ ├── EntityNavigation1_18_R1.java │ │ │ ├── EntityScheduleManager1_18_R1.java │ │ │ ├── EntitySenses1_18_R1.java │ │ │ ├── NavigationPath1_18_R1.java │ │ │ ├── Sensor1_18_R1.java │ │ │ └── SensorDefault1_18_R1.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_18_R1 │ │ ├── OptimizedSmallEnumSet1_18_R1.java │ │ └── TestChipUtil1_18_R1.java ├── 1_18_R2 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ └── abstraction │ │ │ └── v1_18_R2 │ │ │ ├── Attribute1_18_R2.java │ │ │ ├── AttributeInstance1_18_R2.java │ │ │ ├── BehaviorResult1_18_R2.java │ │ │ ├── ChipUtil1_18_R2.java │ │ │ ├── CustomGoal1_18_R2.java │ │ │ ├── DragonPhase1_18_R2.java │ │ │ ├── EntityBody1_18_R2.java │ │ │ ├── EntityCombatTracker1_18_R2.java │ │ │ ├── EntityController1_18_R2.java │ │ │ ├── EntityGossipContainer1_18_R2.java │ │ │ ├── EntityNavigation1_18_R2.java │ │ │ ├── EntityScheduleManager1_18_R2.java │ │ │ ├── EntitySenses1_18_R2.java │ │ │ ├── NavigationPath1_18_R2.java │ │ │ ├── Sensor1_18_R2.java │ │ │ └── SensorDefault1_18_R2.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_18_R2 │ │ ├── OptimizedSmallEnumSet1_18_R2.java │ │ └── TestChipUtil1_18_R2.java ├── 1_19_R1 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ ├── abstraction │ │ │ └── v1_19_R1 │ │ │ │ ├── Attribute1_19_R1.java │ │ │ │ ├── AttributeInstance1_19_R1.java │ │ │ │ ├── BehaviorResult1_19_R1.java │ │ │ │ ├── ChipUtil1_19_R1.java │ │ │ │ ├── CustomGoal1_19_R1.java │ │ │ │ ├── DragonPhase1_19_R1.java │ │ │ │ ├── EntityBody1_19_R1.java │ │ │ │ ├── EntityCombatTracker1_19_R1.java │ │ │ │ ├── EntityController1_19_R1.java │ │ │ │ ├── EntityGossipContainer1_19_R1.java │ │ │ │ ├── EntityNavigation1_19_R1.java │ │ │ │ ├── EntityScheduleManager1_19_R1.java │ │ │ │ ├── EntitySenses1_19_R1.java │ │ │ │ ├── NavigationPath1_19_R1.java │ │ │ │ ├── Sensor1_19_R1.java │ │ │ │ └── SensorDefault1_19_R1.java │ │ │ └── bukkit │ │ │ ├── BukkitAllayBehavior.java │ │ │ ├── BukkitFrogBehavior.java │ │ │ └── BukkitWardenBehavior.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_19_R1 │ │ ├── OptimizedSmallEnumSet1_19_R1.java │ │ └── TestChipUtil1_19_R1.java ├── 1_19_R2 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ └── abstraction │ │ │ └── v1_19_R2 │ │ │ ├── Attribute1_19_R2.java │ │ │ ├── AttributeInstance1_19_R2.java │ │ │ ├── BehaviorResult1_19_R2.java │ │ │ ├── ChipUtil1_19_R2.java │ │ │ ├── CustomGoal1_19_R2.java │ │ │ ├── DragonPhase1_19_R2.java │ │ │ ├── EntityBody1_19_R2.java │ │ │ ├── EntityCombatTracker1_19_R2.java │ │ │ ├── EntityController1_19_R2.java │ │ │ ├── EntityGossipContainer1_19_R2.java │ │ │ ├── EntityNavigation1_19_R2.java │ │ │ ├── EntityScheduleManager1_19_R2.java │ │ │ ├── EntitySenses1_19_R2.java │ │ │ ├── NavigationPath1_19_R2.java │ │ │ ├── Sensor1_19_R2.java │ │ │ └── SensorDefault1_19_R2.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_19_R2 │ │ ├── OptimizedSmallEnumSet1_19_R2.java │ │ └── TestChipUtil1_19_R2.java ├── 1_19_R3 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ └── abstraction │ │ │ └── v1_19_R3 │ │ │ ├── Attribute1_19_R3.java │ │ │ ├── AttributeInstance1_19_R3.java │ │ │ ├── BehaviorResult1_19_R3.java │ │ │ ├── ChipUtil1_19_R3.java │ │ │ ├── CustomGoal1_19_R3.java │ │ │ ├── DragonPhase1_19_R3.java │ │ │ ├── EntityBody1_19_R3.java │ │ │ ├── EntityCombatTracker1_19_R3.java │ │ │ ├── EntityController1_19_R3.java │ │ │ ├── EntityGossipContainer1_19_R3.java │ │ │ ├── EntityNavigation1_19_R3.java │ │ │ ├── EntityScheduleManager1_19_R3.java │ │ │ ├── EntitySenses1_19_R3.java │ │ │ ├── NavigationPath1_19_R3.java │ │ │ ├── Sensor1_19_R3.java │ │ │ └── SensorDefault1_19_R3.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_19_R3 │ │ ├── OptimizedSmallEnumSet1_19_R3.java │ │ └── TestChipUtil1_19_R3.java ├── 1_20_R1 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ ├── abstraction │ │ │ └── v1_20_R1 │ │ │ │ ├── Attribute1_20_R1.java │ │ │ │ ├── AttributeInstance1_20_R1.java │ │ │ │ ├── BehaviorResult1_20_R1.java │ │ │ │ ├── ChipUtil1_20_R1.java │ │ │ │ ├── CustomGoal1_20_R1.java │ │ │ │ ├── DragonPhase1_20_R1.java │ │ │ │ ├── EntityBody1_20_R1.java │ │ │ │ ├── EntityCombatTracker1_20_R1.java │ │ │ │ ├── EntityController1_20_R1.java │ │ │ │ ├── EntityGossipContainer1_20_R1.java │ │ │ │ ├── EntityNavigation1_20_R1.java │ │ │ │ ├── EntityScheduleManager1_20_R1.java │ │ │ │ ├── EntitySenses1_20_R1.java │ │ │ │ ├── NavigationPath1_20_R1.java │ │ │ │ ├── Sensor1_20_R1.java │ │ │ │ └── SensorDefault1_20_R1.java │ │ │ └── bukkit │ │ │ └── BukkitCamelBehavior.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_20_R1 │ │ ├── OptimizedSmallEnumSet1_20_R1.java │ │ └── TestChipUtil1_20_R1.java ├── 1_20_R2 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ └── abstraction │ │ │ └── v1_20_R2 │ │ │ ├── Attribute1_20_R2.java │ │ │ ├── AttributeInstance1_20_R2.java │ │ │ ├── BehaviorResult1_20_R2.java │ │ │ ├── ChipUtil1_20_R2.java │ │ │ ├── CustomGoal1_20_R2.java │ │ │ ├── DragonPhase1_20_R2.java │ │ │ ├── EntityBody1_20_R2.java │ │ │ ├── EntityCombatTracker1_20_R2.java │ │ │ ├── EntityController1_20_R2.java │ │ │ ├── EntityGossipContainer1_20_R2.java │ │ │ ├── EntityNavigation1_20_R2.java │ │ │ ├── EntityScheduleManager1_20_R2.java │ │ │ ├── EntitySenses1_20_R2.java │ │ │ ├── NavigationPath1_20_R2.java │ │ │ ├── Sensor1_20_R2.java │ │ │ └── SensorDefault1_20_R2.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_20_R2 │ │ ├── OptimizedSmallEnumSet1_20_R2.java │ │ └── TestChipUtil1_20_R2.java ├── 1_20_R3 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ ├── abstraction │ │ │ └── v1_20_R3 │ │ │ │ ├── Attribute1_20_R3.java │ │ │ │ ├── AttributeInstance1_20_R3.java │ │ │ │ ├── BehaviorResult1_20_R3.java │ │ │ │ ├── ChipUtil1_20_R3.java │ │ │ │ ├── CustomGoal1_20_R3.java │ │ │ │ ├── DragonPhase1_20_R3.java │ │ │ │ ├── EntityBody1_20_R3.java │ │ │ │ ├── EntityCombatTracker1_20_R3.java │ │ │ │ ├── EntityController1_20_R3.java │ │ │ │ ├── EntityGossipContainer1_20_R3.java │ │ │ │ ├── EntityNavigation1_20_R3.java │ │ │ │ ├── EntityScheduleManager1_20_R3.java │ │ │ │ ├── EntitySenses1_20_R3.java │ │ │ │ ├── NavigationPath1_20_R3.java │ │ │ │ ├── Sensor1_20_R3.java │ │ │ │ └── SensorDefault1_20_R3.java │ │ │ └── bukkit │ │ │ └── BukkitBreezeBehavior.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_20_R3 │ │ ├── OptimizedSmallEnumSet1_20_R3.java │ │ └── TestChipUtil1_20_R3.java ├── 1_20_R4 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ └── abstraction │ │ │ └── v1_20_R4 │ │ │ ├── Attribute1_20_R4.java │ │ │ ├── AttributeInstance1_20_R4.java │ │ │ ├── BehaviorResult1_20_R4.java │ │ │ ├── ChipUtil1_20_R4.java │ │ │ ├── CustomGoal1_20_R4.java │ │ │ ├── DragonPhase1_20_R4.java │ │ │ ├── EntityBody1_20_R4.java │ │ │ ├── EntityCombatTracker1_20_R4.java │ │ │ ├── EntityController1_20_R4.java │ │ │ ├── EntityGossipContainer1_20_R4.java │ │ │ ├── EntityNavigation1_20_R4.java │ │ │ ├── EntityScheduleManager1_20_R4.java │ │ │ ├── EntitySenses1_20_R4.java │ │ │ ├── NavigationPath1_20_R4.java │ │ │ ├── Sensor1_20_R4.java │ │ │ └── SensorDefault1_20_R4.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_20_R4 │ │ ├── OptimizedSmallEnumSet1_20_R4.java │ │ └── TestChipUtil1_20_R4.java ├── 1_21_R1 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ └── abstraction │ │ │ └── v1_21_R1 │ │ │ ├── Attribute1_21_R1.java │ │ │ ├── AttributeInstance1_21_R1.java │ │ │ ├── BehaviorResult1_21_R1.java │ │ │ ├── ChipUtil1_21_R1.java │ │ │ ├── CustomGoal1_21_R1.java │ │ │ ├── DragonPhase1_21_R1.java │ │ │ ├── EntityBody1_21_R1.java │ │ │ ├── EntityCombatTracker1_21_R1.java │ │ │ ├── EntityController1_21_R1.java │ │ │ ├── EntityGossipContainer1_21_R1.java │ │ │ ├── EntityNavigation1_21_R1.java │ │ │ ├── EntityScheduleManager1_21_R1.java │ │ │ ├── EntitySenses1_21_R1.java │ │ │ ├── NavigationPath1_21_R1.java │ │ │ ├── Sensor1_21_R1.java │ │ │ └── SensorDefault1_21_R1.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_21_R1 │ │ ├── OptimizedSmallEnumSet1_21_R1.java │ │ └── TestChipUtil1_21_R1.java ├── 1_21_R2 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ └── abstraction │ │ │ └── v1_21_R2 │ │ │ ├── Attribute1_21_R2.java │ │ │ ├── AttributeInstance1_21_R2.java │ │ │ ├── BehaviorResult1_21_R2.java │ │ │ ├── ChipUtil1_21_R2.java │ │ │ ├── CustomGoal1_21_R2.java │ │ │ ├── DragonPhase1_21_R2.java │ │ │ ├── EntityBody1_21_R2.java │ │ │ ├── EntityCombatTracker1_21_R2.java │ │ │ ├── EntityController1_21_R2.java │ │ │ ├── EntityGossipContainer1_21_R2.java │ │ │ ├── EntityNavigation1_21_R2.java │ │ │ ├── EntityScheduleManager1_21_R2.java │ │ │ ├── EntitySenses1_21_R2.java │ │ │ ├── NavigationPath1_21_R2.java │ │ │ ├── Sensor1_21_R2.java │ │ │ └── SensorDefault1_21_R2.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_21_R2 │ │ ├── OptimizedSmallEnumSet1_21_R2.java │ │ └── TestChipUtil1_21_R2.java ├── 1_21_R3 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ └── abstraction │ │ │ └── v1_21_R3 │ │ │ ├── Attribute1_21_R3.java │ │ │ ├── AttributeInstance1_21_R3.java │ │ │ ├── BehaviorResult1_21_R3.java │ │ │ ├── ChipUtil1_21_R3.java │ │ │ ├── CustomGoal1_21_R3.java │ │ │ ├── DragonPhase1_21_R3.java │ │ │ ├── EntityBody1_21_R3.java │ │ │ ├── EntityCombatTracker1_21_R3.java │ │ │ ├── EntityController1_21_R3.java │ │ │ ├── EntityGossipContainer1_21_R3.java │ │ │ ├── EntityNavigation1_21_R3.java │ │ │ ├── EntityScheduleManager1_21_R3.java │ │ │ ├── EntitySenses1_21_R3.java │ │ │ ├── NavigationPath1_21_R3.java │ │ │ ├── Sensor1_21_R3.java │ │ │ └── SensorDefault1_21_R3.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_21_R3 │ │ ├── OptimizedSmallEnumSet1_21_R3.java │ │ └── TestChipUtil1_21_R3.java ├── 1_21_R4 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ └── abstraction │ │ │ └── v1_21_R4 │ │ │ ├── Attribute1_21_R4.java │ │ │ ├── AttributeInstance1_21_R4.java │ │ │ ├── BehaviorResult1_21_R4.java │ │ │ ├── ChipUtil1_21_R4.java │ │ │ ├── CustomGoal1_21_R4.java │ │ │ ├── DragonPhase1_21_R4.java │ │ │ ├── EntityBody1_21_R4.java │ │ │ ├── EntityCombatTracker1_21_R4.java │ │ │ ├── EntityController1_21_R4.java │ │ │ ├── EntityGossipContainer1_21_R4.java │ │ │ ├── EntityNavigation1_21_R4.java │ │ │ ├── EntityScheduleManager1_21_R4.java │ │ │ ├── EntitySenses1_21_R4.java │ │ │ ├── NavigationPath1_21_R4.java │ │ │ ├── Sensor1_21_R4.java │ │ │ └── SensorDefault1_21_R4.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_21_R4 │ │ ├── OptimizedSmallEnumSet1_21_R4.java │ │ └── TestChipUtil1_21_R4.java ├── 1_21_R5 │ ├── build.gradle.kts │ └── src │ │ ├── main │ │ └── java │ │ │ └── me │ │ │ └── gamercoder215 │ │ │ └── mobchip │ │ │ └── abstraction │ │ │ └── v1_21_R5 │ │ │ ├── Attribute1_21_R5.java │ │ │ ├── AttributeInstance1_21_R5.java │ │ │ ├── BehaviorResult1_21_R5.java │ │ │ ├── ChipUtil1_21_R5.java │ │ │ ├── CustomGoal1_21_R5.java │ │ │ ├── DragonPhase1_21_R5.java │ │ │ ├── EntityBody1_21_R5.java │ │ │ ├── EntityCombatTracker1_21_R5.java │ │ │ ├── EntityController1_21_R5.java │ │ │ ├── EntityGossipContainer1_21_R5.java │ │ │ ├── EntityNavigation1_21_R5.java │ │ │ ├── EntityScheduleManager1_21_R5.java │ │ │ ├── EntitySenses1_21_R5.java │ │ │ ├── NavigationPath1_21_R5.java │ │ │ ├── Sensor1_21_R5.java │ │ │ └── SensorDefault1_21_R5.java │ │ └── test │ │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_21_R5 │ │ ├── OptimizedSmallEnumSet1_21_R5.java │ │ └── TestChipUtil1_21_R5.java └── 1_21_R6 │ ├── build.gradle.kts │ └── src │ ├── main │ └── java │ │ └── me │ │ └── gamercoder215 │ │ └── mobchip │ │ └── abstraction │ │ └── v1_21_R6 │ │ ├── Attribute1_21_R6.java │ │ ├── AttributeInstance1_21_R6.java │ │ ├── BehaviorResult1_21_R6.java │ │ ├── ChipUtil1_21_R6.java │ │ ├── CustomGoal1_21_R6.java │ │ ├── DragonPhase1_21_R6.java │ │ ├── EntityBody1_21_R6.java │ │ ├── EntityCombatTracker1_21_R6.java │ │ ├── EntityController1_21_R6.java │ │ ├── EntityGossipContainer1_21_R6.java │ │ ├── EntityNavigation1_21_R6.java │ │ ├── EntityScheduleManager1_21_R6.java │ │ ├── EntitySenses1_21_R6.java │ │ ├── NavigationPath1_21_R6.java │ │ ├── Sensor1_21_R6.java │ │ └── SensorDefault1_21_R6.java │ └── test │ └── java │ └── me │ └── gamercoder215 │ └── mobchip │ └── abstraction │ └── v1_21_R6 │ ├── OptimizedSmallEnumSet1_21_R6.java │ └── TestChipUtil1_21_R6.java └── settings.gradle.kts /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | /gradlew text eol=lf 3 | *.bat text eol=crlf 4 | 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: SpigotMC Thread 4 | url: https://www.spigotmc.org/threads/mobchip-entity-ai-wrapper-pathfinders-controllers-and-more.556441/ 5 | about: Read about MobChip! 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.yml: -------------------------------------------------------------------------------- 1 | name: Feature Request 2 | description: Request an addition or removal of MobChip. 3 | labels: [enhancement] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thank you for suggesting a MobChip feature. Please fill out the information below. 9 | - type: dropdown 10 | attributes: 11 | label: Feature Type 12 | description: What area of improvement would you suggest? 13 | multiple: false 14 | options: 15 | - Optimization 16 | - Compatibility 17 | - Other 18 | validations: 19 | required: true 20 | - type: textarea 21 | attributes: 22 | label: Description of Feature 23 | placeholder: | 24 | Ex: Please add support for Minecraft 1.xx.x 25 | validations: 26 | required: true -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gradle" 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | - package-ecosystem: "github-actions" 8 | directory: "/" 9 | schedule: 10 | interval: "daily" -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Info 2 | _This PR closes #xxxx._ 3 | 4 | ## Details 5 | _I want x to be added because y doesn't work._ 6 | 7 | ## Tested Environments 8 | 9 | ### Java / Minecraft 10 | 11 | #### MC Builds 12 | - [ ] Tested on Latest Spigot Version 13 | - [ ] Tested on Latest Paper / Purpur Version 14 | 15 | #### JDK Builds 16 | Tested on: 17 | - [ ] JDK Version 17 18 | - [ ] JDK Version 21 19 | 20 | ## Demonstration 21 | _Screenshots or any other info, if you please._ 22 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | Contributing guidelines for the MobChip Project. We appreciate your help in helping us to improve the project. 3 | 4 | ## Pull Request Process 5 | 1. Ensure that the pull request is at the correct branch you want to merge in. 6 | 2. Ensure that your new code has been tested on a Maven Compiler, your specified Minecraft Version(s) and JDK 8. 7 | 3. Confirm that the code is ready to be merged along with any documentation you intend to include. 8 | 9 | We will approve and merge your pull request as soon as possible if these requirements are met. -------------------------------------------------------------------------------- /abstraction/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api(project(":mobchip-base")) 3 | compileOnly("org.spigotmc:spigot-api:1.13-R0.1-SNAPSHOT") 4 | } -------------------------------------------------------------------------------- /abstraction/src/main/java/me/gamercoder215/mobchip/bukkit/BukkitCreatureBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import me.gamercoder215.mobchip.ai.behavior.CreatureBehavior; 5 | import org.bukkit.Bukkit; 6 | import org.bukkit.entity.Creature; 7 | import org.bukkit.entity.LivingEntity; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | import java.util.UUID; 11 | import java.util.function.Function; 12 | 13 | class BukkitCreatureBehavior extends BukkitEntityBehavior implements CreatureBehavior { 14 | 15 | final Creature m; 16 | 17 | BukkitCreatureBehavior(Creature c) { 18 | super(c); 19 | this.m = c; 20 | } 21 | 22 | @Override 23 | public @NotNull BehaviorResult panic(float speedMod) { 24 | return run("AnimalPanic", speedMod); 25 | } 26 | 27 | @Override 28 | public @NotNull BehaviorResult followTemptation(@NotNull Function speedModifier) { 29 | notNull(speedModifier, "Speed Modifier cannot be null"); 30 | return run("FollowTemptation", (Function) f -> speedModifier.apply((LivingEntity) Bukkit.getEntity(f))); 31 | } 32 | 33 | @Override 34 | public @NotNull BehaviorResult tryFindWater(int range, float speedMod) { 35 | return run("TryFindWater", range, speedMod); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /abstraction/src/main/java/me/gamercoder215/mobchip/bukkit/BukkitDragonBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit; 2 | 3 | import me.gamercoder215.mobchip.abstraction.ChipUtil; 4 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 5 | import me.gamercoder215.mobchip.ai.behavior.DragonBehavior; 6 | import org.bukkit.entity.EnderDragon; 7 | import org.bukkit.entity.Entity; 8 | import org.bukkit.entity.Mob; 9 | import org.jetbrains.annotations.NotNull; 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | import java.util.List; 13 | 14 | import static me.gamercoder215.mobchip.abstraction.ChipUtil.getWrapper; 15 | 16 | public class BukkitDragonBehavior extends BukkitEntityBehavior implements DragonBehavior { 17 | 18 | final EnderDragon m; 19 | 20 | private static final ChipUtil wrapper = getWrapper(); 21 | 22 | public BukkitDragonBehavior(EnderDragon m) { 23 | super((Mob) m); 24 | this.m = m; 25 | } 26 | 27 | @Override 28 | public @NotNull BehaviorResult naturalKnockback(@Nullable List entities) { 29 | if (entities == null) return BehaviorResult.STOPPED; 30 | wrapper.knockback(m, entities); 31 | return BehaviorResult.STOPPED; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /abstraction/src/main/java/me/gamercoder215/mobchip/bukkit/BukkitUpdatableCreatureBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit; 2 | 3 | import me.gamercoder215.mobchip.ai.schedule.Updatable; 4 | import org.bukkit.entity.Creature; 5 | 6 | class BukkitUpdatableCreatureBehavior extends BukkitCreatureBehavior implements Updatable { 7 | 8 | BukkitUpdatableCreatureBehavior(Creature c) { 9 | super(c); 10 | } 11 | 12 | @Override 13 | public void updateActivities() { 14 | wrapper.updateActivities(m); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /base/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | 3 | dependencies { 4 | compileOnly("org.spigotmc:spigot-api:1.13-R0.1-SNAPSHOT") 5 | } 6 | 7 | java { 8 | withSourcesJar() 9 | withJavadocJar() 10 | } 11 | 12 | tasks { 13 | javadoc { 14 | enabled = true 15 | 16 | options { 17 | require(this is StandardJavadocDocletOptions) 18 | 19 | links("https://hub.spigotmc.org/javadocs/spigot/") 20 | // links("https://javadoc.io/doc/org.jetbrains/annotations-java5/23.0.0/") // as of 2025/10/02 this randomly returns 403 21 | } 22 | } 23 | 24 | withType { 25 | dependsOn("sourcesJar", "javadocJar") 26 | } 27 | } -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/DragonBrain.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip; 2 | 3 | import me.gamercoder215.mobchip.ai.enderdragon.CustomPhase; 4 | import me.gamercoder215.mobchip.ai.enderdragon.DragonPhase; 5 | import org.bukkit.entity.EnderCrystal; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | /** 10 | * Represents a special EntityBrain for Ender Dragons. 11 | */ 12 | public interface DragonBrain extends EntityBrain { 13 | 14 | /** 15 | * Sets the current custom phase of the Ender Dragon. 16 | * @param phase Custom Phase to use. 17 | * @throws IllegalArgumentException if phase is null 18 | */ 19 | void setCustomPhase(@NotNull CustomPhase phase) throws IllegalArgumentException; 20 | 21 | /** 22 | * Fetches the nearest ender crystal that is currently healing this Ender Dragon. 23 | * @return EnderCrystal healing this EnderDragon, may be null 24 | */ 25 | @Nullable 26 | EnderCrystal getNearestCrystal(); 27 | 28 | /** 29 | * Fetches the current DragonPhase of the Ender Dragon. 30 | * @return Current DragonPhase of the Ender Dragon. 31 | */ 32 | @NotNull 33 | DragonPhase getCurrentPhase(); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/VillagerBrain.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip; 2 | 3 | import me.gamercoder215.mobchip.ai.gossip.EntityGossipContainer; 4 | import org.bukkit.entity.Villager; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Special Brain for a Villager 9 | */ 10 | public interface VillagerBrain extends EntityBrain { 11 | 12 | /** 13 | * Fetches this Villager's Gossip Container 14 | * @return Gossip Container 15 | */ 16 | @NotNull 17 | EntityGossipContainer getGossipContainer(); 18 | 19 | @Override 20 | @NotNull 21 | Villager getEntity(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/Probable.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai; 2 | 3 | /** 4 | * Represents a Pathfinder that has a chance of succeeding 5 | *

6 | * The range must be between 0F and 1F. 7 | */ 8 | public interface Probable { 9 | 10 | /** 11 | * Get the current probability of this Pathfinder. 12 | * @return Probability of this Pathfinder happening 13 | */ 14 | float getProbability(); 15 | 16 | /** 17 | * Sets the current probability of this Pathfinder. 18 | * @param prob Probability to set 19 | */ 20 | void setProbability(float prob); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/SpeedModifier.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai; 2 | 3 | /** 4 | * Represents a Pathfinder that has a speed modifier 5 | *

6 | * The number from {@link #getSpeedModifier()} will be multiplied by the original speed. 7 | *

8 | * Ex: A Sheep with an AvoidGoal with a movement speed of 0.5, if the speed modifier is 2 then the sheep will move twice as fast or at a movement speed attribute of 1. 9 | */ 10 | public interface SpeedModifier { 11 | 12 | /** 13 | * Default Speed Modifier 14 | */ 15 | float DEFAULT_SPEED_MODIFIER = 1.5F; 16 | 17 | /** 18 | * Get the Speed Modifier of this Pathfinder. 19 | * @return Speed Modifier 20 | */ 21 | double getSpeedModifier(); 22 | 23 | /** 24 | * Sets the Speed Modifier of this Pathfinder. 25 | * @param mod Modifier to set 26 | */ 27 | void setSpeedModifier(double mod); 28 | } 29 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/animation/EntityAnimation.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.animation; 2 | 3 | import org.bukkit.Keyed; 4 | import org.bukkit.NamespacedKey; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | /** 9 | * Represents an Entity Animation 10 | */ 11 | public enum EntityAnimation implements Keyed { 12 | 13 | /** 14 | * Represents the Damage Animation when taking damage 15 | */ 16 | DAMAGE("hurt"), 17 | /** 18 | * Represents the Damage Animation when taking damage on a critical hit 19 | */ 20 | CRITICAL_DAMAGE("critical_hit"), 21 | /** 22 | * Represents the Damage Animation when taking damage on a magical critical hit 23 | */ 24 | MAGICAL_CRITICAL_DAMAGE("magic_critical_hit"), 25 | /** 26 | * Represents the Mob's Spawning Animation 27 | */ 28 | SPAWN("spawn"), 29 | ; 30 | 31 | private final NamespacedKey key; 32 | 33 | EntityAnimation(String key) { 34 | this.key = NamespacedKey.minecraft(key); 35 | } 36 | 37 | 38 | @Override 39 | @NotNull 40 | public NamespacedKey getKey() { return this.key; } 41 | 42 | /** 43 | * Fetches an EntityAnimation by its NamespacedKey. 44 | * @param key Key to fetch 45 | * @return EntityAnimation found, or null if not found 46 | */ 47 | @Nullable 48 | public static EntityAnimation getByKey(@Nullable NamespacedKey key) { 49 | if (key == null) return null; 50 | for (EntityAnimation a : values()) { 51 | if (a.getKey().equals(key)) return a; 52 | } 53 | 54 | return null; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/attribute/Attribute.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.attribute; 2 | 3 | import org.bukkit.Keyed; 4 | 5 | /** 6 | * Represents an ordinary Attribute of a Mob 7 | */ 8 | public interface Attribute extends Keyed { 9 | 10 | /** 11 | * Fetches the minimum value of this Attribute. 12 | * @return Minimum value 13 | */ 14 | double getMinValue(); 15 | 16 | /** 17 | * Fetches the maximum value of this Attribute 18 | * @return Maximum value 19 | */ 20 | double getMaxValue(); 21 | 22 | /** 23 | * Fetches the Default value of this Attribute 24 | * @return Default value 25 | */ 26 | double getDefaultValue(); 27 | 28 | /** 29 | * Whether this Attribute will sync and appear on the client's side. 30 | * @return true if also client side, else false 31 | */ 32 | boolean isClientSide(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/attribute/AttributeInstance.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.attribute; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Represents a custom Attribute Instance of a Mob 7 | */ 8 | public interface AttributeInstance extends org.bukkit.attribute.AttributeInstance { 9 | 10 | /** 11 | * @deprecated Use {@link #getGenericAttribute()} to get the actual Attribute. 12 | * @return null 13 | */ 14 | @Deprecated 15 | default org.bukkit.attribute.Attribute getAttribute() { 16 | return null; 17 | } 18 | 19 | /** 20 | * The attribute pertaining to this instance. 21 | * @return the attribute 22 | */ 23 | @NotNull 24 | Attribute getGenericAttribute(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/behavior/AllayBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.behavior; 2 | 3 | import me.gamercoder215.mobchip.ai.schedule.Updatable; 4 | import org.bukkit.Location; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents Behavior for an Allay 9 | */ 10 | public interface AllayBehavior extends CreatureBehavior, Updatable { 11 | 12 | /** 13 | * Makes this Allay listen to a Note Block. 14 | *

This behavior does not require any memories.

15 | * @param loc Location of the Note Block 16 | * @return Result of Behavior 17 | */ 18 | @NotNull 19 | BehaviorResult hearNoteblock(@NotNull Location loc); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/behavior/AxolotlBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.behavior; 2 | 3 | import me.gamercoder215.mobchip.ai.memories.EntityMemory; 4 | import me.gamercoder215.mobchip.ai.schedule.Updatable; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents Behavior for an Axolotl 9 | */ 10 | public interface AxolotlBehavior extends CreatureBehavior, Updatable { 11 | 12 | /** 13 | * Makes this Axolotl Play Dead. 14 | *

This behavior requires {@link EntityMemory#TICKS_PLAY_DEAD} and {@link EntityMemory#LAST_HURT_ENTITY} to be present in the brain.

15 | * @return Result of Behavior 16 | */ 17 | @NotNull 18 | BehaviorResult playDead(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/behavior/BehaviorResult.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.behavior; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Represents a Behavior Result 7 | */ 8 | public abstract class BehaviorResult { 9 | 10 | /** 11 | * Represents a stopped BehaviorResult. 12 | */ 13 | public static final BehaviorResult STOPPED = new BehaviorResult() { 14 | @Override 15 | public @NotNull Status getStatus() { 16 | return Status.STOPPED; 17 | } 18 | @Override 19 | public void stop() { 20 | // Do nothing 21 | } 22 | }; 23 | 24 | /** 25 | * Constructs an Abstract Behavior Result. 26 | */ 27 | protected BehaviorResult() {} 28 | 29 | /** 30 | * Fetches the Status of this BehaviorResult. 31 | * @return Behavior Status 32 | */ 33 | @NotNull 34 | public abstract Status getStatus(); 35 | 36 | /** 37 | * Forces this Behavior to stop. 38 | */ 39 | public abstract void stop(); 40 | 41 | /** 42 | * Represents a Behavior Status 43 | */ 44 | public enum Status { 45 | /** 46 | * Represents that this Behavior has stopped running. 47 | */ 48 | STOPPED, 49 | /** 50 | * Represents that this Behavior is running. 51 | */ 52 | RUNNING; 53 | 54 | Status() {} 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/behavior/BreezeBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.behavior; 2 | 3 | import me.gamercoder215.mobchip.ai.memories.EntityMemory; 4 | import me.gamercoder215.mobchip.ai.schedule.Updatable; 5 | 6 | /** 7 | * Represents Behavior for a Breeze 8 | */ 9 | public interface BreezeBehavior extends CreatureBehavior, Updatable { 10 | 11 | /** 12 | * Performs a Breeze Long Jump. 13 | *

This behavior requires {@link EntityMemory#ATTACK_TARGET} to be present in the brain.

14 | */ 15 | void longJump(); 16 | 17 | /** 18 | * Performs a Breeze Shooting Attack. 19 | *

This behavior requires {@link EntityMemory#ATTACK_TARGET} to be present in the brain.

20 | */ 21 | void shoot(); 22 | 23 | /** 24 | * Performs a Breeze Slide. 25 | *

This behavior requires {@link EntityMemory#ATTACK_TARGET} to be present in the brain.

26 | */ 27 | void slide(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/behavior/CamelBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.behavior; 2 | 3 | import me.gamercoder215.mobchip.ai.schedule.Updatable; 4 | 5 | /** 6 | * Represents Entity Behaviors for a Camel 7 | */ 8 | public interface CamelBehavior extends CreatureBehavior, Updatable { 9 | 10 | /** 11 | * Makes this Camel sit. 12 | *

This behavior does not require any memories.

13 | * @param minimalPoseTicks The minimum amount of ticks this camel should sit for 14 | */ 15 | void sit(int minimalPoseTicks); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/behavior/DragonBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.behavior; 2 | 3 | import org.bukkit.entity.Entity; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Represents Entity Behaviors for an Ender Dragon 11 | */ 12 | public interface DragonBehavior extends EntityBehavior { 13 | 14 | /** 15 | * Makes this Ender Dragon perform a natural knockback with its wings when Entities get too close. 16 | *

This behavior does not require any memories.

17 | * @param entities List of Entities to knock back 18 | * @return Result of Behavior 19 | */ 20 | @NotNull 21 | BehaviorResult naturalKnockback(@Nullable List entities); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/behavior/FrogBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.behavior; 2 | 3 | import me.gamercoder215.mobchip.ai.memories.EntityMemory; 4 | import me.gamercoder215.mobchip.ai.schedule.Updatable; 5 | import org.bukkit.Sound; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | /** 9 | * Represents Behaviors for a Frog 10 | */ 11 | public interface FrogBehavior extends CreatureBehavior, Updatable { 12 | 13 | /** 14 | * Makes this frog shoot its tongue. 15 | *

This behavior requires {@link EntityMemory#WALKING_TARGET} and {@link EntityMemory#IS_PANICKING} to be absent, {@link EntityMemory#LOOKING_TARGET} to be registered, and {@link EntityMemory#ATTACK_TARGET} to be present.

16 | * @param tongueSound Sound to make when tongue is shot 17 | * @param eatSound Sound to make when a frog eats something 18 | * @return Result of Behavior 19 | */ 20 | @NotNull 21 | BehaviorResult shootTongue(Sound tongueSound, Sound eatSound); 22 | 23 | /** 24 | * Makes this frog Croak. 25 | *

This behavior requires {@link EntityMemory#WALKING_TARGET} to be absent.

26 | * @return Result of Behavior 27 | */ 28 | @NotNull 29 | BehaviorResult croak(); 30 | } 31 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/controller/NaturalMoveType.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.controller; 2 | 3 | /** 4 | * Represents a Natural Moving Type. 5 | */ 6 | public enum NaturalMoveType { 7 | 8 | /** 9 | * A Natural Movement Type that represents the entity moving on its own. 10 | */ 11 | SELF, 12 | /** 13 | * A Natural Movement Type that represents the entity moving when pushed by a player. 14 | */ 15 | PLAYER, 16 | /** 17 | * A Natural Movement Type that represents the entity moving when pushed by a piston. 18 | */ 19 | PISTON, 20 | /** 21 | * A Natural Movement Type that represents the entity moving when pushed by a shulker box. 22 | */ 23 | SHULKER_BOX, 24 | /** 25 | * A Natural Movement Type that represents the entity moving when pushed with a Shulker Bullet. 26 | */ 27 | SHULKER 28 | 29 | } 30 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/Conditional.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.function.Predicate; 6 | 7 | /** 8 | * Represents a Conditional State for this Pathfinder to work 9 | * @param Type of Condition to resolve 10 | */ 11 | public interface Conditional { 12 | 13 | /** 14 | * Sets the Condition of this Conditional Pathfinder. 15 | * @return Predicate of Condition 16 | */ 17 | @NotNull 18 | Predicate getCondition(); 19 | 20 | /** 21 | * Sets the Condition of this Conditional Pathfinder. 22 | * @param condition Condition to set 23 | */ 24 | void setCondition(@NotNull Predicate condition); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderBeg.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Wolf; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for Wolf Begging 8 | */ 9 | public final class PathfinderBeg extends Pathfinder implements Ranged { 10 | 11 | private float lookRange; 12 | 13 | /** 14 | * Constructs a PathfinderBeg with the default look range. 15 | * @param w Wolf to use 16 | */ 17 | public PathfinderBeg(@NotNull Wolf w) { 18 | this(w, DEFAULT_LOOK_RANGE); 19 | } 20 | 21 | /** 22 | * Constructs a PathfinderBeg. 23 | * @param w Wolf to use 24 | * @param lookRange looking range of the wolf 25 | */ 26 | public PathfinderBeg(@NotNull Wolf w, float lookRange) { 27 | super(w); 28 | this.lookRange = lookRange; 29 | } 30 | 31 | @Override 32 | public @NotNull Wolf getEntity() { return (Wolf) entity; } 33 | 34 | /** 35 | * Get the look range of this PathfinderBeg. 36 | */ 37 | @Override 38 | public float getRange() { 39 | return this.lookRange; 40 | } 41 | 42 | /** 43 | * Sets the look range of this PathfinderBeg. 44 | */ 45 | @Override 46 | public void setRange(float range) { 47 | this.lookRange = range; 48 | } 49 | 50 | @Override 51 | public @NotNull PathfinderFlag[] getFlags() { 52 | return new PathfinderFlag[] { PathfinderFlag.LOOKING }; 53 | } 54 | 55 | @Override 56 | public String getInternalName() { return "PathfinderGoalBeg"; } 57 | } 58 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderBreathAir.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Creature; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder to Breath Air 8 | */ 9 | public final class PathfinderBreathAir extends Pathfinder { 10 | 11 | /** 12 | * Constructs a PathfinderBreathAir. 13 | * @param c Creature to use 14 | */ 15 | public PathfinderBreathAir(@NotNull Creature c) { 16 | super(c); 17 | } 18 | 19 | @Override 20 | public @NotNull Creature getEntity() { return (Creature) entity; } 21 | 22 | @Override 23 | public @NotNull PathfinderFlag[] getFlags() { 24 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT, PathfinderFlag.LOOKING }; 25 | } 26 | 27 | @Override 28 | public String getInternalName() { return "PathfinderGoalBreath"; } 29 | } 30 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderBreed.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import me.gamercoder215.mobchip.ai.SpeedModifier; 4 | import org.bukkit.entity.Animals; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder that causes Animals to breed 9 | */ 10 | public final class PathfinderBreed extends Pathfinder implements SpeedModifier { 11 | 12 | private double speedMod; 13 | 14 | /** 15 | * Constructs a PathfinderBreed with no speed modifier. 16 | * @param m Animal to use 17 | */ 18 | public PathfinderBreed(@NotNull Animals m) { 19 | this(m, 1); 20 | } 21 | 22 | /** 23 | * Constructs a PathfinderBreed. 24 | * @param m Animal to use 25 | * @param speedMod Speed Modifier while breeding 26 | */ 27 | public PathfinderBreed(@NotNull Animals m, double speedMod) { 28 | super(m); 29 | this.speedMod = speedMod; 30 | } 31 | 32 | @Override 33 | public @NotNull Animals getEntity() { return (Animals) entity; } 34 | 35 | @Override 36 | public double getSpeedModifier() { 37 | return this.speedMod; 38 | } 39 | 40 | @Override 41 | public void setSpeedModifier(double mod) { 42 | this.speedMod = mod; 43 | } 44 | 45 | @Override 46 | public @NotNull PathfinderFlag[] getFlags() { 47 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT, PathfinderFlag.LOOKING }; 48 | } 49 | 50 | @Override 51 | public String getInternalName() { return "PathfinderGoalBreed"; } 52 | } 53 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderClimbPowderedSnow.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.World; 4 | import org.bukkit.entity.Mob; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder to climb on Powdered Snow 9 | */ 10 | public final class PathfinderClimbPowderedSnow extends Pathfinder implements WorldSpecific { 11 | 12 | private World w; 13 | 14 | /** 15 | * Constructs a PathfinderClimbPowderedSnow with the current world. 16 | * @param m Mob to use 17 | */ 18 | public PathfinderClimbPowderedSnow(@NotNull Mob m) { 19 | this(m, m.getWorld()); 20 | } 21 | 22 | /** 23 | * Constructs a PathfinderClimbPowderedSnow. 24 | * @param m Mob to use 25 | * @param w World to use 26 | * @throws IllegalArgumentException if world is null 27 | */ 28 | public PathfinderClimbPowderedSnow(@NotNull Mob m, @NotNull World w) throws IllegalArgumentException { 29 | super(m); 30 | if (w == null) throw WorldSpecific.WORLD_NULL; 31 | this.w = w; 32 | } 33 | 34 | @Override 35 | public @NotNull World getWorld() { 36 | return this.w; 37 | } 38 | 39 | @Override 40 | public void setWorld(@NotNull World w) throws IllegalArgumentException { 41 | if (w == null) throw WorldSpecific.WORLD_NULL; 42 | this.w = w; 43 | } 44 | 45 | @Override 46 | public @NotNull PathfinderFlag[] getFlags() { 47 | return new PathfinderFlag[] { PathfinderFlag.JUMPING}; 48 | } 49 | 50 | @Override 51 | public String getInternalName() { return "ClimbOnTopOfPowderSnowGoal"; } 52 | } -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderDolphinJump.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Dolphin; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder that makes Dolphins Jump 8 | */ 9 | public final class PathfinderDolphinJump extends Pathfinder implements Repeated { 10 | 11 | private int interval; 12 | 13 | /** 14 | * Constructs a PathfinderDolphinJump. 15 | * @param d Dolphin to use 16 | * @param interval Interval to use 17 | * @throws IllegalArgumentException if less than 0 18 | */ 19 | public PathfinderDolphinJump(@NotNull Dolphin d, int interval) throws IllegalArgumentException { 20 | super(d); 21 | 22 | if (interval < 0) throw new IllegalArgumentException("Interval must be greater than 0"); 23 | this.interval = interval; 24 | } 25 | 26 | /** 27 | * Get the current interval of jump time 28 | * @return current interval of jump time 29 | */ 30 | public int getInterval() { 31 | return this.interval; 32 | } 33 | 34 | 35 | @Override 36 | public void setInterval(int interval) throws IllegalArgumentException { 37 | if (interval < 0) throw new IllegalArgumentException("Must be greater than 0"); 38 | this.interval = interval; 39 | } 40 | 41 | @Override 42 | public @NotNull PathfinderFlag[] getFlags() { 43 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT, PathfinderFlag.JUMPING }; 44 | } 45 | 46 | @Override 47 | public String getInternalName() { return "PathfinderGoalWaterJump"; } 48 | } 49 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderEatTile.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Mob; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for a Mob to eat a tile 8 | */ 9 | public final class PathfinderEatTile extends Pathfinder { 10 | 11 | /** 12 | * Constructs a PathfinderEatTile. 13 | * @param m Mob to use 14 | */ 15 | public PathfinderEatTile(@NotNull Mob m) { 16 | super(m); 17 | } 18 | 19 | @Override 20 | public @NotNull PathfinderFlag[] getFlags() { 21 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT, PathfinderFlag.JUMPING, PathfinderFlag.LOOKING}; 22 | } 23 | 24 | @Override 25 | public String getInternalName() { return "PathfinderGoalEatTile"; } 26 | } 27 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderFindWater.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Creature; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for a Creature to try and find water 8 | */ 9 | public final class PathfinderFindWater extends Pathfinder { 10 | 11 | /** 12 | * Constructs a PathfinderFindWater. 13 | * @param m Creature to use 14 | */ 15 | public PathfinderFindWater(@NotNull Creature m) { 16 | super(m); 17 | } 18 | 19 | @Override 20 | public @NotNull PathfinderFlag[] getFlags() { 21 | return new PathfinderFlag[0]; 22 | } 23 | 24 | @Override 25 | public String getInternalName() { return "PathfinderGoalWater"; } 26 | } 27 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderFleeSun.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import me.gamercoder215.mobchip.ai.SpeedModifier; 4 | import org.bukkit.entity.Creature; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder for a Creature to avoid the sun or to extinguish a fire. 9 | *

10 | * This is an advanced version of {@link PathfinderRestrictSun}. The other pathfinder will only have the Creature avoid the sun, with not speed modifier included. 11 | */ 12 | public final class PathfinderFleeSun extends Pathfinder implements SpeedModifier { 13 | 14 | private double speedMod; 15 | /** 16 | * Creates a PathfinderFleeSun with a default speed modifier. 17 | * @param m Creature to use 18 | */ 19 | public PathfinderFleeSun(@NotNull Creature m) { 20 | this(m, DEFAULT_SPEED_MODIFIER); 21 | } 22 | 23 | /** 24 | * Creates a PathfinderFleeSun. 25 | * @param m Creature to use 26 | * @param speedMod Speed Modifier of fleeing 27 | */ 28 | public PathfinderFleeSun(@NotNull Creature m, double speedMod) { 29 | super(m); 30 | 31 | this.speedMod = speedMod; 32 | } 33 | 34 | @Override 35 | public double getSpeedModifier() { 36 | return this.speedMod; 37 | } 38 | 39 | @Override 40 | public void setSpeedModifier(double mod) { 41 | this.speedMod = mod; 42 | } 43 | 44 | @Override 45 | public @NotNull PathfinderFlag[] getFlags() { 46 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT}; 47 | } 48 | 49 | @Override 50 | public String getInternalName() { return "PathfinderGoalFleeSun"; } 51 | } 52 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderFloat.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Mob; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder that mobs need to float on water 8 | */ 9 | public final class PathfinderFloat extends Pathfinder { 10 | 11 | /** 12 | * Construct a PathfinderFloat 13 | * @param entity Mob to use 14 | */ 15 | public PathfinderFloat(@NotNull Mob entity) { 16 | super(entity); 17 | } 18 | 19 | @Override 20 | public @NotNull PathfinderFlag[] getFlags() { 21 | return new PathfinderFlag[] { PathfinderFlag.JUMPING }; 22 | } 23 | 24 | 25 | @Override 26 | public String getInternalName() { 27 | return "PathfinderGoalFloat"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderFollowBoat.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Creature; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for a Creature to follow a Boat 8 | */ 9 | public final class PathfinderFollowBoat extends Pathfinder { 10 | 11 | /** 12 | * Constructs a PathfinderFollowBoat. 13 | * @param c Creature to use 14 | */ 15 | public PathfinderFollowBoat(@NotNull Creature c) { 16 | super(c); 17 | } 18 | 19 | @Override 20 | public @NotNull PathfinderFlag[] getFlags() { 21 | return new PathfinderFlag[0]; 22 | } 23 | 24 | @Override 25 | public String getInternalName() { 26 | return "PathfinderGoalFollowBoat"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderFollowFishLeader.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Fish; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for a Cod / Salmon / Tropical Fish to follow its school leader 8 | */ 9 | public final class PathfinderFollowFishLeader extends Pathfinder { 10 | /** 11 | * Constructs a PathfinderFollowFishLeader. 12 | * @param f Fish to use 13 | */ 14 | public PathfinderFollowFishLeader(@NotNull Fish f) { 15 | super(f); 16 | } 17 | 18 | 19 | @Override 20 | public @NotNull PathfinderFlag[] getFlags() { 21 | return new PathfinderFlag[0]; 22 | } 23 | 24 | @Override 25 | public String getInternalName() { 26 | return "PathfinderGoalFishSchool"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderFollowParent.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import me.gamercoder215.mobchip.ai.SpeedModifier; 4 | import org.bukkit.entity.Animals; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder for a baby version of a mob to follow an adult version of a mob 9 | */ 10 | public final class PathfinderFollowParent extends Pathfinder implements SpeedModifier { 11 | 12 | private double speedMod; 13 | 14 | /** 15 | * Creates a PathfinderFollowParent with no speed modifier. 16 | * @param m Animal to use 17 | */ 18 | public PathfinderFollowParent(@NotNull Animals m) { 19 | this(m, 1); 20 | } 21 | 22 | /** 23 | * Creates a PathfinderFollowParent. 24 | * @param m Animal to use 25 | * @param speedMod Speed Modifier while following 26 | */ 27 | public PathfinderFollowParent(@NotNull Animals m, double speedMod) { 28 | super(m); 29 | 30 | this.speedMod = speedMod; 31 | } 32 | 33 | @Override 34 | public double getSpeedModifier() { 35 | return this.speedMod; 36 | } 37 | 38 | @Override 39 | public void setSpeedModifier(double mod) { 40 | this.speedMod = mod; 41 | } 42 | 43 | @Override 44 | public @NotNull PathfinderFlag[] getFlags() { 45 | return new PathfinderFlag[0]; 46 | } 47 | 48 | @Override 49 | public String getInternalName() { 50 | return "PathfinderGoalFollowParent"; 51 | } 52 | } -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderInfo.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.jetbrains.annotations.ApiStatus; 4 | 5 | /** 6 | * Represents information about a Pathfinder 7 | */ 8 | public interface PathfinderInfo { 9 | 10 | /** 11 | * Returns this Pathfinder's Name. 12 | * @return Pathfinder Name 13 | */ 14 | default String getName() { 15 | return getClass().getSimpleName(); 16 | } 17 | 18 | /** 19 | * Returns the NMS Internal Name. 20 | * @return Internal Name 21 | */ 22 | @ApiStatus.Internal 23 | String getInternalName(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderLeapAtTarget.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Mob; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for a Mob to leap at its target 8 | */ 9 | public final class PathfinderLeapAtTarget extends Pathfinder { 10 | 11 | private float height; 12 | 13 | /** 14 | * Constructs a PathfinderLeapAtTarget with a Y of 3. 15 | * @param m Mob to use 16 | */ 17 | public PathfinderLeapAtTarget(@NotNull Mob m) { 18 | this(m, 3); 19 | } 20 | 21 | @Override 22 | public @NotNull PathfinderFlag[] getFlags() { 23 | return new PathfinderFlag[] { PathfinderFlag.JUMPING, PathfinderFlag.MOVEMENT }; 24 | } 25 | 26 | /** 27 | * Constructs a PathfinderLeapAtTarget. 28 | * @param m Mob to use 29 | * @param y Height to use while leaping 30 | */ 31 | public PathfinderLeapAtTarget(@NotNull Mob m, float y) { 32 | super(m); 33 | this.height = y; 34 | } 35 | 36 | /** 37 | * Fetches the Y value height while leaping. 38 | * @return Y value height 39 | */ 40 | public float getHeight() { 41 | return this.height; 42 | } 43 | 44 | /** 45 | * Sets the Y value height while leaping. 46 | * @param height New Y Value Height 47 | */ 48 | public void setHeight(float height) { 49 | this.height = height; 50 | } 51 | 52 | @Override 53 | public String getInternalName() { 54 | return "PathfinderGoalLeapAtTarget"; 55 | } 56 | } -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderLlamaFollowCaravan.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import me.gamercoder215.mobchip.ai.SpeedModifier; 4 | import org.bukkit.entity.Llama; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder for a Llama to follow a Caravan 9 | */ 10 | public final class PathfinderLlamaFollowCaravan extends Pathfinder implements SpeedModifier { 11 | 12 | private double speedMod; 13 | 14 | /** 15 | * Constructs a PathfinderLlamaFollowCaravan with no speed modifier. 16 | * @param m Llama to use 17 | */ 18 | public PathfinderLlamaFollowCaravan(@NotNull Llama m) { 19 | this(m, 1); 20 | } 21 | 22 | /** 23 | * Constructs a PathfinderLlamaFollowCaravan. 24 | * @param m Llama to use 25 | * @param speedMod Speed Modifier while following 26 | */ 27 | public PathfinderLlamaFollowCaravan(@NotNull Llama m, double speedMod) { 28 | super(m); 29 | 30 | this.speedMod = speedMod; 31 | } 32 | 33 | @Override 34 | public double getSpeedModifier() { 35 | return this.speedMod; 36 | } 37 | 38 | @Override 39 | public void setSpeedModifier(double mod) { 40 | this.speedMod = mod; 41 | } 42 | 43 | 44 | @Override 45 | public @NotNull PathfinderFlag[] getFlags() { 46 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT }; 47 | } 48 | 49 | @Override 50 | public String getInternalName() { 51 | return "PathfinderGoalLlamaFollow"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderOcelotAttack.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Mob; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for a special Ocelot Attack 8 | */ 9 | public final class PathfinderOcelotAttack extends Pathfinder { 10 | 11 | /** 12 | * Constructs a PathfinderOcelotAttack. 13 | * @param m Ocelot to use 14 | */ 15 | public PathfinderOcelotAttack(@NotNull Mob m) { 16 | super(m); 17 | } 18 | 19 | @Override 20 | public @NotNull PathfinderFlag[] getFlags() { 21 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT, PathfinderFlag.LOOKING }; 22 | } 23 | 24 | @Override 25 | public String getInternalName() { 26 | return "PathfinderGoalOcelotAttack"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderOfferFlower.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.IronGolem; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for an Iron Golem to offer a Villager a flower 8 | */ 9 | public final class PathfinderOfferFlower extends Pathfinder { 10 | 11 | /** 12 | * Constructs a PathfinderOfferFlower. 13 | * @param m Iron Golem to use 14 | */ 15 | public PathfinderOfferFlower(@NotNull IronGolem m) { 16 | super(m); 17 | } 18 | 19 | @Override 20 | public @NotNull PathfinderFlag[] getFlags() { 21 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT, PathfinderFlag.LOOKING }; 22 | } 23 | 24 | @Override 25 | public String getInternalName() { 26 | return "PathfinderGoalOfferFlower"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderOpenDoor.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Mob; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for an entity to open a door 8 | */ 9 | public final class PathfinderOpenDoor extends Pathfinder { 10 | 11 | private boolean close; 12 | 13 | /** 14 | * Constructs a PathfinderOpenDoor that allows closing doors. 15 | * @param m Mob to use 16 | */ 17 | public PathfinderOpenDoor(@NotNull Mob m) { 18 | this(m, true); 19 | } 20 | 21 | @Override 22 | public @NotNull PathfinderFlag[] getFlags() { 23 | return new PathfinderFlag[0]; 24 | } 25 | 26 | /** 27 | * Constructs a PathfinderOpenDoor. 28 | * @param m Mob to use 29 | * @param close Whether this entity should close the door 30 | */ 31 | public PathfinderOpenDoor(@NotNull Mob m, boolean close) { 32 | super(m); 33 | 34 | this.close = close; 35 | } 36 | 37 | /** 38 | * Whether this entity should close the door. 39 | * @return true if close, else false 40 | */ 41 | public boolean mustClose() { 42 | return this.close; 43 | } 44 | 45 | /** 46 | * Sets whether this entity should close the door. 47 | * @param close true if close, else false 48 | */ 49 | public void setMustClose(boolean close) { 50 | this.close = close; 51 | } 52 | 53 | 54 | @Override 55 | public String getInternalName() { 56 | return "PathfinderGoalDoorOpen"; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderPanic.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import me.gamercoder215.mobchip.ai.SpeedModifier; 4 | import org.bukkit.entity.Creature; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder for a Creature to panic when damaged 9 | */ 10 | public final class PathfinderPanic extends Pathfinder implements SpeedModifier { 11 | 12 | private double speedMod; 13 | 14 | /** 15 | * Constructs a PathfinderPanic with {@link SpeedModifier#DEFAULT_SPEED_MODIFIER}. 16 | * @param m Creature to use 17 | */ 18 | public PathfinderPanic(@NotNull Creature m) { 19 | this(m, DEFAULT_SPEED_MODIFIER); 20 | } 21 | 22 | /** 23 | * Constructs a PathfinderPanic. 24 | * @param m Creature to use 25 | * @param speedMod Speed Modifier while panicking 26 | */ 27 | public PathfinderPanic(@NotNull Creature m, double speedMod) { 28 | super(m); 29 | 30 | this.speedMod = speedMod; 31 | } 32 | 33 | @Override 34 | public double getSpeedModifier() { 35 | return this.speedMod; 36 | } 37 | 38 | @Override 39 | public void setSpeedModifier(double mod) { 40 | this.speedMod = mod; 41 | } 42 | 43 | @Override 44 | public @NotNull PathfinderFlag[] getFlags() { 45 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT }; 46 | } 47 | 48 | @Override 49 | public String getInternalName() { 50 | return "PathfinderGoalPanic"; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderRandomLook.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Mob; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for a Mob to randomly look around 8 | */ 9 | public final class PathfinderRandomLook extends Pathfinder { 10 | /** 11 | * Constructs a PathfinderRandomLook. 12 | * @param m Mob to use 13 | */ 14 | public PathfinderRandomLook(@NotNull Mob m) { 15 | super(m); 16 | } 17 | 18 | @Override 19 | public @NotNull PathfinderFlag[] getFlags() { 20 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT, PathfinderFlag.LOOKING }; 21 | } 22 | 23 | @Override 24 | public String getInternalName() { 25 | return "PathfinderGoalRandomLookaround"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderRandomStand.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.AbstractHorse; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | *

Represents a Pathfinder for a Horse-like Mob to randomly stand.

8 | * Only Available in 1.19.3+ Versions 9 | */ 10 | public final class PathfinderRandomStand extends Pathfinder { 11 | 12 | /** 13 | * Constructs a PathfinderRandomStand. 14 | * @param m AbstractHorse to use 15 | */ 16 | public PathfinderRandomStand(@NotNull AbstractHorse m) { 17 | super(m); 18 | } 19 | 20 | @Override 21 | public @NotNull PathfinderFlag[] getFlags() { 22 | return new PathfinderFlag[0]; 23 | } 24 | 25 | @Override 26 | public String getInternalName() { 27 | return "RandomStandGoal"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderRandomStrollFlying.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Creature; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for a Creature to randomly fly 8 | */ 9 | public final class PathfinderRandomStrollFlying extends PathfinderRandomStroll { 10 | 11 | /** 12 | * Constructs a PathfinderRandomStrollFlying with no speed modifier. 13 | * @param c Creature to use 14 | */ 15 | public PathfinderRandomStrollFlying(@NotNull Creature c) { 16 | super(c); 17 | } 18 | 19 | /** 20 | * Constructs a PathfinderRandomStrollFlying. 21 | * @param c Creature to use 22 | * @param speedMod Speed Modifier while flying 23 | */ 24 | public PathfinderRandomStrollFlying(@NotNull Creature c, double speedMod) { 25 | super(c, speedMod); 26 | } 27 | 28 | @Override 29 | public String getInternalName() { return "PathfinderGoalRandomFly"; } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderRandomStrollInVillage.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Creature; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for a Creature to randomly stroll throughout a village 8 | */ 9 | public final class PathfinderRandomStrollInVillage extends PathfinderRandomStroll { 10 | 11 | /** 12 | * Constructs a PathfinderRandomStrollVillage with no speed modifier. 13 | * @param c Creature to use 14 | * @see PathfinderRandomStroll#PathfinderRandomStroll(Creature) 15 | */ 16 | public PathfinderRandomStrollInVillage(@NotNull Creature c) { 17 | super(c); 18 | } 19 | 20 | /** 21 | * Constructs a PathfinderRandomStrollVillage. 22 | * @param c Creature to use 23 | * @param speedMod Speed Modifier to use 24 | * @see PathfinderRandomStroll#PathfinderRandomStroll(Creature, double) 25 | */ 26 | public PathfinderRandomStrollInVillage(@NotNull Creature c, double speedMod) { 27 | super(c, speedMod); 28 | } 29 | 30 | @Override 31 | public String getInternalName() { return "PathfinderGoalStrollVillageGolem"; } 32 | } 33 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderRandomStrollToVillage.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Creature; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder to Randomly Stroll back into a Village 8 | */ 9 | public final class PathfinderRandomStrollToVillage extends PathfinderRandomStroll { 10 | 11 | /** 12 | * Constructs a PathfinderRandomStrollToVillage with no speed modifier. 13 | * @param c Creature to use 14 | * @see PathfinderRandomStroll#PathfinderRandomStroll(Creature) 15 | */ 16 | public PathfinderRandomStrollToVillage(@NotNull Creature c) { 17 | super(c); 18 | } 19 | 20 | /** 21 | * Constructs a PathfinderRandomStrollToVillage. 22 | * @param c Creature to use 23 | * @param speedMod Speed Modifier while strolling 24 | * {@link PathfinderRandomStroll#PathfinderRandomStroll(Creature, double)} 25 | */ 26 | public PathfinderRandomStrollToVillage(@NotNull Creature c, double speedMod) { 27 | super(c, speedMod); 28 | } 29 | 30 | @Override 31 | public String getInternalName() { return "PathfinderGoalStrollVillage"; } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderRestrictSun.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Creature; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for a Creature to avoid the Sun. 8 | *

9 | * This Pathfinder is a more basic version of {@link PathfinderFleeSun}. There is no speed modifier included, and it will only avoid the sun. The other pathfinder will include if the Creature is on fire and if they do not have a helmet, and will also pathfind the entity to the nearest extinguish source. 10 | */ 11 | public final class PathfinderRestrictSun extends Pathfinder { 12 | 13 | /** 14 | * Constructs a PathfinderRestrictSun. 15 | * @param c Creature to use 16 | */ 17 | public PathfinderRestrictSun(@NotNull Creature c) { 18 | super(c); 19 | } 20 | 21 | 22 | @Override 23 | public @NotNull PathfinderFlag[] getFlags() { 24 | return new PathfinderFlag[0]; 25 | } 26 | 27 | @Override 28 | public String getInternalName() { 29 | return "PathfinderGoalRestrictSun"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderRideShoulder.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Parrot; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Pathfinder for Shoulder-Riding Entities, like Parrots, to ride on a Player's shoulder 8 | */ 9 | public final class PathfinderRideShoulder extends Pathfinder { 10 | 11 | /** 12 | * Constructs a PathfinderRideShoulder. 13 | * @param p Parrot to use 14 | */ 15 | public PathfinderRideShoulder(@NotNull Parrot p) { 16 | super(p); 17 | } 18 | 19 | @Override 20 | public @NotNull PathfinderFlag[] getFlags() { 21 | return new PathfinderFlag[0]; 22 | } 23 | 24 | @Override 25 | public String getInternalName() { 26 | return "PathfinderGoalPerch"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderSit.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Animals; 4 | import org.bukkit.entity.Tameable; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder for the logic of a Tamable Animal to sit when told to 9 | */ 10 | public final class PathfinderSit extends Pathfinder { 11 | 12 | /** 13 | * Constructs a PathfinderSit. 14 | * @param m Tamable Animal to use 15 | */ 16 | public PathfinderSit(@NotNull Tameable m) { 17 | super((Animals) m); 18 | } 19 | 20 | @Override 21 | public @NotNull PathfinderFlag[] getFlags() { 22 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT, PathfinderFlag.JUMPING }; 23 | } 24 | 25 | @Override 26 | public String getInternalName() { 27 | return "PathfinderGoalSit"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderSkeletonTrap.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.SkeletonHorse; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder that will cause a trap when players get close 8 | */ 9 | public final class PathfinderSkeletonTrap extends Pathfinder { 10 | 11 | /** 12 | * Constructs a PathfinderSkeletonTraP. 13 | * @param horse SkeletonHorse to use 14 | */ 15 | public PathfinderSkeletonTrap(@NotNull SkeletonHorse horse) { 16 | super(horse); 17 | } 18 | 19 | 20 | @Override 21 | public @NotNull PathfinderFlag[] getFlags() { 22 | return new PathfinderFlag[0]; 23 | } 24 | 25 | @Override 26 | public String getInternalName() { 27 | return "PathfinderGoalHorseTrap"; 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderSwellCreeper.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Creeper; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents the Pathfinder for the logic of a Creeper to swell before exploding 8 | */ 9 | public final class PathfinderSwellCreeper extends Pathfinder { 10 | 11 | /** 12 | * Constructs a PathfinderSwellCreeper. 13 | * @param m Creeper to use 14 | */ 15 | public PathfinderSwellCreeper(@NotNull Creeper m) { 16 | super(m); 17 | } 18 | 19 | @Override 20 | public @NotNull PathfinderFlag[] getFlags() { 21 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT }; 22 | } 23 | 24 | @Override 25 | public String getInternalName() { 26 | return "PathfinderGoalSwell"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderTameHorse.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import me.gamercoder215.mobchip.ai.SpeedModifier; 4 | import org.bukkit.entity.AbstractHorse; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder for the logic of taming any horse by riding it 9 | */ 10 | public final class PathfinderTameHorse extends Pathfinder implements SpeedModifier { 11 | 12 | private double speedMod; 13 | 14 | /** 15 | * Constructs a PathfinderTameHorse with no speed modifier. 16 | * @param m Horse to use 17 | */ 18 | public PathfinderTameHorse(@NotNull AbstractHorse m) { 19 | this(m, 1); 20 | } 21 | 22 | /** 23 | * Constructs a PathfinderTameHorse. 24 | * @param m Horse to use 25 | * @param speedMod Speed Modifier while the horse is moving, when attempting to be tamed 26 | */ 27 | public PathfinderTameHorse(@NotNull AbstractHorse m, double speedMod) { 28 | super(m); 29 | this.speedMod = speedMod; 30 | } 31 | 32 | @Override 33 | public double getSpeedModifier() { 34 | return this.speedMod; 35 | } 36 | 37 | @Override 38 | public void setSpeedModifier(double mod) { 39 | this.speedMod = mod; 40 | } 41 | 42 | 43 | @Override 44 | public @NotNull PathfinderFlag[] getFlags() { 45 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT }; 46 | } 47 | 48 | @Override 49 | public String getInternalName() { 50 | return "PathfinderGoalTame"; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderZombieAttack.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.entity.Zombie; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for a special Zombie Melee Attack 8 | */ 9 | public final class PathfinderZombieAttack extends PathfinderMeleeAttack { 10 | 11 | /** 12 | * Constructs a PathfinderZombieAttack with no speed modifier. 13 | * @param m Zombie to use 14 | */ 15 | public PathfinderZombieAttack(@NotNull Zombie m) { 16 | this(m, 1); 17 | } 18 | 19 | /** 20 | * Constructs a PathfinderZombieAttack with see set to true. 21 | * @param m Zombie to use 22 | * @param speedMod Speed Modifier while attacking 23 | */ 24 | public PathfinderZombieAttack(@NotNull Zombie m, double speedMod) { 25 | this(m, speedMod, true); 26 | } 27 | 28 | /** 29 | * Constructs a PathfinderZombieAttack. 30 | * @param m Zombie to use 31 | * @param speedMod Speed Modifier while attacking 32 | * @param see Whether the Zombie has to see to attack 33 | */ 34 | public PathfinderZombieAttack(@NotNull Zombie m, double speedMod, boolean see) { 35 | super(m, speedMod, see); 36 | } 37 | 38 | @Override 39 | public String getInternalName() { 40 | return "PathfinderGoalZombieAttack"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/Ranged.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | /** 4 | * Represents a Pathfinder that contains Ranged Values 5 | */ 6 | public interface Ranged { 7 | 8 | /** 9 | * Default Attack Interval, in ticks (100) 10 | */ 11 | int DEFAULT_ATTACK_INTERVAL = 100; 12 | /** 13 | * Default Attack Range (6F) 14 | */ 15 | float DEFAULT_ATTACK_RANGE = 6F; 16 | 17 | /** 18 | * Default Range for Looking 19 | */ 20 | float DEFAULT_LOOK_RANGE = 5F; 21 | 22 | /** 23 | * Gets the current Range. 24 | * @return Current Range 25 | */ 26 | float getRange(); 27 | 28 | /** 29 | * Sets the current Range. 30 | * @param range Range to set 31 | */ 32 | void setRange(float range); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/Repeated.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | /** 4 | * Represents a Pathfinder that has a repeating interval, in ticks 5 | */ 6 | public interface Repeated { 7 | 8 | /** 9 | * Gets the repeating interval, in ticks 10 | * @return Interval 11 | */ 12 | int getInterval(); 13 | 14 | /** 15 | * Sets the repeating interval, in ticks 16 | * @param interval Interval 17 | * @throws IllegalArgumentException if interval is less than 0 18 | */ 19 | void setInterval(int interval) throws IllegalArgumentException; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/WorldSpecific.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.bukkit.World; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder that is world specific 8 | */ 9 | public interface WorldSpecific { 10 | 11 | /** 12 | * Exception called when World is null 13 | */ 14 | IllegalArgumentException WORLD_NULL = new IllegalArgumentException("World cannot be null"); 15 | 16 | /** 17 | * Get the world of this WorldSpecific. 18 | * @return World 19 | */ 20 | @NotNull 21 | World getWorld(); 22 | 23 | /** 24 | * Sets the world of this WorldSpecific. 25 | * @param w World to set 26 | * @throws IllegalArgumentException if world is null 27 | */ 28 | void setWorld(@NotNull World w) throws IllegalArgumentException; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/WrappedPathfinder.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import org.jetbrains.annotations.Nullable; 4 | 5 | /** 6 | * Represents a Pathfinder with a Priority 7 | */ 8 | public final class WrappedPathfinder { 9 | 10 | private final int priority; 11 | private final Pathfinder pathfinder; 12 | 13 | /** 14 | * Creates a WrappedPathfinder. 15 | * @param p Pathfinder to use 16 | * @param priority Priority of pathfinder. Lower is better. Priority < 0 is nonstandard. 17 | */ 18 | public WrappedPathfinder(@Nullable Pathfinder p, int priority) { 19 | this.pathfinder = p; 20 | this.priority = priority; 21 | } 22 | 23 | /** 24 | * Gets the priority of the pathfinder. 25 | * @return Priority of this WrappedPathfinder 26 | */ 27 | public int getPriority() { 28 | return priority; 29 | } 30 | 31 | /** 32 | * Gets the pathfinder of this WrappedPathfinder. 33 | * @return Pathfinder added, may be null 34 | */ 35 | @Nullable 36 | public Pathfinder getPathfinder() { 37 | return pathfinder; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/target/Filtering.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal.target; 2 | 3 | import org.bukkit.entity.LivingEntity; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder that filters in an entity class 8 | * @param Type of Entity to filter 9 | */ 10 | public interface Filtering { 11 | 12 | /** 13 | * Set the Filter that this Pathfinder is looking for. 14 | * @param clazz Filter to set 15 | * @throws IllegalArgumentException if clazz is null 16 | */ 17 | void setFilter(@NotNull Class clazz) throws IllegalArgumentException ; 18 | 19 | /** 20 | * Get the filter that this Pathfinder is looking for. 21 | * @return Filter found 22 | */ 23 | Class getFilter(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/target/PathfinderDefendVillage.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal.target; 2 | 3 | import org.bukkit.entity.IronGolem; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Represents a Pathfinder for an Iron Golem to defend a Village 8 | */ 9 | public final class PathfinderDefendVillage extends TargetPathfinder { 10 | 11 | /** 12 | * Constructs a PathfinderDefendVillage. 13 | * @param m Iron Golem to use 14 | */ 15 | public PathfinderDefendVillage(@NotNull IronGolem m) { 16 | super(m, false, true); 17 | } 18 | 19 | @Override 20 | public @NotNull PathfinderFlag[] getFlags() { 21 | return new PathfinderFlag[] { PathfinderFlag.TARGETING }; 22 | } 23 | 24 | @Override 25 | public String getInternalName() { 26 | return "PathfinderGoalDefendVillage"; 27 | } 28 | } -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/target/PathfinderOwnerHurtByTarget.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal.target; 2 | 3 | import org.bukkit.entity.Animals; 4 | import org.bukkit.entity.Tameable; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder for a Tamable to attack the Target if its owner is hurt 9 | */ 10 | public final class PathfinderOwnerHurtByTarget extends TargetPathfinder { 11 | 12 | /** 13 | * Constructs a PathfinderOwnerHurtByTarget. 14 | * @param m Tamable to use 15 | */ 16 | public PathfinderOwnerHurtByTarget(@NotNull Tameable m) { 17 | super((Animals) m, false, false); 18 | } 19 | 20 | 21 | @Override 22 | public @NotNull PathfinderFlag[] getFlags() { 23 | return new PathfinderFlag[] { PathfinderFlag.TARGETING }; 24 | } 25 | 26 | @Override 27 | public String getInternalName() { 28 | return "PathfinderGoalOwnerHurtByTarget"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/target/PathfinderOwnerHurtTarget.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal.target; 2 | 3 | import org.bukkit.entity.Animals; 4 | import org.bukkit.entity.Tameable; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder where a Tamable Animal attacks the owner's target. 9 | */ 10 | public final class PathfinderOwnerHurtTarget extends TargetPathfinder { 11 | 12 | /** 13 | * Constructs a PathfinderOwnerHurtTarget. 14 | * @param t Tamable Entity to use 15 | */ 16 | public PathfinderOwnerHurtTarget(@NotNull Tameable t) { 17 | super((Animals) t, false, false); 18 | } 19 | 20 | @Override 21 | public @NotNull PathfinderFlag[] getFlags() { 22 | return new PathfinderFlag[] { PathfinderFlag.TARGETING }; 23 | } 24 | 25 | @Override 26 | public String getInternalName() { 27 | return "PathfinderGoalOwnerHurtTarget"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/goal/target/Targeting.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal.target; 2 | 3 | /** 4 | * Represents a target of a Pathfinder 5 | */ 6 | public interface Targeting { 7 | 8 | /** 9 | * Whether the entity must see the target. 10 | * @return true if entity must see, else false 11 | */ 12 | boolean mustSee(); 13 | 14 | /** 15 | * Sets whether the entity must see the target. 16 | * @param see true if entity must see, else false 17 | */ 18 | void setSee(boolean see); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/memories/Unit.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.memories; 2 | 3 | import me.gamercoder215.mobchip.EntityBrain; 4 | 5 | /** 6 | *

Represents a Memory Unit.

7 | *

For some memories that require active cooldowns, such as {@link EntityMemory#IS_SNIFFING}, the cooldown is read instead of the actual memory value.

8 | * 9 | * Example: 10 | *
{@code
11 |  *   public void setMemories(Warden w) {
12 |  *       EntityBrain brain = BukkitBrain.getBrain(w);
13 |  *
14 |  *       brain.setMemory(EntityMemory.IS_SNIFFING, Unit.INSTANCE, 500); // Sniffing for 500 ticks
15 |  *   }
16 |  * }
17 | * 18 | * @see EntityBrain#getExpiration(Memory) 19 | */ 20 | public enum Unit { 21 | 22 | /** 23 | * The only Unit Instance. 24 | */ 25 | INSTANCE 26 | } 27 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/schedule/Updatable.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.schedule; 2 | 3 | /** 4 | * Represents an entity type that updates its Activities 5 | */ 6 | public interface Updatable { 7 | 8 | /** 9 | * Updates this Entity's Activities. 10 | */ 11 | void updateActivities(); 12 | } 13 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/sensing/EntitySenses.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.sensing; 2 | 3 | import org.bukkit.NamespacedKey; 4 | import org.bukkit.entity.Mob; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Represents a mob's senses and groups of {@link Sensor}s. 11 | */ 12 | public interface EntitySenses { 13 | 14 | /** 15 | * Fetches the Entity this EntitySenses belongs to. 16 | * @return Mob 17 | */ 18 | @NotNull 19 | Mob getEntity(); 20 | 21 | /** 22 | * Fetches a list of all sensors that this mob has enabled. 23 | * @return List of Sensors 24 | */ 25 | @NotNull 26 | List> getSensors(); 27 | 28 | /** 29 | * Adds a Sensor to this mob's senses. 30 | * @param sensor Sensor to Add 31 | * @throws IllegalArgumentException if sensor is not registered 32 | */ 33 | void addSensor(@NotNull Sensor sensor) throws IllegalArgumentException; 34 | 35 | /** 36 | * Removes a Sensor from this mob's senses. 37 | * @param sensor Sensor to Remove 38 | */ 39 | void removeSensor(@NotNull Sensor sensor); 40 | 41 | /** 42 | * Removes a Sensor by its NamespacedKey from this mob's senses. 43 | * @param key NamespacedKey to Remove 44 | */ 45 | void removeSensor(@NotNull NamespacedKey key); 46 | 47 | /** 48 | * Whether this mob has a Sensor by its NamespacedKey. 49 | * @param key NamespacedKey to Check 50 | * @return true if sensor exists, false otherwise 51 | */ 52 | boolean hasSensor(@NotNull NamespacedKey key); 53 | 54 | } 55 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/ai/sensing/Sensor.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.sensing; 2 | 3 | import me.gamercoder215.mobchip.ai.memories.Memory; 4 | import org.bukkit.Keyed; 5 | import org.bukkit.World; 6 | import org.bukkit.entity.LivingEntity; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | *

Represents an action performed when certain {@link Memory} objects are present.

13 | *

This is typically used for updating memories when other memories are present.

14 | * @param Entity Type related with this Sensor. 15 | */ 16 | public interface Sensor extends Keyed { 17 | 18 | /** 19 | * Represents the Default Scan Rate of 20 Ticks. 20 | */ 21 | int DEFAULT_SCAN_RATE = 20; 22 | 23 | /** 24 | * Fetches all the Memories required for this Sensor to be performed. 25 | * @return List of Required Memories 26 | */ 27 | @NotNull 28 | List> required(); 29 | 30 | /** 31 | * Fetches the scan rate of how often to check for the memories in {@link #required()}, in ticks. 32 | * @return Memory Scan Rate, in Ticks 33 | */ 34 | int getScanRate(); 35 | 36 | /** 37 | * Fetches the Class Type related to this Sensor. 38 | * @return Class Type 39 | */ 40 | @NotNull 41 | Class getEntityClass(); 42 | 43 | /** 44 | * Performs the Sensor's action. 45 | * @param w World 46 | * @param entity Entity 47 | */ 48 | void run(@NotNull World w, LivingEntity entity); 49 | 50 | } 51 | -------------------------------------------------------------------------------- /base/src/main/java/me/gamercoder215/mobchip/bosses/annotations/Repeatable.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bosses.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Represents an Attack that will be Repeated until the entity dies. 10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target(ElementType.METHOD) 13 | public @interface Repeatable { 14 | 15 | /** 16 | * The delay of this Repeatable Attack. Default: 0 17 | * @return Delay of Attack 18 | */ 19 | long delay() default 0; 20 | 21 | /** 22 | * The Name of the Plugin. 23 | * @return Name of Plugin 24 | */ 25 | String plugin(); 26 | 27 | /** 28 | * Interval of this Repeatable Attack. 29 | * @return Interval of Attack 30 | */ 31 | long interval(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /base/src/main/kotlin/me/gamercoder215/mobchip/util/extensions.kt: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.util 2 | 3 | // Position 4 | 5 | /** 6 | * Adds each value to this [Position] by the specified [Position]. 7 | * @return Position Result 8 | */ 9 | operator fun Position.plus(other: Position) = clone().add(other) 10 | 11 | /** 12 | * Subtracts each value from this [Position] by the specified [Position]. 13 | * @return Position Result 14 | */ 15 | operator fun Position.minus(other: Position) = clone().remove(other) 16 | 17 | /** 18 | * Adds each value to this [Position] by the specified [Position] 19 | * @return this Position 20 | */ 21 | operator fun Position.plusAssign(other: Position) { add(other) } 22 | 23 | /** 24 | * Subtracts each value from this [Position] by the specified [Position] 25 | * @return this Position 26 | */ 27 | operator fun Position.minusAssign(other: Position) { remove(other) } 28 | 29 | /** 30 | * Increments each value to this [Position] by 1. 31 | * @return this Position 32 | */ 33 | operator fun Position.inc() = add(1, 1, 1) 34 | 35 | /** 36 | * Decrements each value from this [Position] by 1. 37 | * @return this Position 38 | */ 39 | operator fun Position.dec() = remove(1, 1, 1) 40 | 41 | // PositionPath 42 | 43 | /** 44 | * Fetches the [Position] of this [PositionPath] at the specified index. 45 | * @return Position 46 | * @see PositionPath.getPosition 47 | */ 48 | operator fun PositionPath.get(index: Int) = getPosition(index) -------------------------------------------------------------------------------- /base/src/test/java/me/gamercoder215/mobchip/ai/memories/TestEntityMemory.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.memories; 2 | 3 | import org.bukkit.NamespacedKey; 4 | import org.junit.jupiter.api.Assertions; 5 | import org.junit.jupiter.api.DisplayName; 6 | import org.junit.jupiter.api.Test; 7 | 8 | public class TestEntityMemory { 9 | 10 | @Test 11 | @DisplayName("Test Fetcher") 12 | public void testFetcher() { 13 | Assertions.assertNotNull(EntityMemory.getByKey(NamespacedKey.minecraft("home"))); 14 | Assertions.assertNotNull(EntityMemory.getByKey(NamespacedKey.minecraft("job_site"))); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /base/src/test/java/me/gamercoder215/mobchip/ai/schedule/TestSchedule.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.schedule; 2 | 3 | import org.junit.jupiter.api.Assertions; 4 | import org.junit.jupiter.api.DisplayName; 5 | import org.junit.jupiter.api.Test; 6 | 7 | public class TestSchedule { 8 | 9 | @Test 10 | @DisplayName("Test Schedule Builder") 11 | public void testBuilder() { 12 | Schedule s = Schedule.builder() 13 | .addActivity(10, Activity.IDLE) 14 | .addActivity(20, Activity.CORE) 15 | .addActivity(3000, Activity.IDLE) 16 | .build(); 17 | 18 | 19 | Assertions.assertEquals(Activity.IDLE, s.get(10)); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /base/src/test/java/me/gamercoder215/mobchip/util/TestPosition.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.util; 2 | 3 | 4 | import org.junit.jupiter.api.Assertions; 5 | import org.junit.jupiter.api.DisplayName; 6 | import org.junit.jupiter.api.Test; 7 | 8 | public class TestPosition { 9 | 10 | @Test 11 | @DisplayName("Test Basic Position") 12 | public void testBasic() { 13 | Position p = new Position(0, 0, 0); 14 | Assertions.assertEquals(0, p.getX()); 15 | Assertions.assertEquals(0, p.getY()); 16 | Assertions.assertEquals(0, p.getZ()); 17 | 18 | p.setX(1).setY(2).setZ(3); 19 | Assertions.assertEquals(1, p.getX()); 20 | Assertions.assertEquals(2, p.getY()); 21 | Assertions.assertEquals(3, p.getZ()); 22 | } 23 | 24 | @Test 25 | @DisplayName("Test Position Distance") 26 | public void testDistance() { 27 | Position p1 = new Position(1, 1, 1); 28 | Position p2 = new Position(3, 3, 3); 29 | 30 | Assertions.assertEquals(p1.distanceSquared(p2), 12); 31 | Assertions.assertEquals(p1.distance(p2), Math.sqrt(12)); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /bukkit/src/main/java/me/gamercoder215/mobchip/ai/memories/EntityMemories.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.memories; 2 | 3 | import me.gamercoder215.mobchip.abstraction.ChipUtil; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | /** 7 | * Utility class for Entity Memories 8 | */ 9 | public final class EntityMemories { 10 | 11 | private static final ChipUtil w = ChipUtil.getWrapper(); 12 | 13 | private EntityMemories() { throw new UnsupportedOperationException(); } 14 | 15 | /** 16 | * Registers a new memory in the registry. 17 | * @param memory Memory to register 18 | * @return true if memory was registered, false if memory already exists 19 | * @throws IllegalArgumentException if memory is null 20 | */ 21 | public static boolean registerMemory(@NotNull Memory memory) throws IllegalArgumentException { 22 | if (memory == null) throw new IllegalArgumentException("Memory cannot be null"); 23 | if (memory instanceof EntityMemory) return false; 24 | if (w.existsMemory(memory)) return false; 25 | 26 | w.registerMemory(memory); 27 | return true; 28 | } 29 | 30 | /** 31 | * Whether this entity has the given memory. 32 | * @param memory Memory to check 33 | * @return true if memory exists, false if memory does not exist 34 | */ 35 | public static boolean doesMemoryExist(@NotNull Memory memory) { 36 | return w.existsMemory(memory); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /bukkit/src/main/java/me/gamercoder215/mobchip/ai/schedule/DefaultSchedules.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.schedule; 2 | 3 | import me.gamercoder215.mobchip.abstraction.ChipUtil; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | /** 8 | * Represents Built-In MC Schedules 9 | */ 10 | public final class DefaultSchedules { 11 | 12 | private DefaultSchedules() {} 13 | 14 | private static final ChipUtil wrapper = ChipUtil.getWrapper(); 15 | 16 | /** 17 | * Represents an Empty Schedule 18 | */ 19 | public static final Schedule EMPTY = wrapper.getDefaultSchedule("empty"); 20 | /** 21 | * Represents a Simple Schedule with working at 5,000 ticks and resting at 11,000 ticks. 22 | */ 23 | public static final Schedule SIMPLE = wrapper.getDefaultSchedule("simple"); 24 | /** 25 | * Represents an Adult Villager's default schedule. 26 | */ 27 | public static final Schedule VILLAGER = wrapper.getDefaultSchedule("villager_default"); 28 | /** 29 | * Represents a Baby Villager's default schedule. 30 | */ 31 | public static final Schedule BABY_VILLAGER = wrapper.getDefaultSchedule("villager_baby"); 32 | 33 | /** 34 | * Fetches a Schedule from the Minecraft registrar. 35 | * @param id ID of the Schedule 36 | * @return Schedule found, or {@link #EMPTY} if not found 37 | */ 38 | @NotNull 39 | public static Schedule get(@Nullable String id) { 40 | if (id == null) return EMPTY; 41 | Schedule s = wrapper.getDefaultSchedule(id); 42 | if (s == null) return EMPTY; else return s; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /bukkit/src/main/java/me/gamercoder215/mobchip/bukkit/BukkitDragonBrain.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit; 2 | 3 | import me.gamercoder215.mobchip.ai.enderdragon.CustomPhase; 4 | import me.gamercoder215.mobchip.DragonBrain; 5 | import me.gamercoder215.mobchip.ai.enderdragon.DragonPhase; 6 | import org.bukkit.entity.EnderCrystal; 7 | import org.bukkit.entity.EnderDragon; 8 | import org.bukkit.entity.Mob; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | class BukkitDragonBrain extends BukkitBrain implements DragonBrain { 12 | 13 | final EnderDragon m; 14 | 15 | BukkitDragonBrain(@NotNull EnderDragon dragon) { 16 | super((Mob) dragon); 17 | this.m = dragon; 18 | } 19 | 20 | @Override 21 | public void setCustomPhase(@NotNull CustomPhase phase) throws IllegalArgumentException { 22 | w.setCustomPhase(m, phase); 23 | } 24 | 25 | @Override 26 | public EnderCrystal getNearestCrystal() { 27 | return w.getNearestCrystal(m); 28 | } 29 | 30 | @Override 31 | public @NotNull DragonPhase getCurrentPhase() { 32 | return w.getCurrentPhase(m); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bukkit/src/main/java/me/gamercoder215/mobchip/bukkit/BukkitVillagerBrain.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit; 2 | 3 | import me.gamercoder215.mobchip.VillagerBrain; 4 | import me.gamercoder215.mobchip.ai.gossip.EntityGossipContainer; 5 | import org.bukkit.entity.Villager; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | class BukkitVillagerBrain extends BukkitBrain implements VillagerBrain { 9 | 10 | final Villager v; 11 | 12 | BukkitVillagerBrain(@NotNull Villager v) { 13 | super(v); 14 | this.v = v; 15 | } 16 | 17 | @Override 18 | public @NotNull EntityGossipContainer getGossipContainer() { 19 | return w.getGossipContainer(v); 20 | } 21 | 22 | @Override 23 | public @NotNull Villager getEntity() { 24 | return v; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bukkit/src/main/java/me/gamercoder215/mobchip/bukkit/events/BrainEvent.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit.events; 2 | 3 | import me.gamercoder215.mobchip.EntityBrain; 4 | import org.bukkit.event.Event; 5 | import org.bukkit.event.HandlerList; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | /** 9 | * Represents an Event related to the Brain 10 | */ 11 | public abstract class BrainEvent extends Event { 12 | 13 | private final EntityBrain brain; 14 | private static final HandlerList HANDLERS = new HandlerList(); 15 | 16 | /** 17 | * Construct a BrainEvent 18 | * @param brain EntityBrain involved 19 | */ 20 | protected BrainEvent(@NotNull EntityBrain brain) { 21 | this.brain = brain; 22 | } 23 | 24 | /** 25 | * Construct a BrainEvent 26 | * @param brain EntityBrain involved 27 | * @param async true if async, else false 28 | */ 29 | protected BrainEvent(@NotNull EntityBrain brain, boolean async) { 30 | super(async); 31 | 32 | this.brain = brain; 33 | } 34 | 35 | /** 36 | * Gets this BrainEvent's Handlers. 37 | * @return Handlers 38 | */ 39 | public HandlerList getHandlers() { 40 | return HANDLERS; 41 | } 42 | 43 | /** 44 | * Gets this BrainEvent's Handlers. 45 | * @return Handlers 46 | */ 47 | public static HandlerList getHandlerList() { 48 | return HANDLERS; 49 | } 50 | 51 | /** 52 | * Gets the EntityBrain involved in this event. 53 | * @return EntityBrain involved 54 | */ 55 | public final EntityBrain getBrain() { 56 | return this.brain; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /bukkit/src/main/java/me/gamercoder215/mobchip/bukkit/events/memory/MemoryChangeEvent.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit.events.memory; 2 | 3 | import me.gamercoder215.mobchip.EntityBrain; 4 | import me.gamercoder215.mobchip.ai.memories.EntityMemory; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | /** 9 | * Called when a Memory Changes 10 | */ 11 | public class MemoryChangeEvent extends MemoryEvent { 12 | 13 | private final Object oldV; 14 | private final Object newV; 15 | 16 | /** 17 | * Construct a MemoryChangeEvent. 18 | * @param brain EntityBrain involved 19 | * @param memory EntityMemory involved 20 | * @param oldValue Old Value of Memory 21 | * @param newValue New Value of Memory 22 | */ 23 | public MemoryChangeEvent(@NotNull EntityBrain brain, @NotNull EntityMemory memory, @Nullable Object oldValue, @Nullable Object newValue) { 24 | super(brain, memory); 25 | 26 | this.oldV = oldValue; 27 | this.newV = newValue; 28 | } 29 | 30 | /** 31 | * Get the old value of this MemoryChangeEvent. 32 | * @return Old Value 33 | */ 34 | public Object getOldValue() { 35 | return this.oldV; 36 | } 37 | 38 | /** 39 | * Get the new value of this MemoryChangeEvent. 40 | * @return New Value 41 | */ 42 | public Object getNewValue() { 43 | return this.newV; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /bukkit/src/main/java/me/gamercoder215/mobchip/bukkit/events/memory/MemoryEvent.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit.events.memory; 2 | 3 | import me.gamercoder215.mobchip.EntityBrain; 4 | import me.gamercoder215.mobchip.ai.memories.EntityMemory; 5 | import me.gamercoder215.mobchip.bukkit.events.BrainEvent; 6 | import org.bukkit.event.Cancellable; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | /** 10 | * Represents an Event involving a Memory 11 | */ 12 | public abstract class MemoryEvent extends BrainEvent implements Cancellable { 13 | 14 | private EntityMemory memory; 15 | private boolean cancel; 16 | 17 | /** 18 | * Constructs a MemoryEvent. 19 | * @param brain EntityBrain Involved 20 | * @param memory EntityMemory involved 21 | */ 22 | public MemoryEvent(@NotNull EntityBrain brain, EntityMemory memory) { 23 | super(brain); 24 | 25 | this.memory = memory; 26 | this.cancel = false; 27 | } 28 | 29 | @Override 30 | public boolean isCancelled() { 31 | return this.cancel; 32 | } 33 | 34 | @Override 35 | public void setCancelled(boolean cancel) { 36 | this.cancel = cancel; 37 | } 38 | 39 | /** 40 | * Gets the memory involved in this MemoryEvent. 41 | * @return memory involved 42 | */ 43 | public EntityMemory getMemory() { 44 | return this.memory; 45 | } 46 | 47 | /** 48 | * Sets the memory involved in this MemoryEvent. 49 | * @param memory memory involved 50 | */ 51 | public void setMemory(EntityMemory memory) { 52 | this.memory = memory; 53 | } 54 | 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /bukkit/src/main/java/me/gamercoder215/mobchip/bukkit/events/pathfinder/PathfinderAddEvent.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit.events.pathfinder; 2 | 3 | import me.gamercoder215.mobchip.ai.EntityAI; 4 | import me.gamercoder215.mobchip.ai.goal.Pathfinder; 5 | import org.bukkit.event.Cancellable; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | /** 9 | * Called before a Pathfinder is added 10 | */ 11 | public class PathfinderAddEvent extends PathfinderEvent implements Cancellable { 12 | 13 | private boolean cancel; 14 | private final int priority; 15 | 16 | /** 17 | * Constructs a PathfinderAddEvent. 18 | * @param ai EntityAI used 19 | * @param p Pathfinder used 20 | * @param target Whether AI is Target AI 21 | * @param priority Priority of Pathfinder 22 | */ 23 | public PathfinderAddEvent(@NotNull EntityAI ai, @NotNull Pathfinder p, boolean target, int priority) { 24 | super(ai, p, target); 25 | 26 | this.priority = priority; 27 | } 28 | 29 | /** 30 | * Gets the priority that this Pathfinder will be added to. 31 | * @return Priority added 32 | */ 33 | public int getPriority() { 34 | return this.priority; 35 | } 36 | 37 | @Override 38 | public boolean isCancelled() { 39 | return cancel; 40 | } 41 | 42 | @Override 43 | public void setCancelled(boolean cancel) { 44 | this.cancel = cancel; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /bukkit/src/main/java/me/gamercoder215/mobchip/bukkit/events/pathfinder/PathfinderRemoveEvent.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit.events.pathfinder; 2 | 3 | import me.gamercoder215.mobchip.ai.EntityAI; 4 | import me.gamercoder215.mobchip.ai.goal.Pathfinder; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | /** 8 | * Called when a Pathfinder is removed 9 | */ 10 | public class PathfinderRemoveEvent extends PathfinderEvent { 11 | 12 | /** 13 | * Construct a PathfinderRemoveEvent. 14 | * @param ai EntityAI involved 15 | * @param pathfinder Pathfinder involved 16 | * @param target true if AI is target, else false 17 | */ 18 | public PathfinderRemoveEvent(@Nullable EntityAI ai, @Nullable Pathfinder pathfinder, boolean target) { 19 | super(ai, pathfinder, target); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/animation/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package containing all Animation-Related MobChip API. 3 | */ 4 | package me.gamercoder215.mobchip.ai.animation; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/attribute/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package relating to all MobChip Entity AI 3 | */ 4 | package me.gamercoder215.mobchip.ai.attribute; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/behavior/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package relating to Entity Behaviors 3 | */ 4 | package me.gamercoder215.mobchip.ai.behavior; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/controller/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package related to Small Entity Controlling 3 | */ 4 | package me.gamercoder215.mobchip.ai.controller; 5 | -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/enderdragon/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Packages relating to the Ender Dragon 3 | */ 4 | package me.gamercoder215.mobchip.ai.enderdragon; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/goal/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Packages relating to Entity Pathfinding 3 | */ 4 | package me.gamercoder215.mobchip.ai.goal; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/goal/target/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Packages relating to Entity Pathfinding including Targets 3 | */ 4 | package me.gamercoder215.mobchip.ai.goal.target; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/gossip/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Packages related to MobChip Villager Gossip API 3 | */ 4 | package me.gamercoder215.mobchip.ai.gossip; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/memories/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package related to Entity Memories 3 | */ 4 | package me.gamercoder215.mobchip.ai.memories; 5 | -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/navigation/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Packages relating to Large-Scale Movement Controller / Entity Navigation 3 | */ 4 | package me.gamercoder215.mobchip.ai.navigation; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * All Packages relating to Entity AI 3 | */ 4 | package me.gamercoder215.mobchip.ai; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/schedule/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Packages relating to MobChip Entity Scheduling 3 | */ 4 | package me.gamercoder215.mobchip.ai.schedule; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/ai/sensing/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package relating to MobChip Entity Sensors and Sensing 3 | */ 4 | package me.gamercoder215.mobchip.ai.sensing; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/bosses/annotations/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MobChip Bosses API Annotations 3 | */ 4 | package me.gamercoder215.mobchip.bosses.annotations; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/bosses/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MobChip Bosses API Main Package 3 | */ 4 | package me.gamercoder215.mobchip.bosses; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/bukkit/events/memory/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MobChip Bukkit Events related to Memories 3 | */ 4 | package me.gamercoder215.mobchip.bukkit.events.memory; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/bukkit/events/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * All MobChip Bukkit Events 3 | */ 4 | package me.gamercoder215.mobchip.bukkit.events; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/bukkit/events/pathfinder/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MobChip Bukkit Events related to Pathfinding 3 | */ 4 | package me.gamercoder215.mobchip.bukkit.events.pathfinder; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/bukkit/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Main package for MobChip Bukkit Implementation 3 | */ 4 | package me.gamercoder215.mobchip.bukkit; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/combat/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package for combat related MobChip API. 3 | */ 4 | package me.gamercoder215.mobchip.combat; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/nbt/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package related to MobChip NBT API 3 | */ 4 | package me.gamercoder215.mobchip.nbt; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Main MobChip API Package 3 | */ 4 | package me.gamercoder215.mobchip; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/me/gamercoder215/mobchip/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package for utility classes in MobChip API 3 | */ 4 | package me.gamercoder215.mobchip.util; -------------------------------------------------------------------------------- /bukkit/src/main/javadoc/overview.html: -------------------------------------------------------------------------------- 1 | 2 |

MobChip, a NMS Pathfinder and Entity AI Wrapper made for MC 1.13+, containing implementation from the Bukkit API.

3 | 4 | 5 | -------------------------------------------------------------------------------- /bukkit/src/main/kotlin/me/gamercoder215/mobchip/ai/attribute/extensions.kt: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.attribute 2 | 3 | /** 4 | * Fetches the MobChip Attribute counterpart to this Bukkit Attribute. 5 | * @return MobChip Counterpart, or Null if doesn't exist in Bukkit 6 | */ 7 | inline val org.bukkit.attribute.Attribute.mobChip: Attribute? 8 | get() = EntityAttribute.fromBukkit(this) -------------------------------------------------------------------------------- /bukkit/src/main/kotlin/me/gamercoder215/mobchip/ai/enderdragon/extensions.kt: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.enderdragon 2 | 3 | import org.bukkit.entity.EnderDragon 4 | 5 | /** 6 | * Fetches the Phases for this [EnderDragon]. 7 | * @return Ender Dragon Phases 8 | */ 9 | inline val EnderDragon.phases: DragonPhases 10 | get() = DragonPhases(this) -------------------------------------------------------------------------------- /bukkit/src/main/kotlin/me/gamercoder215/mobchip/ai/memories/extensions.kt: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.memories 2 | 3 | /** 4 | * Registers this [Memory] to the Memory Registry. 5 | * @throws IllegalStateException if this [Memory] is already registered. 6 | */ 7 | @Throws(IllegalStateException::class) 8 | fun Memory<*>.register() = EntityMemories.registerMemory(this) -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | org.gradle.daemon=true 3 | org.gradle.jvmargs=-Xmx2G -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 4 | org.gradle.parallel=true 5 | org.gradle.caching=true 6 | compileJava.options.encoding=UTF-8 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datatags/MobChipLite/4121d56ade19706735b694ffffd6ab8c05761d42/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /javadoc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git config --local user.email "action@github.com" 4 | git config --local user.name "GitHub Actions" 5 | git fetch origin gh-pages 6 | 7 | echo "[MobChip JavaDoc Builder] Starting..." 8 | 9 | rm -rf docs/ 10 | 11 | mkdir ./docs 12 | 13 | echo "[MobChip JavaDoc Builder] Injecting..." 14 | 15 | cp -R build/docs/javadoc/* docs/ 16 | 17 | git switch -f gh-pages 18 | 19 | for dir in ./* 20 | do 21 | if [ "$dir" == "./docs" ]; then 22 | continue 23 | fi 24 | 25 | rm -rf "$dir" 26 | done 27 | 28 | cp -Rfv ./docs/* ./ 29 | rm -rf ./docs 30 | 31 | echo "mobchip.gmitch215.xyz" > CNAME 32 | echo "[MobChip JavaDoc Builder] Committing..." 33 | 34 | git add . 35 | git commit -m "Update JavaDocs ($1)" 36 | git push -f origin gh-pages 37 | 38 | echo "[MobChip JavaDoc Builder] Done!" 39 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - sdk install java 21.0.3-tem 3 | - sdk use java 21.0.3-tem 4 | -------------------------------------------------------------------------------- /nms/1_17_R1/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.17.1" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | 14 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 15 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | } 17 | 18 | java { 19 | sourceCompatibility = JavaVersion.VERSION_17 20 | targetCompatibility = JavaVersion.VERSION_17 21 | } 22 | 23 | tasks { 24 | assemble { 25 | dependsOn("remap") 26 | } 27 | 28 | remap { 29 | dependsOn("shadowJar") 30 | 31 | inputTask.set(getByName("shadowJar")) 32 | version.set(mcVersion) 33 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 34 | archiveName.set("${project.name}-${project.version}.jar") 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /nms/1_17_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_17_R1/BehaviorResult1_17_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_17_R1; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.Behavior; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | final class BehaviorResult1_17_R1 extends BehaviorResult { 11 | private final Behavior b; 12 | private final net.minecraft.world.entity.Mob mob; 13 | private final ServerLevel l; 14 | 15 | public BehaviorResult1_17_R1(Behavior b, net.minecraft.world.entity.Mob mob) { 16 | this.b = b; 17 | this.mob = mob; 18 | this.l = ChipUtil1_17_R1.toNMS(Bukkit.getWorld(mob.level.getWorld().getUID())); 19 | 20 | b.tryStart(l, mob, 0); 21 | } 22 | 23 | @Override 24 | public @NotNull Status getStatus() { 25 | return ChipUtil1_17_R1.fromNMS(b.getStatus()); 26 | } 27 | 28 | @Override 29 | public void stop() { 30 | b.doStop(l, mob, 0); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /nms/1_17_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_17_R1/CustomGoal1_17_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_17_R1; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | final class CustomGoal1_17_R1 extends Goal { 7 | 8 | private final CustomPathfinder p; 9 | 10 | public CustomGoal1_17_R1(CustomPathfinder p) { 11 | this.p = p; 12 | } 13 | 14 | @Override 15 | public boolean canUse() { 16 | return p.canStart(); 17 | } 18 | @Override 19 | public boolean canContinueToUse() { 20 | return p.canContinueToUse(); 21 | } 22 | @Override 23 | public boolean isInterruptable() { 24 | return p.canInterrupt(); 25 | } 26 | 27 | @Override 28 | public void start() { 29 | p.start(); 30 | } 31 | 32 | @Override 33 | public void tick() { 34 | p.tick(); 35 | } 36 | 37 | @Override 38 | public void stop() { 39 | p.stop(); 40 | } 41 | 42 | public CustomPathfinder getPathfinder() { 43 | return p; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /nms/1_17_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_17_R1/Sensor1_17_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_17_R1; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_17_R1 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_17_R1(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_17_R1.fromNMS(level), ChipUtil1_17_R1.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_17_R1::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_17_R1/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderCatOnBlock.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import me.gamercoder215.mobchip.ai.SpeedModifier; 4 | import me.gamercoder215.mobchip.ai.goal.Pathfinder; 5 | import org.bukkit.entity.Cat; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | /** 9 | * Represents a Pathfinder for a Cat to sit on a block 10 | */ 11 | public final class PathfinderCatOnBlock extends Pathfinder implements SpeedModifier { 12 | 13 | private double speedMod; 14 | 15 | /** 16 | * Constructs a PathfinderCatOnBlock. 17 | * @param cat Cat to use 18 | * @param speedMod Speed Modifier 19 | */ 20 | public PathfinderCatOnBlock(@NotNull Cat cat, double speedMod) { 21 | super(cat); 22 | 23 | this.speedMod = speedMod; 24 | } 25 | 26 | @Override 27 | public double getSpeedModifier() { 28 | return this.speedMod; 29 | } 30 | 31 | @Override 32 | public void setSpeedModifier(double mod) { 33 | this.speedMod = mod; 34 | } 35 | 36 | @Override 37 | public @NotNull PathfinderFlag[] getFlags() { 38 | return new PathfinderFlag[0]; 39 | } 40 | 41 | @Override 42 | public @NotNull Cat getEntity() { return (Cat) entity; } 43 | 44 | @Override 45 | public String getInternalName() { return "PathfinderGoalJumpOnBlock"; } 46 | } 47 | -------------------------------------------------------------------------------- /nms/1_17_R1/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderLookAtTradingPlayer.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.Pathfinder; 4 | import org.bukkit.entity.AbstractVillager; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder for a Villager 9 | */ 10 | public final class PathfinderLookAtTradingPlayer extends Pathfinder { 11 | 12 | /** 13 | * Constructs a PathfinderLookAtTradingPlayer. 14 | * @param m AbstractVillager (Villager or Wandering Trader) to use 15 | */ 16 | public PathfinderLookAtTradingPlayer(@NotNull AbstractVillager m) { 17 | super(m); 18 | } 19 | 20 | 21 | @Override 22 | public @NotNull PathfinderFlag[] getFlags() { 23 | return new PathfinderFlag[] { PathfinderFlag.LOOKING }; 24 | } 25 | 26 | @Override 27 | public String getInternalName() { 28 | return "PathfinderGoalLookAtTradingPlayer"; 29 | } 30 | } -------------------------------------------------------------------------------- /nms/1_17_R1/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderMoveToRaid.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.Pathfinder; 4 | import org.bukkit.entity.Raider; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents a Pathfinder for a Raider to move to a Raid 9 | */ 10 | public final class PathfinderMoveToRaid extends Pathfinder { 11 | 12 | /** 13 | * Constructs a PathfinderMoveToRaid. 14 | * @param m Raider to use 15 | */ 16 | public PathfinderMoveToRaid(@NotNull Raider m) { 17 | super(m); 18 | } 19 | 20 | 21 | @Override 22 | public @NotNull PathfinderFlag[] getFlags() { 23 | return new PathfinderFlag[] { PathfinderFlag.MOVEMENT }; 24 | } 25 | 26 | @Override 27 | public String getInternalName() { 28 | return "PathfinderGoalRaid"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /nms/1_17_R1/src/main/java/me/gamercoder215/mobchip/ai/goal/PathfinderTradePlayer.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.ai.goal; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.Pathfinder; 4 | import org.bukkit.entity.AbstractVillager; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | /** 8 | * Represents the Pathfinder for the logic of any Villager to trade with a Player 9 | */ 10 | public final class PathfinderTradePlayer extends Pathfinder { 11 | 12 | /** 13 | * Constructs a PathfinderTradePlayer. 14 | * @param m AbstractVillager to use 15 | */ 16 | public PathfinderTradePlayer(@NotNull AbstractVillager m) { 17 | super(m); 18 | } 19 | 20 | 21 | @Override 22 | public @NotNull PathfinderFlag[] getFlags() { 23 | return new PathfinderFlag[] { PathfinderFlag.JUMPING, PathfinderFlag.MOVEMENT }; 24 | } 25 | 26 | @Override 27 | public String getInternalName() { 28 | return "PathfinderGoalTradeWithPlayer"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /nms/1_17_R1/src/main/java/me/gamercoder215/mobchip/bukkit/BukkitAxolotlBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.AxolotlBehavior; 4 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 5 | import org.bukkit.entity.Axolotl; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | class BukkitAxolotlBehavior extends BukkitUpdatableCreatureBehavior implements AxolotlBehavior { 9 | 10 | final Axolotl m; 11 | 12 | public BukkitAxolotlBehavior(Axolotl a) { 13 | super(a); 14 | this.m = a; 15 | } 16 | 17 | @Override 18 | public @NotNull BehaviorResult playDead() { 19 | return wrapper.runBehavior(m, "PlayDead", "net.minecraft.world.entity.animal.axolotl"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /nms/1_17_R1/src/test/java/me/gamercoder215/mobchip/abstraction/v1_17_R1/OptimizedSmallEnumSet1_17_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_17_R1; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_17_R1> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_17_R1(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_18_R1/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.18.1" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_17 21 | targetCompatibility = JavaVersion.VERSION_17 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_18_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_18_R1/BehaviorResult1_18_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_18_R1; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.Behavior; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | final class BehaviorResult1_18_R1 extends BehaviorResult { 11 | private final Behavior b; 12 | private final net.minecraft.world.entity.Mob mob; 13 | private final ServerLevel l; 14 | 15 | public BehaviorResult1_18_R1(Behavior b, net.minecraft.world.entity.Mob mob) { 16 | this.b = b; 17 | this.mob = mob; 18 | this.l = ChipUtil1_18_R1.toNMS(Bukkit.getWorld(mob.level.getWorld().getUID())); 19 | 20 | b.tryStart(l, mob, 0); 21 | } 22 | 23 | @Override 24 | public @NotNull Status getStatus() { 25 | return ChipUtil1_18_R1.fromNMS(b.getStatus()); 26 | } 27 | 28 | @Override 29 | public void stop() { 30 | b.doStop(l, mob, 0); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /nms/1_18_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_18_R1/CustomGoal1_18_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_18_R1; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | final class CustomGoal1_18_R1 extends Goal { 7 | 8 | private final CustomPathfinder p; 9 | 10 | public CustomGoal1_18_R1(CustomPathfinder p) { 11 | this.p = p; 12 | } 13 | 14 | @Override 15 | public boolean canUse() { 16 | return p.canStart(); 17 | } 18 | @Override 19 | public boolean canContinueToUse() { 20 | return p.canContinueToUse(); 21 | } 22 | @Override 23 | public boolean isInterruptable() { 24 | return p.canInterrupt(); 25 | } 26 | 27 | @Override 28 | public void start() { 29 | p.start(); 30 | } 31 | 32 | @Override 33 | public void tick() { 34 | p.tick(); 35 | } 36 | 37 | @Override 38 | public void stop() { 39 | p.stop(); 40 | } 41 | 42 | public CustomPathfinder getPathfinder() { 43 | return p; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /nms/1_18_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_18_R1/Sensor1_18_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_18_R1; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_18_R1 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_18_R1(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_18_R1.fromNMS(level), ChipUtil1_18_R1.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_18_R1::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_18_R1/src/test/java/me/gamercoder215/mobchip/abstraction/v1_18_R1/OptimizedSmallEnumSet1_18_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_18_R1; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_18_R1> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_18_R1(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_18_R2/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.18.2" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_17 21 | targetCompatibility = JavaVersion.VERSION_17 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_18_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_18_R2/BehaviorResult1_18_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_18_R2; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.Behavior; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | final class BehaviorResult1_18_R2 extends BehaviorResult { 11 | private final Behavior b; 12 | private final net.minecraft.world.entity.Mob mob; 13 | private final ServerLevel l; 14 | 15 | public BehaviorResult1_18_R2(Behavior b, net.minecraft.world.entity.Mob mob) { 16 | this.b = b; 17 | this.mob = mob; 18 | this.l = ChipUtil1_18_R2.toNMS(Bukkit.getWorld(mob.level.getWorld().getUID())); 19 | 20 | b.tryStart(l, mob, 0); 21 | } 22 | 23 | @Override 24 | public @NotNull Status getStatus() { 25 | return ChipUtil1_18_R2.fromNMS(b.getStatus()); 26 | } 27 | 28 | @Override 29 | public void stop() { 30 | b.doStop(l, mob, 0); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /nms/1_18_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_18_R2/CustomGoal1_18_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_18_R2; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | final class CustomGoal1_18_R2 extends Goal { 7 | 8 | private final CustomPathfinder p; 9 | 10 | public CustomGoal1_18_R2(CustomPathfinder p) { 11 | this.p = p; 12 | } 13 | 14 | @Override 15 | public boolean canUse() { 16 | return p.canStart(); 17 | } 18 | @Override 19 | public boolean canContinueToUse() { 20 | return p.canContinueToUse(); 21 | } 22 | @Override 23 | public boolean isInterruptable() { 24 | return p.canInterrupt(); 25 | } 26 | 27 | @Override 28 | public void start() { 29 | p.start(); 30 | } 31 | 32 | @Override 33 | public void tick() { 34 | p.tick(); 35 | } 36 | 37 | @Override 38 | public void stop() { 39 | p.stop(); 40 | } 41 | 42 | public CustomPathfinder getPathfinder() { 43 | return p; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /nms/1_18_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_18_R2/Sensor1_18_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_18_R2; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_18_R2 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_18_R2(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_18_R2.fromNMS(level), ChipUtil1_18_R2.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_18_R2::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_18_R2/src/test/java/me/gamercoder215/mobchip/abstraction/v1_18_R2/OptimizedSmallEnumSet1_18_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_18_R2; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_18_R2> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_18_R2(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_19_R1/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.19.2" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_17 21 | targetCompatibility = JavaVersion.VERSION_17 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_19_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R1/BehaviorResult1_19_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R1; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.Behavior; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | final class BehaviorResult1_19_R1 extends BehaviorResult { 11 | private final Behavior b; 12 | private final net.minecraft.world.entity.Mob mob; 13 | private final ServerLevel l; 14 | 15 | public BehaviorResult1_19_R1(Behavior b, net.minecraft.world.entity.Mob mob) { 16 | this.b = b; 17 | this.mob = mob; 18 | this.l = ChipUtil1_19_R1.toNMS(Bukkit.getWorld(mob.level.getWorld().getUID())); 19 | 20 | b.tryStart(l, mob, 0); 21 | } 22 | 23 | @Override 24 | public @NotNull Status getStatus() { 25 | return ChipUtil1_19_R1.fromNMS(b.getStatus()); 26 | } 27 | 28 | @Override 29 | public void stop() { 30 | b.doStop(l, mob, 0); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /nms/1_19_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R1/CustomGoal1_19_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R1; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | final class CustomGoal1_19_R1 extends Goal { 7 | 8 | private final CustomPathfinder p; 9 | 10 | public CustomGoal1_19_R1(CustomPathfinder p) { 11 | this.p = p; 12 | } 13 | 14 | @Override 15 | public boolean canUse() { 16 | return p.canStart(); 17 | } 18 | @Override 19 | public boolean canContinueToUse() { 20 | return p.canContinueToUse(); 21 | } 22 | @Override 23 | public boolean isInterruptable() { 24 | return p.canInterrupt(); 25 | } 26 | 27 | @Override 28 | public void start() { 29 | p.start(); 30 | } 31 | 32 | @Override 33 | public void tick() { 34 | p.tick(); 35 | } 36 | 37 | @Override 38 | public void stop() { 39 | p.stop(); 40 | } 41 | 42 | public CustomPathfinder getPathfinder() { 43 | return p; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_19_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R1/Sensor1_19_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R1; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_19_R1 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_19_R1(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, net.minecraft.world.entity.LivingEntity en) { 21 | s.run(ChipUtil1_19_R1.fromNMS(level), ChipUtil1_19_R1.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_19_R1::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_19_R1/src/main/java/me/gamercoder215/mobchip/bukkit/BukkitAllayBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.AllayBehavior; 4 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 5 | import org.bukkit.Location; 6 | import org.bukkit.entity.Allay; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | class BukkitAllayBehavior extends BukkitUpdatableCreatureBehavior implements AllayBehavior { 10 | 11 | final Allay m; 12 | 13 | BukkitAllayBehavior(Allay m) { 14 | super(m); 15 | this.m = m; 16 | } 17 | 18 | @Override 19 | public @NotNull BehaviorResult hearNoteblock(@NotNull Location loc) { 20 | return wrapper.hearNoteblock(m, loc); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /nms/1_19_R1/src/main/java/me/gamercoder215/mobchip/bukkit/BukkitFrogBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import me.gamercoder215.mobchip.ai.behavior.FrogBehavior; 5 | import org.bukkit.Sound; 6 | import org.bukkit.entity.Frog; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | class BukkitFrogBehavior extends BukkitUpdatableCreatureBehavior implements FrogBehavior { 10 | 11 | final Frog m; 12 | 13 | public BukkitFrogBehavior(Frog f) { 14 | super(f); 15 | this.m = f; 16 | } 17 | 18 | @Override 19 | public @NotNull BehaviorResult shootTongue(Sound tongueSound, Sound eatSound) { 20 | return wrapper.runBehavior(m, "ShootTongue", "net.minecraft.world.entity.animal.frog", tongueSound, eatSound); 21 | } 22 | 23 | @Override 24 | public @NotNull BehaviorResult croak() { 25 | return run("Croak"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /nms/1_19_R1/src/test/java/me/gamercoder215/mobchip/abstraction/v1_19_R1/OptimizedSmallEnumSet1_19_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R1; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_19_R1> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_19_R1(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_19_R2/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.19.3" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_17 21 | targetCompatibility = JavaVersion.VERSION_17 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_19_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R2/BehaviorResult1_19_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R2; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_19_R2 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_19_R2(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_19_R2.toNMS(Bukkit.getWorld(mob.level.getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_19_R2.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_19_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R2/CustomGoal1_19_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R2; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | final class CustomGoal1_19_R2 extends Goal { 7 | 8 | private final CustomPathfinder p; 9 | 10 | public CustomGoal1_19_R2(CustomPathfinder p) { 11 | this.p = p; 12 | } 13 | 14 | @Override 15 | public boolean canUse() { 16 | return p.canStart(); 17 | } 18 | @Override 19 | public boolean canContinueToUse() { 20 | return p.canContinueToUse(); 21 | } 22 | @Override 23 | public boolean isInterruptable() { 24 | return p.canInterrupt(); 25 | } 26 | 27 | @Override 28 | public void start() { 29 | p.start(); 30 | } 31 | 32 | @Override 33 | public void tick() { 34 | p.tick(); 35 | } 36 | 37 | @Override 38 | public void stop() { 39 | p.stop(); 40 | } 41 | 42 | public CustomPathfinder getPathfinder() { 43 | return p; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_19_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R2/Sensor1_19_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R2; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_19_R2 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_19_R2(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, net.minecraft.world.entity.LivingEntity en) { 21 | s.run(ChipUtil1_19_R2.fromNMS(level), ChipUtil1_19_R2.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_19_R2::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_19_R2/src/test/java/me/gamercoder215/mobchip/abstraction/v1_19_R2/OptimizedSmallEnumSet1_19_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R2; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_19_R2> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_19_R2(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_19_R3/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.19.4" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_17 21 | targetCompatibility = JavaVersion.VERSION_17 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_19_R3/src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R3/BehaviorResult1_19_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R3; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_19_R3 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_19_R3(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_19_R3.toNMS(Bukkit.getWorld(mob.level.getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_19_R3.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_19_R3/src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R3/CustomGoal1_19_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R3; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | final class CustomGoal1_19_R3 extends Goal { 7 | 8 | private final CustomPathfinder p; 9 | 10 | public CustomGoal1_19_R3(CustomPathfinder p) { 11 | this.p = p; 12 | } 13 | 14 | @Override 15 | public boolean canUse() { 16 | return p.canStart(); 17 | } 18 | @Override 19 | public boolean canContinueToUse() { 20 | return p.canContinueToUse(); 21 | } 22 | @Override 23 | public boolean isInterruptable() { 24 | return p.canInterrupt(); 25 | } 26 | 27 | @Override 28 | public void start() { 29 | p.start(); 30 | } 31 | 32 | @Override 33 | public void tick() { 34 | p.tick(); 35 | } 36 | 37 | @Override 38 | public void stop() { 39 | p.stop(); 40 | } 41 | 42 | public CustomPathfinder getPathfinder() { 43 | return p; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_19_R3/src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R3/Sensor1_19_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R3; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_19_R3 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_19_R3(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, net.minecraft.world.entity.LivingEntity en) { 21 | s.run(ChipUtil1_19_R3.fromNMS(level), ChipUtil1_19_R3.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_19_R3::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_19_R3/src/test/java/me/gamercoder215/mobchip/abstraction/v1_19_R3/OptimizedSmallEnumSet1_19_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_19_R3; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_19_R3> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_19_R3(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_20_R1/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.20.1" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_17 21 | targetCompatibility = JavaVersion.VERSION_17 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_20_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R1/BehaviorResult1_20_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R1; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_20_R1 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_20_R1(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_20_R1.toNMS(Bukkit.getWorld(mob.getCommandSenderWorld().getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_20_R1.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_20_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R1/CustomGoal1_20_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R1; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | final class CustomGoal1_20_R1 extends Goal { 7 | 8 | private final CustomPathfinder p; 9 | 10 | public CustomGoal1_20_R1(CustomPathfinder p) { 11 | this.p = p; 12 | } 13 | 14 | @Override 15 | public boolean canUse() { 16 | return p.canStart(); 17 | } 18 | @Override 19 | public boolean canContinueToUse() { 20 | return p.canContinueToUse(); 21 | } 22 | @Override 23 | public boolean isInterruptable() { 24 | return p.canInterrupt(); 25 | } 26 | 27 | @Override 28 | public void start() { 29 | p.start(); 30 | } 31 | 32 | @Override 33 | public void tick() { 34 | p.tick(); 35 | } 36 | 37 | @Override 38 | public void stop() { 39 | p.stop(); 40 | } 41 | 42 | public CustomPathfinder getPathfinder() { 43 | return p; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_20_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R1/Sensor1_20_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R1; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_20_R1 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_20_R1(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_20_R1.fromNMS(level), ChipUtil1_20_R1.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_20_R1::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_20_R1/src/main/java/me/gamercoder215/mobchip/bukkit/BukkitCamelBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.CamelBehavior; 4 | import org.bukkit.entity.Camel; 5 | 6 | class BukkitCamelBehavior extends BukkitUpdatableCreatureBehavior implements CamelBehavior { 7 | 8 | final Camel m; 9 | 10 | public BukkitCamelBehavior(Camel m) { 11 | super(m); 12 | this.m = m; 13 | } 14 | 15 | @Override 16 | public void sit(int minimalPoseTicks) { 17 | wrapper.runBehavior(m, "CamelAi$RandomSitting", "net.minecraft.world.entity.animal.camel", minimalPoseTicks); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /nms/1_20_R1/src/test/java/me/gamercoder215/mobchip/abstraction/v1_20_R1/OptimizedSmallEnumSet1_20_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R1; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_20_R1> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_20_R1(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_20_R2/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.20.2" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_17 21 | targetCompatibility = JavaVersion.VERSION_17 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_20_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R2/BehaviorResult1_20_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R2; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_20_R2 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_20_R2(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_20_R2.toNMS(Bukkit.getWorld(mob.getCommandSenderWorld().getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_20_R2.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_20_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R2/CustomGoal1_20_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R2; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | final class CustomGoal1_20_R2 extends Goal { 7 | 8 | private final CustomPathfinder p; 9 | 10 | public CustomGoal1_20_R2(CustomPathfinder p) { 11 | this.p = p; 12 | } 13 | 14 | @Override 15 | public boolean canUse() { 16 | return p.canStart(); 17 | } 18 | @Override 19 | public boolean canContinueToUse() { 20 | return p.canContinueToUse(); 21 | } 22 | @Override 23 | public boolean isInterruptable() { 24 | return p.canInterrupt(); 25 | } 26 | 27 | @Override 28 | public void start() { 29 | p.start(); 30 | } 31 | 32 | @Override 33 | public void tick() { 34 | p.tick(); 35 | } 36 | 37 | @Override 38 | public void stop() { 39 | p.stop(); 40 | } 41 | 42 | public CustomPathfinder getPathfinder() { 43 | return p; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_20_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R2/Sensor1_20_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R2; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_20_R2 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_20_R2(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_20_R2.fromNMS(level), ChipUtil1_20_R2.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_20_R2::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_20_R2/src/test/java/me/gamercoder215/mobchip/abstraction/v1_20_R2/OptimizedSmallEnumSet1_20_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R2; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_20_R2> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_20_R2(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_20_R3/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.20.4" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_17 21 | targetCompatibility = JavaVersion.VERSION_17 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_20_R3/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R3/BehaviorResult1_20_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R3; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_20_R3 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_20_R3(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_20_R3.toNMS(Bukkit.getWorld(mob.getCommandSenderWorld().getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_20_R3.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_20_R3/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R3/CustomGoal1_20_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R3; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | final class CustomGoal1_20_R3 extends Goal { 7 | 8 | private final CustomPathfinder p; 9 | 10 | public CustomGoal1_20_R3(CustomPathfinder p) { 11 | this.p = p; 12 | } 13 | 14 | @Override 15 | public boolean canUse() { 16 | return p.canStart(); 17 | } 18 | @Override 19 | public boolean canContinueToUse() { 20 | return p.canContinueToUse(); 21 | } 22 | @Override 23 | public boolean isInterruptable() { 24 | return p.canInterrupt(); 25 | } 26 | 27 | @Override 28 | public void start() { 29 | p.start(); 30 | } 31 | 32 | @Override 33 | public void tick() { 34 | p.tick(); 35 | } 36 | 37 | @Override 38 | public void stop() { 39 | p.stop(); 40 | } 41 | 42 | public CustomPathfinder getPathfinder() { 43 | return p; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_20_R3/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R3/Sensor1_20_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R3; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_20_R3 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_20_R3(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_20_R3.fromNMS(level), ChipUtil1_20_R3.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_20_R3::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_20_R3/src/main/java/me/gamercoder215/mobchip/bukkit/BukkitBreezeBehavior.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.bukkit; 2 | 3 | import org.bukkit.entity.Breeze; 4 | 5 | import me.gamercoder215.mobchip.ai.behavior.BreezeBehavior; 6 | 7 | class BukkitBreezeBehavior extends BukkitUpdatableCreatureBehavior implements BreezeBehavior { 8 | 9 | final Breeze m; 10 | 11 | public BukkitBreezeBehavior(Breeze m) { 12 | super(m); 13 | this.m = m; 14 | } 15 | 16 | @Override 17 | public void longJump() { 18 | wrapper.runBehavior(m, "LongJump", "net.minecraft.world.entity.monster.breeze"); 19 | } 20 | 21 | @Override 22 | public void shoot() { 23 | wrapper.runBehavior(m, "Shoot", "net.minecraft.world.entity.monster.breeze"); 24 | } 25 | 26 | @Override 27 | public void slide() { 28 | wrapper.runBehavior(m, "Slide", "net.minecraft.world.entity.monster.breeze"); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /nms/1_20_R3/src/test/java/me/gamercoder215/mobchip/abstraction/v1_20_R3/OptimizedSmallEnumSet1_20_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R3; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_20_R3> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_20_R3(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_20_R4/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.20.6" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_21 21 | targetCompatibility = JavaVersion.VERSION_21 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_20_R4/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R4/BehaviorResult1_20_R4.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R4; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_20_R4 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_20_R4(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_20_R4.toNMS(Bukkit.getWorld(mob.getCommandSenderWorld().getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_20_R4.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_20_R4/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R4/CustomGoal1_20_R4.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R4; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | final class CustomGoal1_20_R4 extends Goal { 7 | 8 | private final CustomPathfinder p; 9 | 10 | public CustomGoal1_20_R4(CustomPathfinder p) { 11 | this.p = p; 12 | } 13 | 14 | @Override 15 | public boolean canUse() { 16 | return p.canStart(); 17 | } 18 | @Override 19 | public boolean canContinueToUse() { 20 | return p.canContinueToUse(); 21 | } 22 | @Override 23 | public boolean isInterruptable() { 24 | return p.canInterrupt(); 25 | } 26 | 27 | @Override 28 | public void start() { 29 | p.start(); 30 | } 31 | 32 | @Override 33 | public void tick() { 34 | p.tick(); 35 | } 36 | 37 | @Override 38 | public void stop() { 39 | p.stop(); 40 | } 41 | 42 | public CustomPathfinder getPathfinder() { 43 | return p; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_20_R4/src/main/java/me/gamercoder215/mobchip/abstraction/v1_20_R4/Sensor1_20_R4.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R4; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_20_R4 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_20_R4(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_20_R4.fromNMS(level), ChipUtil1_20_R4.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_20_R4::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_20_R4/src/test/java/me/gamercoder215/mobchip/abstraction/v1_20_R4/OptimizedSmallEnumSet1_20_R4.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_20_R4; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_20_R4> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_20_R4(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_21_R1/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.21.1" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_21 21 | targetCompatibility = JavaVersion.VERSION_21 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_21_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R1/BehaviorResult1_21_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R1; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_21_R1 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_21_R1(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_21_R1.toNMS(Bukkit.getWorld(mob.getCommandSenderWorld().getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_21_R1.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R1/CustomGoal1_21_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R1; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | import java.util.Arrays; 7 | import java.util.EnumSet; 8 | 9 | final class CustomGoal1_21_R1 extends Goal { 10 | 11 | private final CustomPathfinder p; 12 | 13 | public CustomGoal1_21_R1(CustomPathfinder p) { 14 | this.p = p; 15 | EnumSet set = EnumSet.noneOf(Goal.Flag.class); 16 | Arrays.stream(p.getFlags()).map(ChipUtil1_21_R1::toNMS).forEach(set::add); 17 | setFlags(set); 18 | } 19 | 20 | @Override 21 | public boolean canUse() { 22 | return p.canStart(); 23 | } 24 | @Override 25 | public boolean canContinueToUse() { 26 | return p.canContinueToUse(); 27 | } 28 | @Override 29 | public boolean isInterruptable() { 30 | return p.canInterrupt(); 31 | } 32 | 33 | @Override 34 | public void start() { 35 | p.start(); 36 | } 37 | 38 | @Override 39 | public void tick() { 40 | p.tick(); 41 | } 42 | 43 | @Override 44 | public void stop() { 45 | p.stop(); 46 | } 47 | 48 | public CustomPathfinder getPathfinder() { 49 | return p; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /nms/1_21_R1/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R1/Sensor1_21_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R1; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_21_R1 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_21_R1(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_21_R1.fromNMS(level), ChipUtil1_21_R1.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_21_R1::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R1/src/test/java/me/gamercoder215/mobchip/abstraction/v1_21_R1/OptimizedSmallEnumSet1_21_R1.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R1; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_21_R1> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_21_R1(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_21_R2/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.21.3" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_21 21 | targetCompatibility = JavaVersion.VERSION_21 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_21_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R2/BehaviorResult1_21_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R2; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_21_R2 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_21_R2(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_21_R2.toNMS(Bukkit.getWorld(mob.getCommandSenderWorld().getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_21_R2.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R2/CustomGoal1_21_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R2; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | import java.util.Arrays; 7 | import java.util.EnumSet; 8 | 9 | final class CustomGoal1_21_R2 extends Goal { 10 | 11 | private final CustomPathfinder p; 12 | 13 | public CustomGoal1_21_R2(CustomPathfinder p) { 14 | this.p = p; 15 | EnumSet set = EnumSet.noneOf(Goal.Flag.class); 16 | Arrays.stream(p.getFlags()).map(ChipUtil1_21_R2::toNMS).forEach(set::add); 17 | setFlags(set); 18 | } 19 | 20 | @Override 21 | public boolean canUse() { 22 | return p.canStart(); 23 | } 24 | @Override 25 | public boolean canContinueToUse() { 26 | return p.canContinueToUse(); 27 | } 28 | @Override 29 | public boolean isInterruptable() { 30 | return p.canInterrupt(); 31 | } 32 | 33 | @Override 34 | public void start() { 35 | p.start(); 36 | } 37 | 38 | @Override 39 | public void tick() { 40 | p.tick(); 41 | } 42 | 43 | @Override 44 | public void stop() { 45 | p.stop(); 46 | } 47 | 48 | public CustomPathfinder getPathfinder() { 49 | return p; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /nms/1_21_R2/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R2/Sensor1_21_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R2; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_21_R2 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_21_R2(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_21_R2.fromNMS(level), ChipUtil1_21_R2.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_21_R2::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R2/src/test/java/me/gamercoder215/mobchip/abstraction/v1_21_R2/OptimizedSmallEnumSet1_21_R2.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R2; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_21_R2> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_21_R2(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_21_R3/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.21.4" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_21 21 | targetCompatibility = JavaVersion.VERSION_21 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_21_R3/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R3/BehaviorResult1_21_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R3; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_21_R3 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_21_R3(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_21_R3.toNMS(Bukkit.getWorld(mob.getCommandSenderWorld().getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_21_R3.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R3/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R3/CustomGoal1_21_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R3; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | import java.util.Arrays; 7 | import java.util.EnumSet; 8 | 9 | final class CustomGoal1_21_R3 extends Goal { 10 | 11 | private final CustomPathfinder p; 12 | 13 | public CustomGoal1_21_R3(CustomPathfinder p) { 14 | this.p = p; 15 | EnumSet set = EnumSet.noneOf(Goal.Flag.class); 16 | Arrays.stream(p.getFlags()).map(ChipUtil1_21_R3::toNMS).forEach(set::add); 17 | setFlags(set); 18 | } 19 | 20 | @Override 21 | public boolean canUse() { 22 | return p.canStart(); 23 | } 24 | @Override 25 | public boolean canContinueToUse() { 26 | return p.canContinueToUse(); 27 | } 28 | @Override 29 | public boolean isInterruptable() { 30 | return p.canInterrupt(); 31 | } 32 | 33 | @Override 34 | public void start() { 35 | p.start(); 36 | } 37 | 38 | @Override 39 | public void tick() { 40 | p.tick(); 41 | } 42 | 43 | @Override 44 | public void stop() { 45 | p.stop(); 46 | } 47 | 48 | public CustomPathfinder getPathfinder() { 49 | return p; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /nms/1_21_R3/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R3/Sensor1_21_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R3; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_21_R3 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_21_R3(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_21_R3.fromNMS(level), ChipUtil1_21_R3.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_21_R3::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R3/src/test/java/me/gamercoder215/mobchip/abstraction/v1_21_R3/OptimizedSmallEnumSet1_21_R3.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R3; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_21_R3> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_21_R3(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_21_R4/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.21.5" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_21 21 | targetCompatibility = JavaVersion.VERSION_21 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_21_R4/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R4/BehaviorResult1_21_R4.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R4; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_21_R4 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_21_R4(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_21_R4.toNMS(Bukkit.getWorld(mob.getCommandSenderWorld().getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_21_R4.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R4/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R4/CustomGoal1_21_R4.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R4; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | import java.util.Arrays; 7 | import java.util.EnumSet; 8 | 9 | final class CustomGoal1_21_R4 extends Goal { 10 | 11 | private final CustomPathfinder p; 12 | 13 | public CustomGoal1_21_R4(CustomPathfinder p) { 14 | this.p = p; 15 | EnumSet set = EnumSet.noneOf(Goal.Flag.class); 16 | Arrays.stream(p.getFlags()).map(ChipUtil1_21_R4::toNMS).forEach(set::add); 17 | setFlags(set); 18 | } 19 | 20 | @Override 21 | public boolean canUse() { 22 | return p.canStart(); 23 | } 24 | @Override 25 | public boolean canContinueToUse() { 26 | return p.canContinueToUse(); 27 | } 28 | @Override 29 | public boolean isInterruptable() { 30 | return p.canInterrupt(); 31 | } 32 | 33 | @Override 34 | public void start() { 35 | p.start(); 36 | } 37 | 38 | @Override 39 | public void tick() { 40 | p.tick(); 41 | } 42 | 43 | @Override 44 | public void stop() { 45 | p.stop(); 46 | } 47 | 48 | public CustomPathfinder getPathfinder() { 49 | return p; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /nms/1_21_R4/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R4/Sensor1_21_R4.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R4; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_21_R4 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_21_R4(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_21_R4.fromNMS(level), ChipUtil1_21_R4.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_21_R4::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R4/src/test/java/me/gamercoder215/mobchip/abstraction/v1_21_R4/OptimizedSmallEnumSet1_21_R4.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R4; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_21_R4> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_21_R4(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_21_R5/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.21.7" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_21 21 | targetCompatibility = JavaVersion.VERSION_21 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_21_R5/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R5/BehaviorResult1_21_R5.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R5; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_21_R5 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_21_R5(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_21_R5.toNMS(Bukkit.getWorld(mob.level().getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_21_R5.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R5/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R5/CustomGoal1_21_R5.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R5; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | import java.util.Arrays; 7 | import java.util.EnumSet; 8 | 9 | final class CustomGoal1_21_R5 extends Goal { 10 | 11 | private final CustomPathfinder p; 12 | 13 | public CustomGoal1_21_R5(CustomPathfinder p) { 14 | this.p = p; 15 | EnumSet set = EnumSet.noneOf(Goal.Flag.class); 16 | Arrays.stream(p.getFlags()).map(ChipUtil1_21_R5::toNMS).forEach(set::add); 17 | setFlags(set); 18 | } 19 | 20 | @Override 21 | public boolean canUse() { 22 | return p.canStart(); 23 | } 24 | @Override 25 | public boolean canContinueToUse() { 26 | return p.canContinueToUse(); 27 | } 28 | @Override 29 | public boolean isInterruptable() { 30 | return p.canInterrupt(); 31 | } 32 | 33 | @Override 34 | public void start() { 35 | p.start(); 36 | } 37 | 38 | @Override 39 | public void tick() { 40 | p.tick(); 41 | } 42 | 43 | @Override 44 | public void stop() { 45 | p.stop(); 46 | } 47 | 48 | public CustomPathfinder getPathfinder() { 49 | return p; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /nms/1_21_R5/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R5/Sensor1_21_R5.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R5; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_21_R5 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_21_R5(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_21_R5.fromNMS(level), ChipUtil1_21_R5.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_21_R5::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R5/src/test/java/me/gamercoder215/mobchip/abstraction/v1_21_R5/OptimizedSmallEnumSet1_21_R5.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R5; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_21_R5> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_21_R5(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /nms/1_21_R6/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | import io.github.patrick.gradle.remapper.RemapTask 3 | 4 | plugins { 5 | id("io.github.patrick.remapper") version "1.4.1" 6 | } 7 | 8 | val mcVersion = "1.21.10" 9 | 10 | dependencies { 11 | api(project(":mobchip-base")) 12 | api(project(":mobchip-abstraction")) 13 | api(project(":mobchip-1_17_R1")) 14 | 15 | compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 16 | testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang") 17 | } 18 | 19 | java { 20 | sourceCompatibility = JavaVersion.VERSION_21 21 | targetCompatibility = JavaVersion.VERSION_21 22 | } 23 | 24 | tasks { 25 | assemble { 26 | dependsOn("remap") 27 | } 28 | 29 | remap { 30 | dependsOn("shadowJar") 31 | 32 | inputTask.set(getByName("shadowJar")) 33 | version.set(mcVersion) 34 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 35 | archiveName.set("${project.name}-${project.version}.jar") 36 | } 37 | } -------------------------------------------------------------------------------- /nms/1_21_R6/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R6/BehaviorResult1_21_R6.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R6; 2 | 3 | import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.entity.ai.behavior.BehaviorControl; 7 | import org.bukkit.Bukkit; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | @SuppressWarnings({"unchecked", "rawtypes"}) 11 | final class BehaviorResult1_21_R6 extends BehaviorResult { 12 | private final BehaviorControl b; 13 | private final LivingEntity mob; 14 | private final ServerLevel l; 15 | 16 | public BehaviorResult1_21_R6(BehaviorControl b, T mob) { 17 | this.b = b; 18 | this.mob = mob; 19 | this.l = ChipUtil1_21_R6.toNMS(Bukkit.getWorld(mob.level().getWorld().getUID())); 20 | 21 | b.tryStart(l, mob, 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Status getStatus() { 26 | return ChipUtil1_21_R6.fromNMS(b.getStatus()); 27 | } 28 | 29 | @Override 30 | public void stop() { 31 | b.doStop(l, mob, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R6/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R6/CustomGoal1_21_R6.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R6; 2 | 3 | import me.gamercoder215.mobchip.ai.goal.CustomPathfinder; 4 | import net.minecraft.world.entity.ai.goal.Goal; 5 | 6 | import java.util.Arrays; 7 | import java.util.EnumSet; 8 | 9 | final class CustomGoal1_21_R6 extends Goal { 10 | 11 | private final CustomPathfinder p; 12 | 13 | public CustomGoal1_21_R6(CustomPathfinder p) { 14 | this.p = p; 15 | EnumSet set = EnumSet.noneOf(Goal.Flag.class); 16 | Arrays.stream(p.getFlags()).map(ChipUtil1_21_R6::toNMS).forEach(set::add); 17 | setFlags(set); 18 | } 19 | 20 | @Override 21 | public boolean canUse() { 22 | return p.canStart(); 23 | } 24 | @Override 25 | public boolean canContinueToUse() { 26 | return p.canContinueToUse(); 27 | } 28 | @Override 29 | public boolean isInterruptable() { 30 | return p.canInterrupt(); 31 | } 32 | 33 | @Override 34 | public void start() { 35 | p.start(); 36 | } 37 | 38 | @Override 39 | public void tick() { 40 | p.tick(); 41 | } 42 | 43 | @Override 44 | public void stop() { 45 | p.stop(); 46 | } 47 | 48 | public CustomPathfinder getPathfinder() { 49 | return p; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /nms/1_21_R6/src/main/java/me/gamercoder215/mobchip/abstraction/v1_21_R6/Sensor1_21_R6.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R6; 2 | 3 | import net.minecraft.server.level.ServerLevel; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.entity.ai.memory.MemoryModuleType; 6 | import net.minecraft.world.entity.ai.sensing.Sensor; 7 | 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | final class Sensor1_21_R6 extends Sensor { 12 | 13 | private final me.gamercoder215.mobchip.ai.sensing.Sensor s; 14 | 15 | public Sensor1_21_R6(me.gamercoder215.mobchip.ai.sensing.Sensor s) { 16 | this.s = s; 17 | } 18 | 19 | @Override 20 | protected void doTick(ServerLevel level, LivingEntity en) { 21 | s.run(ChipUtil1_21_R6.fromNMS(level), ChipUtil1_21_R6.fromNMS(en)); 22 | } 23 | 24 | @Override 25 | public Set> requires() { 26 | return s.required().stream().map(ChipUtil1_21_R6::toNMS).collect(Collectors.toSet()); 27 | } 28 | 29 | public me.gamercoder215.mobchip.ai.sensing.Sensor getSensor() { 30 | return s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_21_R6/src/test/java/me/gamercoder215/mobchip/abstraction/v1_21_R6/OptimizedSmallEnumSet1_21_R6.java: -------------------------------------------------------------------------------- 1 | package me.gamercoder215.mobchip.abstraction.v1_21_R6; 2 | 3 | // Copied from PaperMC: com/destroystokyo/paper/util/set/OptimizedSmallEnumSet 4 | // Used for Testing Purposes 5 | 6 | public final class OptimizedSmallEnumSet1_21_R6> { 7 | private long backingSet; 8 | 9 | public OptimizedSmallEnumSet1_21_R6(Class clazz) { 10 | if (clazz == null) { 11 | throw new IllegalArgumentException("Null class"); 12 | } else if (!clazz.isEnum()) { 13 | throw new IllegalArgumentException("Class must be enum, not " + clazz.getCanonicalName()); 14 | } else { 15 | } 16 | } 17 | 18 | public boolean addUnchecked(E element) { 19 | int ordinal = element.ordinal(); 20 | long key = 1L << ordinal; 21 | long prev = this.backingSet; 22 | this.backingSet = prev | key; 23 | return (prev & key) == 0L; 24 | } 25 | 26 | public boolean removeUnchecked(E element) { 27 | int ordinal = element.ordinal(); 28 | long key = 1L << ordinal; 29 | long prev = this.backingSet; 30 | this.backingSet = prev & ~key; 31 | return (prev & key) != 0L; 32 | } 33 | 34 | public void clear() { 35 | this.backingSet = 0L; 36 | } 37 | 38 | public int size() { 39 | return Long.bitCount(this.backingSet); 40 | } 41 | 42 | public long getBackingSet() { 43 | return this.backingSet; 44 | } 45 | 46 | public boolean hasElement(E element) { 47 | return (this.backingSet & 1L << element.ordinal()) != 0L; 48 | } 49 | } -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "mobchip-parent" 2 | 3 | pluginManagement { 4 | repositories { 5 | gradlePluginPortal() 6 | mavenCentral() 7 | mavenLocal() 8 | } 9 | } 10 | 11 | listOf("base", "abstraction", "bukkit").forEach { 12 | include(":mobchip-$it") 13 | project(":mobchip-$it").projectDir = rootDir.resolve(it) 14 | } 15 | 16 | mapOf( 17 | "1_17_R1" to 17, 18 | "1_18_R1" to 17, 19 | "1_18_R2" to 17, 20 | "1_19_R1" to 17, 21 | "1_19_R2" to 17, 22 | "1_19_R3" to 17, 23 | "1_20_R1" to 17, 24 | "1_20_R2" to 17, 25 | "1_20_R3" to 17, 26 | "1_20_R4" to 21, 27 | "1_21_R1" to 21, 28 | "1_21_R2" to 21, 29 | "1_21_R3" to 21, 30 | "1_21_R4" to 21, 31 | "1_21_R5" to 21, 32 | "1_21_R6" to 21, 33 | ).forEach { 34 | val id = it.key 35 | 36 | include(":mobchip-$id") 37 | project(":mobchip-$id").projectDir = rootDir.resolve("nms/$id") 38 | } --------------------------------------------------------------------------------