-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed subtitles, fixed rascal tasks, improved rascal loot tables
- Loading branch information
Showing
7 changed files
with
121 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
.../faboslav/friendsandfoes/entity/ai/brain/task/rascal/RascalFindInteractionTargetTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.faboslav.friendsandfoes.entity.ai.brain.task.rascal; | ||
|
||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.ai.brain.EntityLookTarget; | ||
import net.minecraft.entity.ai.brain.MemoryModuleType; | ||
import net.minecraft.entity.ai.brain.task.Task; | ||
import net.minecraft.entity.ai.brain.task.TaskTriggerer; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
|
||
import java.util.Optional; | ||
|
||
public final class RascalFindInteractionTargetTask | ||
{ | ||
public static Task<LivingEntity> create(int maxDistance) { | ||
int squaredMaxDistance = maxDistance * maxDistance; | ||
return TaskTriggerer.task((context) -> { | ||
return context.group(context.queryMemoryOptional(MemoryModuleType.LOOK_TARGET), context.queryMemoryAbsent(MemoryModuleType.INTERACTION_TARGET), context.queryMemoryValue(MemoryModuleType.VISIBLE_MOBS)).apply(context, (lookTarget, interactionTarget, visibleMobs) -> { | ||
return (world, entity, time) -> { | ||
Optional<LivingEntity> optional = context.getValue(visibleMobs).findFirst((target) -> { | ||
return target.squaredDistanceTo(entity) <= (double)squaredMaxDistance && target instanceof PlayerEntity && !target.isSpectator() && !((PlayerEntity) target).isCreative(); | ||
}); | ||
|
||
if (optional.isEmpty()) { | ||
return false; | ||
} else { | ||
LivingEntity livingEntity = optional.get(); | ||
interactionTarget.remember(livingEntity); | ||
lookTarget.remember(new EntityLookTarget(livingEntity, true)); | ||
return true; | ||
} | ||
}; | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
common/src/main/java/com/faboslav/friendsandfoes/mixin/BundleItemAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.faboslav.friendsandfoes.mixin; | ||
|
||
import net.minecraft.item.BundleItem; | ||
import net.minecraft.item.ItemStack; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(BundleItem.class) | ||
public interface BundleItemAccessor | ||
{ | ||
@Invoker("addToBundle") | ||
int invokeAddToBundle( | ||
ItemStack bundle, | ||
ItemStack stack | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 55 additions & 54 deletions
109
common/src/main/resources/friendsandfoes-common.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,58 @@ | ||
{ | ||
"required": true, | ||
"package": "com.faboslav.friendsandfoes.mixin", | ||
"compatibilityLevel": "JAVA_17", | ||
"minVersion": "0.8", | ||
"injectors": { | ||
"defaultRequire": 1 | ||
}, | ||
"mixins": [ | ||
"AddCustomEntityPoseMixin", | ||
"AxeItemMixin", | ||
"BeeEntityAccessor", | ||
"BeeEntityMixin", | ||
"BeeEntityMoveToFlowerGoalMixin", | ||
"BeeEntityMoveToHiveGoalMixin", | ||
"BlazeEntityMixin", | ||
"BlazeLivingEntityMixin", | ||
"BlindTargetGoalFactory", | ||
"CarvedPumpkinBlockMixin", | ||
"ChickenEntityMixin", | ||
"HoneycombItemMixin", | ||
"IllusionerEntityMixin", | ||
"IllusionerHostileEntityMixin", | ||
"IllusionerRaiderEntityMixin", | ||
"IllusionerSpellcastingIllagerEntityMixin", | ||
"LightningEntityMixin", | ||
"LightningRodBlockDegradableMixin", | ||
"LightningRodBlockMixin", | ||
"LimbAnimatorAccessor", | ||
"PatrolSpawnerAccessor", | ||
"PatrolSpawnerMixin", | ||
"PlayerEntityMixin", | ||
"PointOfInterestTypesMixin", | ||
"RabbitEntityMixin", | ||
"RaidMemberMixin", | ||
"RaidMixin", | ||
"ServerWorldAccessor", | ||
"ServerWorldMixin", | ||
"SnowballEntityMixin", | ||
"SpawnRestrictionAccessor", | ||
"StrongholdGeneratorMixin", | ||
"StructurePoolAccessor", | ||
"TemptGoalMixin", | ||
"VillagerEntityMixin", | ||
"VillagerHostilesSensorMixin", | ||
"VillagerTaskListProviderMixin", | ||
"ZombieHorseAbstractHorseEntityMixin", | ||
"ZombieHorseAnimalEntityMixin", | ||
"ZombieHorseEntityMixin" | ||
], | ||
"client": [ | ||
"ClientPlayNetworkHandlerMixin", | ||
"EntityRenderDispatcherMixin", | ||
"IllusionerEntityRendererMixin", | ||
"ModelPartAccessor" | ||
"required": true, | ||
"package": "com.faboslav.friendsandfoes.mixin", | ||
"compatibilityLevel": "JAVA_17", | ||
"minVersion": "0.8", | ||
"injectors": { | ||
"defaultRequire": 1 | ||
}, | ||
"mixins": [ | ||
"AddCustomEntityPoseMixin", | ||
"AxeItemMixin", | ||
"BeeEntityAccessor", | ||
"BeeEntityMixin", | ||
"BeeEntityMoveToFlowerGoalMixin", | ||
"BeeEntityMoveToHiveGoalMixin", | ||
"BlazeEntityMixin", | ||
"BlazeLivingEntityMixin", | ||
"BlindTargetGoalFactory", | ||
"BundleItemAccessor", | ||
"CarvedPumpkinBlockMixin", | ||
"ChickenEntityMixin", | ||
"HoneycombItemMixin", | ||
"IllusionerEntityMixin", | ||
"IllusionerHostileEntityMixin", | ||
"IllusionerRaiderEntityMixin", | ||
"IllusionerSpellcastingIllagerEntityMixin", | ||
"LightningEntityMixin", | ||
"LightningRodBlockDegradableMixin", | ||
"LightningRodBlockMixin", | ||
"LimbAnimatorAccessor", | ||
"PatrolSpawnerAccessor", | ||
"PatrolSpawnerMixin", | ||
"PlayerEntityMixin", | ||
"PointOfInterestTypesMixin", | ||
"RabbitEntityMixin", | ||
"RaidMemberMixin", | ||
"RaidMixin", | ||
"ServerWorldAccessor", | ||
"ServerWorldMixin", | ||
"SnowballEntityMixin", | ||
"SpawnRestrictionAccessor", | ||
"StrongholdGeneratorMixin", | ||
"StructurePoolAccessor", | ||
"TemptGoalMixin", | ||
"VillagerEntityMixin", | ||
"VillagerHostilesSensorMixin", | ||
"VillagerTaskListProviderMixin", | ||
"ZombieHorseAbstractHorseEntityMixin", | ||
"ZombieHorseAnimalEntityMixin", | ||
"ZombieHorseEntityMixin" | ||
], | ||
"client": [ | ||
"ClientPlayNetworkHandlerMixin", | ||
"EntityRenderDispatcherMixin", | ||
"IllusionerEntityRendererMixin", | ||
"ModelPartAccessor" | ||
] | ||
} |