mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-05 23:21:38 +01:00
Goat ram API
This commit is contained in:
parent
26d0751f8e
commit
4e20ba8bf7
@ -38,3 +38,19 @@
|
|||||||
|
|
||||||
player.setItemInHand(hand, itemstack1);
|
player.setItemInHand(hand, itemstack1);
|
||||||
return InteractionResult.SUCCESS;
|
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
|
||||||
|
}
|
||||||
|
@ -48,4 +48,11 @@ public class CraftGoat extends CraftAnimals implements Goat {
|
|||||||
public void setScreaming(boolean screaming) {
|
public void setScreaming(boolean screaming) {
|
||||||
this.getHandle().setScreamingGoat(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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user