Goat ram API

This commit is contained in:
Seggan 2021-08-05 13:10:27 -04:00
parent 26d0751f8e
commit 4e20ba8bf7
2 changed files with 23 additions and 0 deletions

View File

@ -38,3 +38,19 @@
player.setItemInHand(hand, itemstack1);
return InteractionResult.SUCCESS;
@@ -383,4 +395,15 @@
public static boolean checkGoatSpawnRules(EntityType<? extends Animal> entityType, LevelAccessor world, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random) {
return world.getBlockState(pos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos);
}
+
+ // Paper start - Goat ram API
+ public void ram(net.minecraft.world.entity.LivingEntity entity) {
+ Brain<Goat> brain = this.getBrain();
+ brain.setMemory(MemoryModuleType.RAM_TARGET, entity.position());
+ brain.eraseMemory(MemoryModuleType.RAM_COOLDOWN_TICKS);
+ brain.eraseMemory(MemoryModuleType.BREED_TARGET);
+ brain.eraseMemory(MemoryModuleType.TEMPTING_PLAYER);
+ brain.setActiveActivityIfPossible(net.minecraft.world.entity.schedule.Activity.RAM);
+ }
+ // Paper end - Goat ram API
}

View File

@ -48,4 +48,11 @@ public class CraftGoat extends CraftAnimals implements Goat {
public void setScreaming(boolean screaming) {
this.getHandle().setScreamingGoat(screaming);
}
// Paper start - Goat ram API
@Override
public void ram(@org.jetbrains.annotations.NotNull org.bukkit.entity.LivingEntity entity) {
this.getHandle().ram(((CraftLivingEntity) entity).getHandle());
}
// Paper end
}