Guest User

Untitled

a guest
Jan 8th, 2022
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.41 KB | None | 0 0
  1. package com.solegendary.ageofcraft.units;
  2.  
  3. import net.minecraft.core.BlockPos;
  4. import net.minecraft.sounds.SoundEvent;
  5. import net.minecraft.sounds.SoundEvents;
  6. import net.minecraft.sounds.SoundSource;
  7. import net.minecraft.world.Difficulty;
  8. import net.minecraft.world.damagesource.DamageSource;
  9. import net.minecraft.world.entity.EntityType;
  10. import net.minecraft.world.entity.Mob;
  11. import net.minecraft.world.entity.MobSpawnType;
  12. import net.minecraft.world.entity.PathfinderMob;
  13. import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
  14. import net.minecraft.world.entity.ai.attributes.Attributes;
  15. import net.minecraft.world.entity.animal.AbstractGolem;
  16. import net.minecraft.world.entity.npc.Villager;
  17. import net.minecraft.world.entity.player.Player;
  18. import net.minecraft.world.item.ItemStack;
  19. import net.minecraft.world.item.Items;
  20. import net.minecraft.world.item.ProjectileWeaponItem;
  21. import net.minecraft.world.level.*;
  22. import net.minecraft.world.entity.monster.Monster;
  23. import net.minecraft.world.entity.monster.Zombie;
  24.  
  25. import java.util.Random;
  26. import java.util.function.Predicate;
  27.  
  28. /**
  29.  * Parent class of all RTS units which allows for:
  30.  * - selection
  31.  * - movement
  32.  * - attacking
  33.  * - complex commands such as attack move, patrol, etc.
  34.  *
  35.  * @author SoLegendary
  36.  */
  37. public class Unit extends PathfinderMob {
  38.  
  39.     protected Unit(EntityType<? extends Unit> p_33002_, Level p_33003_) {
  40.         super(p_33002_, p_33003_);
  41.     }
  42.  
  43.     public SoundSource getSoundSource() {
  44.         return SoundSource.HOSTILE;
  45.     }
  46.  
  47.     public void aiStep() {
  48.         super.aiStep();
  49.     }
  50.  
  51.     protected SoundEvent getSwimSound() {
  52.         return SoundEvents.HOSTILE_SWIM;
  53.     }
  54.  
  55.     protected SoundEvent getSwimSplashSound() {
  56.         return SoundEvents.HOSTILE_SPLASH;
  57.     }
  58.  
  59.     protected SoundEvent getHurtSound(DamageSource p_33034_) {
  60.         return SoundEvents.HOSTILE_HURT;
  61.     }
  62.  
  63.     protected SoundEvent getDeathSound() {
  64.         return SoundEvents.HOSTILE_DEATH;
  65.     }
  66.  
  67.     protected SoundEvent getFallDamageSound(int p_33041_) {
  68.         return p_33041_ > 4 ? SoundEvents.HOSTILE_BIG_FALL : SoundEvents.HOSTILE_SMALL_FALL;
  69.     }
  70.  
  71.     public float getWalkTargetValue(BlockPos p_33013_, LevelReader p_33014_) {
  72.         return 0.5F - p_33014_.getBrightness(p_33013_);
  73.     }
  74.  
  75.     public static AttributeSupplier.Builder createUnitAttributes() {
  76.         return Mob.createMobAttributes();
  77.     }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment