Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.yakovliam.pets.pet.v1_12.pets.flying.bat;
- import net.minecraft.server.v1_12_R1.*;
- import org.bukkit.Location;
- import org.bukkit.entity.Player;
- import org.bukkit.util.Vector;
- public class PetEntityBat extends EntityBat {
- private Player owner;
- private BlockPosition b;
- public PetEntityBat(World world, Player owner) {
- super(world);
- this.owner = owner;
- }
- @Override
- protected void M() {
- if (isAsleep()) {
- return;
- }
- Location location = owner.getLocation();
- this.b = new BlockPosition((int) location.getX() + 2, (int) location.getY() + 1, (int) location.getZ() + 2);
- if (passengers.size() == 1) {
- Vector direction = owner.getLocation().getDirection();
- Location entityLocation = getBukkitEntity().getLocation();
- this.b = new BlockPosition(entityLocation.getX() + direction.getX(), entityLocation.getY() + direction.getY(), entityLocation.getZ() + direction.getZ());
- }
- double var3 = (double) this.b.getX() + 0.2D - this.locX;
- double var5 = (double) this.b.getY() + 0.1D - this.locY;
- double var7 = (double) this.b.getZ() + 0.2D - this.locZ;
- this.motX += (Math.signum(var3) * 0.5D - this.motX) * 0.10000000149011612D;
- this.motY += (Math.signum(var5) * 0.699999988079071D - this.motY) * 0.10000000149011612D;
- this.motZ += (Math.signum(var7) * 0.5D - this.motZ) * 0.10000000149011612D;
- if (passengers.size() == 1) {
- this.yaw = owner.getLocation().getYaw();
- } else {
- this.yaw = (owner.getLocation().getYaw() < 0 ? owner.getLocation().getYaw() : -owner.getLocation().getYaw());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement