Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.sonniccub.racismmod.entity.ai;
- import com.sonniccub.racismmod.init.ModEntityTypes;
- import java.util.Random;
- import com.sonniccub.racismmod.client.entity.render.MissileRender;
- import com.sonniccub.racismmod.racismmod;
- import com.sonniccub.racismmod.entities.Missile;
- import net.minecraft.entity.CreatureEntity;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityType;
- import net.minecraft.entity.LivingEntity;
- import net.minecraft.entity.ai.goal.Goal;
- import net.minecraft.entity.monster.MonsterEntity;
- import net.minecraft.entity.player.PlayerEntity;
- import net.minecraft.world.World;
- import net.minecraftforge.fml.RegistryObject;
- public class BossBamaSummonGoal<T extends LivingEntity> extends Goal {
- protected final CreatureEntity attacker;
- private World world;
- public BossBamaSummonGoal(CreatureEntity creature, World worldIn) {
- this.attacker = creature;
- }
- @Override
- public boolean shouldExecute() {
- LivingEntity livingentity = this.attacker.getAttackTarget();
- if (livingentity == null) {
- return false;
- } else if (!livingentity.isAlive()) {
- return false;
- }
- else {
- return true;
- }
- }
- public boolean shouldContinueExecuting() {
- LivingEntity livingentity = this.attacker.getAttackTarget();
- if (livingentity == null) {
- return false;
- } else {
- return !(livingentity instanceof PlayerEntity) || !livingentity.isSpectator() && !((PlayerEntity)livingentity).isCreative();
- }
- }
- Random rd = new Random();
- public void startExecuting() {
- LivingEntity livingentity = this.attacker.getAttackTarget();
- this.attacker.setAggroed(true);
- for(int i = 0; i < rd.nextInt(10)+5; i++) {
- int rdZ = (int) ((livingentity.getPosZ())+rd.nextInt(7));
- int rdX = (int) ((livingentity.getPosX())+rd.nextInt(7));
- boolean negposX = rd.nextBoolean();
- boolean negposZ = rd.nextBoolean();
- if (negposX == true) {
- rdX = rdX-rdX*2;
- }
- if (negposZ == true) {
- rdZ = rdZ-rdZ*2;
- }
- spawnMissile(rdX, livingentity.getPosY()+7, rdZ);
- }
- }
- public void spawnMissile(double x, double y, double z) {
- Missile m1 = new Missile(ModEntityTypes.MISSILE_ENTITY.get(), world);
- world.addEntity(m1);
- m1.setPosition(x, y, z);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement