Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.io.File;
- public class mod_Pets extends BaseMod implements BaseEntityHooks, Runnable {
- public static World worldRef;
- public static Minecraft mc;
- public static EntityPlayer theplayer;
- public static long lastTickRun = 0;
- public static boolean inMenu = false;
- public static int timeout;
- public static int menuTimeout;
- public static String msg;
- public static int color;
- public static int defaultColor = 0xffffff;
- public static Item domrod;
- public static Item domrod_enhanced;
- public static Item itemEntStorage;
- public static int spriteIndex;
- public static int usedSpriteIndex;
- public static Class cls_itemfood;
- public static Class cls_entliving;
- public static int counter;
- public static int counter2;
- public static int selAIOrder = 1;
- public static int orderState = 0;
- public static Entity orderedEnt = null;
- public static double petTickScanRangeX;
- public static double petTickScanRangeY;
- public static double petTickScanRangeZ;
- public static float petFollowRange;
- public static int hostileTeamInit = 2;
- public static int animalTeamInit = 0;
- public static int playerTeamInit = 1;
- public static int guardianTeamInit = 4;
- public static boolean petLOSCheck;
- public static boolean forcePetStayNear;
- public static int petHealthInit;
- public static float petHealFactor;
- public static int petSkeleCooldown;
- public static float petSkeleRange;
- public static float petSkeleAccuracy;
- public static int enhPetCooldown;
- public static float enhPetDamage;
- public static float enhPetSpeedMultiplier;
- public static boolean keyPressed;
- public static boolean dbg_prcAI;
- public static boolean dbg_prcPF;
- public static boolean timeControl;
- public static float safetyDistanceCutoff = 480F;
- public static boolean noPF;
- public static boolean allHealthBars;
- public static boolean LOSHealthBars;
- public static boolean firstTick = true;
- public static boolean killAllPets = false;
- public static boolean doPostEntInit = true;
- public static String idToOrderStr[] = { "", "Follow", "Stay", "Wander", "Guard Area", "Guard Ent", "", "" };
- public static String idToStateStr[] = { "", "Idle", "Move To Area", "Follow", "Attack", "", "", "" };
- public static int idToOrderColor[] = { 0, 0x00FF00, 0xFFFF00, 0xFF0000, 0x0000FF, 0x00FF00, 0, 0 };
- public static int idToStateColor[] = { 0, 0x00FF00, 0x0000FF, 0x00FF00, 0xFF0000, 0, 0, 0 };
- @MLProp2 public static STKey nextOrderKey;
- @MLProp2 public static STKey prevOrderKey;
- @MLProp2 public static STKey PetFreezeKey;
- public static boolean freezePets;
- @MLProp2 public static STBoolean petLOSCheckB;
- @MLProp2 public static STKey petFollowNearKey;
- @MLProp2 public static STKey petFollowFarKey;
- @MLProp2 public static STInt petFollowDistNear;
- @MLProp2 public static STInt petFollowDistFar;
- @MLProp2 public static STKey forcePetStayNearKey;
- @MLProp2 public static STInt petTickScanRangeXI;
- @MLProp2 public static STInt petTickScanRangeYI;
- @MLProp2 public static STInt petTickScanRangeZI;
- @MLProp2 public static STInt petHealthInitI;
- @MLProp2 public static STFloat petHealFactorF;
- @MLProp2 public static STInt petSkeleCooldownI;
- @MLProp2 public static STInt petSkeleRangeI;
- @MLProp2 public static STFloat petSkeleAccuracyF;
- @MLProp2 public static STInt enhPetCooldownI;
- @MLProp2 public static STFloat enhPetDamageF;
- @MLProp2 public static STFloat enhPetSpeedMultiplierF;
- @MLProp2 public static STBoolean timeControlB;
- @MLProp2 public static STBoolean healthBarsLOS;
- @MLProp2 public static STBoolean killAllPetsB;
- @MLProp2 public static STBoolean forceRevive;
- @MLProp2 public static STBoolean petAutoHeal;
- @MLProp2 public static STBoolean NothingPushesPlayer;
- @MLProp2 public static STBoolean showKills;
- @MLProp2 public static STBoolean showOrders;
- public ModSettings petSettings;
- public ModSettingScreen petScreen;
- public mod_Pets() {
- EntAPI.SetHook_Init(this);
- EntAPI.SetHook_Loaded(this);
- EntAPI.SetHook_Saved(this);
- EntAPI.SetHook_Killed(this);
- EntAPI.SetHook_AttackEntityFrom(this);
- EntAPI.SetHook_TryAttackEntity(this);
- EntAPI.SetHook_onUpdate_pre(this);
- EntAPI.SetHook_onUpdate_post(this);
- spriteIndex = ModLoader.getUniqueSpriteIndex("/gui/items.png");
- usedSpriteIndex = ModLoader.getUniqueSpriteIndex("/gui/items.png");
- domrod = (new DominationRod(22501, 0)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/dominationrod/item.png")).setItemName("dominationrod");
- domrod_enhanced = (new DominationRod(22502, 1)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/dominationrod/enhanced_rod.png")).setItemName("dominationrod_enhanced");
- itemEntStorage = (new ItemEntStorage(22507, 0)).setIconIndex(69).setItemName("entstorage");
- ModLoader.AddName(domrod, "Domination Rod");
- ModLoader.AddName(domrod_enhanced, "Domination Rod Enhanced");
- ModLoader.AddName(itemEntStorage, "Entity Storage Device");
- ModLoader.RegisterEntityID(EntFetcher.class, "EntFetcher", ModLoader.getUniqueEntityId());
- ModLoader.RegisterEntityID(EntityPetArrow.class, "PetArrow", ModLoader.getUniqueEntityId());
- ModLoader.AddRecipe(new ItemStack(domrod_enhanced, 1), new Object[] {
- "D ", " I ", " #", Character.valueOf('D'), Item.diamond, Character.valueOf('I'), Item.stick, Character.valueOf('#'), Item.lightStoneDust
- });
- ModLoader.AddRecipe(new ItemStack(domrod, 1), new Object[] {
- "D ", "DI ", " D", Character.valueOf('D'), Item.silk, Character.valueOf('I'), Item.stick
- });
- ModLoader.AddRecipe(new ItemStack(itemEntStorage, 1), new Object[] {
- " D ", "D D", " D ", Character.valueOf('D'), Item.ingotIron
- });
- ModLoader.SetInGUIHook(this, true, false);
- ModLoader.SetInGameHook(this, true, false);
- }
- public void ModsLoaded() {
- try {
- mod_PathingActivated.hasPetMod = true;
- } catch (Exception ex) {
- }
- loadConfig();
- }
- public void loadConfig() {
- nextOrderKey = new STKey("nextorder", "E");
- prevOrderKey = new STKey("prevorder", "Q");
- petFollowNearKey = new STKey("follownear", "NUMPAD8");
- petFollowFarKey = new STKey("followfar", "NUMPAD9");
- forcePetStayNearKey = new STKey("forcePetStayNearKey", "NUMPAD5");
- PetFreezeKey = new STKey("petfreeze", "GRAVE");
- petFollowDistNear = new STInt("followneardist", 5, 0, 200);
- petFollowDistFar = new STInt("followfardist", 15, 0, 200);
- petLOSCheckB = new STBoolean("petLOSCheckB", true);
- petTickScanRangeXI = new STInt("petTickScanRangeX", 20, 0, 200);
- petTickScanRangeYI = new STInt("petTickScanRangeY", 8, 0, 200);
- petTickScanRangeZI = new STInt("petTickScanRangeZ", 20, 0, 200);
- petHealthInitI = new STInt("petHealthInit", 80, 0, 5, 9999);
- petHealFactorF = new STFloat("petHealFactor", 4F, 0.0F, 20F);
- petAutoHeal = new STBoolean("petAutoHeal", false);
- petSkeleCooldownI = new STInt("petSkeleCooldown", 8, 0, 200);
- petSkeleRangeI = new STInt("petSkeleRange", 12, 0, 200);
- petSkeleAccuracyF = new STFloat("petSkeleAccuracy", 15F, 0.0F, 200F);
- enhPetCooldownI = new STInt("enhPetCooldownI", 5, 0, 200);
- enhPetDamageF = new STFloat("enhPetDamageF", 1.0F, 0.0F, 20F);
- enhPetSpeedMultiplierF = new STFloat("enhPetSpeedMultiplierF", 1.0F, 0.0F, 20F);
- NothingPushesPlayer = new STBoolean("NothingPushesPlayer", true);
- healthBarsLOS = new STBoolean("healthBarsLOS", false);
- timeControlB = new STBoolean("timeControl", true);
- killAllPetsB = new STBoolean("killAllPets", false);
- forceRevive = new STBoolean("forceRevive", false);
- showKills = new STBoolean("showKills", true);
- showOrders = new STBoolean("showOrders", true);
- petSettings = new ModSettings("Pet Mod Settings");
- petScreen = new ModSettingScreen("Pet Mod");
- //((WidgetClassicWindow)petScreen.thewidget).BackButton.getModel().addActionCallback(this);
- petSettings.append(nextOrderKey);
- petScreen.append(new WidgetKeybinding(nextOrderKey, "Next order key"));
- petSettings.append(prevOrderKey);
- petScreen.append(new WidgetKeybinding(prevOrderKey, "Previous order key"));
- petSettings.append(petFollowNearKey);
- petScreen.append(new WidgetKeybinding(petFollowNearKey, "Follow near key"));
- petSettings.append(petFollowFarKey);
- petScreen.append(new WidgetKeybinding(petFollowFarKey, "Follow far key"));
- petSettings.append(forcePetStayNearKey);
- petScreen.append(new WidgetKeybinding(forcePetStayNearKey, "Force Near Key"));
- petSettings.append(PetFreezeKey);
- petScreen.append(new WidgetKeybinding(PetFreezeKey, "No move key"));
- petSettings.append(petFollowDistNear);
- petScreen.append(new WidgetInt(petFollowDistNear, "Follow dist. near"));
- petSettings.append(petFollowDistFar);
- petScreen.append(new WidgetInt(petFollowDistFar, "Follow dist. far"));
- petScreen.append(new Widget());
- petScreen.append(new Widget());
- petSettings.append(petLOSCheckB);
- petScreen.append(new WidgetBoolean(petLOSCheckB, "Targeting requires LOS"));
- petSettings.append(petTickScanRangeXI);
- petScreen.append(new WidgetInt(petTickScanRangeXI, "Scan Range X"));
- petSettings.append(petTickScanRangeYI);
- petScreen.append(new WidgetInt(petTickScanRangeYI, "Scan Range Y"));
- petSettings.append(petTickScanRangeZI);
- petScreen.append(new WidgetInt(petTickScanRangeZI, "Scan Range Z"));
- petScreen.append(new Widget());
- petScreen.append(new Widget());
- petSettings.append(petHealthInitI);
- petScreen.append(new WidgetInt(petHealthInitI, "Health Init"));
- petSettings.append(petHealFactorF);
- petScreen.append(new WidgetFloat(petHealFactorF, "Heal Factor"));
- petSettings.append(petAutoHeal);
- petScreen.append(new WidgetBoolean(petAutoHeal, "Auto Heal"));
- petScreen.append(new Widget());
- petScreen.append(new Widget());
- petScreen.append(new Widget());
- petSettings.append(petSkeleCooldownI);
- petScreen.append(new WidgetInt(petSkeleCooldownI, "Pet skele cooldown"));
- petSettings.append(petSkeleRangeI);
- petScreen.append(new WidgetInt(petSkeleRangeI, "Pet skele range"));
- petSettings.append(petSkeleAccuracyF);
- petScreen.append(new WidgetFloat(petSkeleAccuracyF, "Pet skele aim"));
- petSettings.append(enhPetCooldownI);
- petScreen.append(new WidgetInt(enhPetCooldownI, "Enh pet cooldown"));
- petSettings.append(enhPetDamageF);
- petScreen.append(new WidgetFloat(enhPetDamageF, "Enh pet damage x"));
- petSettings.append(enhPetSpeedMultiplierF);
- petScreen.append(new WidgetFloat(enhPetSpeedMultiplierF, "Enh pet speed x"));
- petScreen.append(new Widget());
- petScreen.append(new Widget());
- petSettings.append(NothingPushesPlayer);
- petScreen.append(new WidgetBoolean(NothingPushesPlayer, "Nothing pushes player"));
- petSettings.append(healthBarsLOS);
- petScreen.append(new WidgetBoolean(healthBarsLOS, "LOS Healthbars"));
- petSettings.append(showKills);
- petScreen.append(new WidgetBoolean(showKills, "Show pet kills"));
- petSettings.append(showOrders);
- petScreen.append(new WidgetBoolean(showOrders, "Show pet orders"));
- petScreen.append(new Widget());
- petScreen.append(new Widget());
- petSettings.append(timeControlB);
- petScreen.append(new WidgetBoolean(timeControlB, "NP3&6 time keys"));
- petSettings.append(killAllPetsB);
- petScreen.append(new WidgetBoolean(killAllPetsB, "Kill pets, re-disable"));
- petScreen.append(new Widget());
- petScreen.append(new Widget());
- petSettings.append(forceRevive);
- petScreen.append(new WidgetBoolean(forceRevive, "FIX STUCK BUG"));
- SimpleButtonModel simplebuttonmodel = new SimpleButtonModel();
- simplebuttonmodel.addActionCallback(new ModAction(petSettings, "resetAll", new Class[0]));
- Button button = new Button(simplebuttonmodel);
- button.setText("Reset all to defaults");
- petScreen.append(button);
- petSettings.load();
- //run();
- (new Thread(this)).start();
- petFollowRange = petFollowDistNear.get();
- forcePetStayNear = false;
- dbg_prcAI = true;
- dbg_prcPF = true;
- noPF = true;
- allHealthBars = false;
- inMenu = true;
- try {
- //enable for non guiapi
- //mod_AITools.setupProperties(this.getClass());
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- updateSettings();
- }
- public void run() {
- try {
- while(true) {
- if(mc == null) {
- mc = ModLoader.getMinecraftInstance();
- }
- if(mc == null) {
- Thread.sleep(500L);
- } else if(mc.thePlayer == null) {
- //System.out.println("doPostEntInit: " + doPostEntInit);
- doPostEntInit = true;
- Thread.sleep(500L);
- } else {
- worldRef = mc.theWorld;
- theplayer = mc.thePlayer;
- if (NothingPushesPlayer.get()) {
- theplayer.entityCollisionReduction = 1.0F;
- } else {
- theplayer.entityCollisionReduction = 0.0F;
- }
- //theplayer.maxhealth = 20;
- Thread.sleep(500L);
- }
- }
- } catch (Throwable var6) {
- var6.printStackTrace();
- }
- }
- public static void updateSettings() {
- //if (true) return;
- System.out.println("Updating Pets Settings");
- petLOSCheck = petLOSCheckB.get();
- petTickScanRangeX = petTickScanRangeXI.get();
- petTickScanRangeY = petTickScanRangeYI.get();
- petTickScanRangeZ = petTickScanRangeZI.get();
- petHealthInit = petHealthInitI.get();
- petHealFactor = petHealFactorF.get();
- petSkeleCooldown = petSkeleCooldownI.get();
- petSkeleRange = petSkeleRangeI.get();
- petSkeleAccuracy = petSkeleAccuracyF.get();
- enhPetCooldown = enhPetCooldownI.get();
- enhPetDamage = enhPetDamageF.get();
- enhPetSpeedMultiplier = enhPetSpeedMultiplierF.get();
- timeControl = timeControlB.get();
- killAllPets = killAllPetsB.get();
- //this..... isnt needed for pathing activated really, remove from collision override
- mod_PathingActivated.NothingPushesPlayer = NothingPushesPlayer.get();
- mod_PathingActivated.freezePets = freezePets;
- mod_PathingActivated.enhPetSpeedMultiplier = enhPetSpeedMultiplier;
- }
- public void EntHook_Init(EntityCreature ent, World world) {
- ent.maxhealth = ent.health;
- ent.guardEnt = ent;
- if(ent instanceof EntityMob) {
- ent.team = hostileTeamInit;
- /*if(isOrigMob(entityliving) || (isNobleHuman(entityliving) && hostileHumans.get())) {
- entityliving.canSwitchTarget = true;
- }*/
- /*} else if(entityliving instanceof EntityPlayer) {
- theplayer = (EntityPlayer)entityliving;
- worldRef = theplayer.worldObj;
- System.out.println("entinit player");
- if(theplayer == null) {
- System.out.println("theplayer NULL?");
- theplayer = entityliving.worldObj.getClosestPlayerToEntity(entityliving, -1D);
- }
- if(theplayer == null) {
- System.out.println("theplayer STILL NULL?");
- }
- entityliving.team = playerTeamInit;
- entityliving.maxhealth = 20;
- entityliving.orders = 0;*/
- } else if(ent instanceof EntityAnimal) {
- ent.team = animalTeamInit;
- }
- //entInit(world, ent);
- }
- public void EntHook_Loaded(EntityCreature ent, NBTTagCompound data) {
- //AI Added
- //mod_AIManager.entLoaded(ent, data);
- }
- public void EntHook_Saved(EntityCreature ent, NBTTagCompound data) {
- if(ent.ridingEntity != null && (ent.ridingEntity instanceof EntityCreature) && ((EntityCreature)ent.ridingEntity).uID == -1) {
- ((EntityCreature)ent.ridingEntity).uID = getUniqueEntID();
- ent.mountEntID = ((EntityCreature)ent.ridingEntity).uID;
- }
- data.setShort("mountEntID", (short)ent.mountEntID);
- //AI Added
- //mod_AIManager.entSaved(ent, data);
- }
- public void EntHook_Killed(EntityCreature ent, Entity from) {
- if (from instanceof EntityCreature && ((EntityCreature) from).team == this.playerTeamInit) {
- ((EntityCreature) from).kills++;
- }
- }
- public boolean EntHook_AttackEntityFrom(EntityCreature ent, Entity entFrom, int damage) {
- if((ent instanceof EntityCreature) && (entFrom instanceof EntityLiving) && !entHit((EntityLiving)entFrom, damage, ent)) {
- return false;
- }
- if(ent.team == this.playerTeamInit) {
- this.callForHelp(ent, entFrom);
- }
- return true;
- }
- public boolean EntHook_TryAttackEntity(Entity entFrom, Entity entTo, float dist) {
- if(mod_PathingActivated.getTeam(entFrom) == this.playerTeamInit) {
- if(mod_PathingActivated.getTeam(entFrom) != mod_PathingActivated.getTeam(entTo)) {
- if(((EntityCreature)entFrom).enhanced == 1 || (entFrom instanceof EntityCreeper) && mod_PathingActivated.getTeam(entFrom) == this.playerTeamInit) {
- this.enhAttack(((EntityCreature)entFrom), entTo, dist);
- } else {
- ((EntityCreature)entFrom).attackEntity(entTo, dist);
- }
- }
- return false;
- } else {
- return true;
- }
- }
- public static void displayMessage(String s, int i) {
- msg = s;
- timeout = 55;
- color = i;
- }
- public static void displayMessage(String s) {
- displayMessage(s, defaultColor);
- }
- public static boolean sameTeam(Entity ent1, Entity ent2) {
- //if both 0, more of a neutral setup than teams
- if (getTeam(ent1) == 0 && getTeam(ent2) == 0) {
- return false;
- }
- if (getTeam(ent1) == getTeam(ent2)) {
- return true;
- }
- return false;
- }
- public static int getTeam(Entity entity) {
- if (entity instanceof EntityCreature) {
- return ((EntityCreature)entity).team;
- } else if (entity instanceof EntityPlayer) {
- return 1;
- }
- return 0;
- }
- public void EntHook_onUpdate_pre(EntityCreature ent) {
- Tick(ent);
- /*if(ent.team == this.playerTeamInit && (ent instanceof EntityMob)) {
- ent.fire = 0;
- }*/
- }
- public void EntHook_onUpdate_post(EntityCreature ent) {
- }
- public void EntHook_AITick(EntityCreature ent) {
- }
- public boolean OnTickInGUI(Minecraft game, GuiScreen gui)
- {
- if (ModLoader.getMinecraftInstance().thePlayer != null) {
- //long ticksRan = System.currentTimeMillis();
- if (!(gui instanceof GuiContainer)) {
- inMenu = true;
- lastTickRun = 0;
- }
- //System.out.println(gui);
- //playerTick(mc.thePlayer);
- }
- return true;
- }
- public boolean OnTickInGame(Minecraft minecraft) {
- if (inMenu) {
- //System.out.println(lastTickRun);
- if (lastTickRun > 10) {
- if (doPostEntInit) {
- doPostEntInit = false;
- postEntInit(ModLoader.getMinecraftInstance().thePlayer);
- }
- updateSettings();
- inMenu = false;
- }
- lastTickRun++;
- }
- if (!inMenu) {
- playerTick(mc.thePlayer);
- }
- if(timeout > 0 && msg != null) {
- ScaledResolution scaledresolution = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
- int i = scaledresolution.getScaledWidth();
- int j = scaledresolution.getScaledHeight();
- int k = minecraft.fontRenderer.getStringWidth(msg);
- minecraft.fontRenderer.drawStringWithShadow(msg, 3, 85, 0xffffff);
- timeout--;
- }
- if(menuTimeout > 0) {
- /*ScaledResolution scaledresolution = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
- int i = scaledresolution.getScaledWidth();
- int j = scaledresolution.getScaledHeight();
- int k = minecraft.fontRenderer.getStringWidth(msg);*/
- int hColor = 0xDD0000;
- int height = 105;
- minecraft.fontRenderer.drawStringWithShadow("Orders:", 3, height, 0x006060);
- minecraft.fontRenderer.drawStringWithShadow("Follow", 3, height+10, selAIOrder == 1 ? hColor : 0xffffff);
- minecraft.fontRenderer.drawStringWithShadow("Stay", 3, height+20, selAIOrder == 2 ? hColor : 0xffffff);
- minecraft.fontRenderer.drawStringWithShadow("Wander", 3, height+30, selAIOrder == 3 ? hColor : 0xffffff);
- minecraft.fontRenderer.drawStringWithShadow("Guard Area", 3, height+40, selAIOrder == 4 ? hColor : 0xffffff);
- minecraft.fontRenderer.drawStringWithShadow("Guard Entity", 3, height+50, selAIOrder == 5 ? hColor : 0xffffff);
- minecraft.fontRenderer.drawStringWithShadow("Stack", 3, height+60, selAIOrder == 6 ? hColor : 0xffffff);
- minecraft.fontRenderer.drawStringWithShadow("Attack Target", 3, height+70, selAIOrder == 7 ? hColor : 0xffffff);
- menuTimeout--;
- }
- return true;
- }
- public void AddRenderer(Map var1) {
- var1.put(EntFetcher.class, new RenderEntity());
- var1.put(EntityPetArrow.class, new RenderPetArrow());
- }
- public String Version() {
- return "v3.0 for MC b1.7.3";
- }
- public static void Tick(EntityCreature entityliving) {
- if (worldRef == null || worldRef.multiplayerWorld) { return; }
- entityliving.PFDelay--;
- if(entityliving.team == playerTeamInit && (entityliving instanceof EntityCreature)) {
- if(dbg_prcAI/* && !entityliving.noTick*/) {
- //System.out.println(entityliving.PFDelay);
- entityliving.info2 = (new StringBuilder()).append("pet orders: "+entityliving.orders+" - team: "+entityliving.team).toString();
- petTick((EntityCreature)entityliving);
- }
- } else if(entityliving instanceof EntityCreature) {
- if(dbg_prcAI) {
- animalTick((EntityCreature)entityliving);
- }
- }
- }
- public static void playerTick(EntityLiving entityliving) {
- if(Keyboard.isKeyDown(nextOrderKey.get()) || Keyboard.isKeyDown(prevOrderKey.get())) {
- if(!keyPressed) {
- keyPressed = true;
- if(Keyboard.isKeyDown(nextOrderKey.get())) {
- selAIOrder++;
- if(selAIOrder > 7) {
- selAIOrder = 1;
- }
- } else if(Keyboard.isKeyDown(prevOrderKey.get())) {
- selAIOrder--;
- if(selAIOrder < 1) {
- selAIOrder = 7;
- }
- }
- if(selAIOrder == 3) {
- //displayMessage((new StringBuilder()).append("Order: ").append("Wander").toString());
- } else if(selAIOrder == 1) {
- //displayMessage((new StringBuilder()).append("Order: ").append("Follow").toString());
- } else if(selAIOrder == 2) {
- //displayMessage((new StringBuilder()).append("Order: ").append("Stay").toString());
- } else if(selAIOrder == 4) {
- //displayMessage((new StringBuilder()).append("Order: ").append("Guard Area").toString());
- } else if(selAIOrder == 5) {
- //displayMessage((new StringBuilder()).append("Order: ").append("Guard Entity").toString());
- orderState = 0;
- } else if(selAIOrder == 6) {
- //displayMessage((new StringBuilder()).append("Order: ").append("Stack").toString());
- orderState = 0;
- } else if(selAIOrder == 7) {
- //displayMessage((new StringBuilder()).append("Order: ").append("Attack Target").toString());
- orderState = 0;
- }
- showMenu(selAIOrder);
- }
- } else if(Keyboard.isKeyDown(forcePetStayNearKey.get())) {
- if(!keyPressed) {
- keyPressed = true;
- forcePetStayNear = !forcePetStayNear;
- displayMessage((new StringBuilder()).append("Force Pet Stay Near: ").append(forcePetStayNear).toString());
- }
- } else if(Keyboard.isKeyDown(petFollowNearKey.get())) {
- if(!keyPressed) {
- keyPressed = true;
- petFollowRange = (float)petFollowDistNear.get() * 1.0F;
- displayMessage((new StringBuilder()).append("Pet Follow Range: ").append(petFollowRange).toString());
- }
- } else if(Keyboard.isKeyDown(Keyboard.getKeyIndex("NUMPAD4"))) {
- if(!keyPressed) {
- keyPressed = true;
- allHealthBars = !allHealthBars;
- displayMessage((new StringBuilder()).append("All Health Bars: ").append(allHealthBars).toString());
- }
- } else if(Keyboard.isKeyDown(petFollowFarKey.get())) {
- if(!keyPressed) {
- keyPressed = true;
- petFollowRange = (float)petFollowDistFar.get() * 1.0F;
- displayMessage((new StringBuilder()).append("Pet Follow Range: ").append(petFollowRange).toString());
- }
- } else if(Keyboard.isKeyDown(Keyboard.getKeyIndex("NUMPAD6"))) {
- if(!keyPressed) {
- if(timeControl) {
- entityliving.worldObj.setWorldTime(100L);
- }
- keyPressed = true;
- }
- } else if(Keyboard.isKeyDown(Keyboard.getKeyIndex("NUMPAD3"))) {
- if(!keyPressed) {
- if(timeControl) {
- entityliving.worldObj.setWorldTime(-10400L);
- }
- keyPressed = true;
- }
- } else if(Keyboard.isKeyDown(PetFreezeKey.get())) {
- if(!keyPressed) {
- keyPressed = true;
- freezePets = !freezePets;
- mod_PathingActivated.freezePets = !mod_PathingActivated.freezePets;
- displayMessage((new StringBuilder()).append("Freeze Pets: ").append(mod_PathingActivated.freezePets).toString());
- }
- } else {
- keyPressed = false;
- }
- }
- public static void showMenu(int highlighted) {
- menuTimeout = 60;
- }
- public static void petTick(EntityCreature entityliving) {
- Object obj = null;
- if(entityliving.AIDelay < 0) {
- entityliving.AIDelay = 5 + entityliving.worldObj.rand.nextInt(5);;
- float f = -1F;
- float f3 = 999999F;
- EntityLiving entityliving1 = null;
- EntityPlayer entityplayer = theplayer;
- entityliving.mining = false;
- entityliving.forcejump = false;
- if(killAllPets) {
- entityliving.setEntityDead();
- }
- if(worldRef != null && petAutoHeal.get() && worldRef.worldInfo.getWorldTime() % 5L == 0L) {
- heal(entityliving, 1);
- }
- entityliving.fire = 0;
- if((entityliving instanceof EntityMob) || mod_AITools.isNonDefaultAnimal(entityliving)) {
- List list = entityliving.worldObj.getEntitiesWithinAABBExcludingEntity(entityliving, entityliving.boundingBox.expand(petTickScanRangeX, petTickScanRangeY, petTickScanRangeZ));
- if(list != null) {
- counter2 = list.size();
- for(int i = 0; i < list.size(); i++) {
- Entity entity = (Entity)list.get(i);
- if(!(entity instanceof EntityCreature)) {
- continue;
- }
- EntityCreature entityliving2 = (EntityCreature)entity;
- if(((entityliving2 instanceof EntityMob) || entityliving2 == entityliving.attackingEnt || mod_AITools.isThreat(entityliving, entityliving2)) && entityliving2 != entityliving && entityliving2.team != playerTeamInit) {
- //if(((entityliving2 instanceof EntityMob))) {
- float f1 = entityliving.getDistanceToEntity(entityliving2);
- if(f1 < f3 && (entityliving.canEntityBeSeen(entityliving2) || !petLOSCheck)) {
- f3 = f1;
- entityliving1 = entityliving2;
- }
- //break;
- continue;
- }
- /*System.out.println("?:"+entityliving1);
- System.out.println("=:"+(((entityliving2 instanceof EntityMob) || entityliving2 == entityliving.attackingEnt || mod_AITools.isThreat(entityliving, entityliving2)) && entityliving2 != entityliving && entityliving2.team != playerTeamInit));
- System.out.println("1:"+(entityliving2 == entityliving.attackingEnt));
- System.out.println("2:"+mod_AITools.isThreat(entityliving, entityliving2));
- System.out.println("3:"+(entityliving2 != entityliving));
- System.out.println("4:"+(entityliving2.team != playerTeamInit));*/
- //((entityliving2 instanceof EntityMob) || entityliving2 == entityliving.attackingEnt || mod_AITools.isThreat(entityliving, entityliving2)) && entityliving2 != entityliving && entityliving2.team != playerTeamInit
- /*if(entityliving.guardEnt == null || entityliving2.uID != mod_AITools.getuID(entityliving.guardEnt) || entityliving.orders != 1) {
- continue;
- }
- float f2 = entityliving.getDistanceToEntity(entityliving2);
- if(f2 < f3 && f2 > petFollowRange) {
- f3 = f2;
- entityliving1 = entityliving2;
- }*/
- //System.out.println("?:"+entityliving1);
- }
- }
- }
- Object obj1 = entityliving1;
- if(entityliving.orders == 1) {
- if(entityliving.getDistanceToEntity(entityliving.guardEnt) > petFollowRange) {
- if(entityliving1 == null || entityliving1 == entityliving.guardEnt || forcePetStayNear) {
- obj1 = entityliving.guardEnt;
- if (entityliving.state == 4) {
- ((EntityCreature)entityliving).setPathToEntity(null);
- }
- entityliving.state = 3;
- //((EntityCreature)entityliving).setPathToEntity(null);
- }
- } else if(entityliving1 == null) {
- entityliving.state = 1;
- } else {
- entityliving.state = 4;
- }
- } else if(entityliving.orders == 4) {
- if(entityliving.getDistance(entityliving.guardX, entityliving.guardY, entityliving.guardZ) > (double)petFollowRange) {
- if(entityliving1 == null || entityliving1 == entityliving.guardEnt || forcePetStayNear) {
- if(entityliving1 == null) {
- obj1 = null;
- }
- if (!entityliving.hasPath()) {
- entityliving.tryPathXYZ(entityliving.guardX, entityliving.guardY, entityliving.guardZ, mod_PathingActivated.MaxPFRange.get());
- }
- entityliving.state = 2;
- }
- } else if(entityliving.getDistance(entityliving.guardX, entityliving.guardY, entityliving.guardZ) <= (double)(petFollowRange / 2.0F)) {
- if(entityliving1 == null) {
- if(entityliving.state != 1) {
- setEntVel(entityliving, 0.0F, 0.0F, 0.0F);
- }
- entityliving.state = 1;
- ((EntityCreature)entityliving).setPathToEntity(null);
- obj1 = null;
- } else {
- entityliving.state = 4;
- }
- }
- } else if(obj1 != null && !(obj1 instanceof EntityPlayer) && entityliving.team != ((EntityCreature)obj1).team) {
- entityliving.state = 4;
- } else {
- entityliving.state = 1;
- }
- if(entityliving.orders != 4 && (obj1 instanceof EntityPlayer) && (entityliving.getDistanceToEntity(((Entity) (obj1))) < petFollowRange || entityliving.orders != 1)) {
- setEntVel(entityliving, 0.0F, 0.0F, 0.0F);
- obj1 = null;
- entityliving.state = 1;
- ((EntityCreature)entityliving).setPathToEntity(null);
- }
- if(obj1 != null && (obj1 instanceof EntityPlayer) && entityliving.orders != 1 && entityliving.orders != 4) {
- obj1 = null;
- entityliving.state = 1;
- }
- entityliving.info = entityliving.state;
- try {
- if(entityliving instanceof EntityCreature) {
- if(!(((EntityCreature)entityliving).playerToAttack instanceof EntityItem)) {
- if (obj1 != null) {
- //System.out.println("Setting target0: " + obj1);
- }
- mod_AITools.getTargetField(entityliving).set(entityliving, obj1);
- }
- if (!((EntityCreature)entityliving).hasPath()) {
- if ((Entity)obj1 != null) {
- if (entityliving.tryPath((Entity)obj1, mod_PathingActivated.MaxPFRange.get(), true)) {
- entityliving.pathfindDelay = 0;
- /*if (entityliving.state == 3 && entityliving.getPath() != null && !entityliving.getPath().foundEnd) {
- System.out.println("found end?" + entityliving.getPath().foundEnd);
- entityliving.teleportToTarget((Entity)obj1);
- }*/
- //System.out.println("found end?" + entityliving.getPath().foundEnd);
- }
- }
- }
- } else if(mod_AITools.getTargetField(entityliving) != null) {
- mod_AITools.getTargetField(entityliving).set(entityliving, obj1);
- }
- } catch(Exception exception) { exception.printStackTrace(); }
- counter++;
- }
- int pSize = 0;
- if(entityliving instanceof EntityCreature) {
- PathEntity pEnt = ((EntityCreature)entityliving).getPath();
- if(pEnt != null) { pSize = pEnt.pathLength; }
- }
- //entityliving.info2 = (new StringBuilder()).append("pet state: "+entityliving.state+" - targ: "+entityliving.playerToAttack+" - pathsize: "+pSize).toString();
- //displayMessage((new StringBuilder()).append("info: "+entityliving.state+" - "+entityliving.playerToAttack).toString());
- if (entityliving instanceof EntitySheep) {
- if (entityliving.mineDelay == 0) {
- ((EntitySheep)entityliving).setSheared(false);
- ((EntitySheep)entityliving).health = ((EntitySheep)entityliving).maxhealth;
- entityliving.mineDelay = -1;
- } else if (entityliving.mineDelay == -1) {
- if (((EntitySheep)entityliving).getSheared()) {
- entityliving.mineDelay = 24000;
- }
- } else {
- entityliving.mineDelay--;
- }
- }
- entityliving.AIDelay--;
- }
- public static void animalTick(EntityCreature entitycreature) {
- Entity entity = entitycreature.playerToAttack;
- if(entitycreature.getDistanceToEntity(theplayer) > petFollowRange && forcePetStayNear && entitycreature.orders == 1) {
- entitycreature.playerToAttack = theplayer;
- entitycreature.state = 3;
- } else {
- entitycreature.playerToAttack = entity;
- if(entitycreature.playerToAttack != null) {
- entitycreature.state = 4;
- } else {
- entitycreature.state = 1;
- }
- }
- if((entitycreature.playerToAttack instanceof EntityPlayer) && entitycreature.getDistanceToEntity(entitycreature.playerToAttack) < petFollowRange && entitycreature.orders == 1) {
- entitycreature.playerToAttack = null;
- entitycreature.state = 1;
- }
- if (entitycreature instanceof EntitySheep) {
- if (entitycreature.mineDelay == 0) {
- ((EntitySheep)entitycreature).setSheared(false);
- ((EntitySheep)entitycreature).health = ((EntitySheep)entitycreature).maxhealth;
- entitycreature.mineDelay = -1;
- } else if (entitycreature.mineDelay == -1) {
- if (((EntitySheep)entitycreature).getSheared()) {
- entitycreature.mineDelay = 24000;
- }
- } else {
- entitycreature.mineDelay--;
- }
- }
- }
- public static void postEntInit(EntityLiving entityliving) {
- int i = entityliving.worldObj.loadedEntityList.size();
- for(theplayer = null; theplayer == null; theplayer = ModLoader.getMinecraftInstance().thePlayer) {
- worldRef = ModLoader.getMinecraftInstance().theWorld;
- }
- System.out.println((new StringBuilder()).append("EntCount").append(i).toString());
- for(int j = 0; j < i; j++) {
- Entity entity = (Entity)entityliving.worldObj.loadedEntityList.get(j);
- if(!(entity instanceof EntityCreature)) {
- continue;
- }
- EntityCreature entityliving1 = (EntityCreature)entity;
- if(entityliving1.uID == -1) {
- entityliving1.uID = getUniqueEntID();
- }
- if(entityliving1.guardEntID != -1) {
- EntityLiving entityliving2 = getEnt(entityliving1.guardEntID);
- if(entityliving2 != null) {
- if(entityliving2 != entityliving1 && entityliving1.guardEntID != entityliving1.uID) {
- System.out.println((new StringBuilder()).append("GuardEnt found!: ").append(entityliving1.uID).append(" guarding ").append(entityliving1.guardEntID).toString());
- entityliving1.guardEnt = entityliving2;
- } else {
- entityliving1.uID = getUniqueEntID();
- }
- } else {
- entityliving1.guardEnt = theplayer;
- }
- } else {
- entityliving1.guardEnt = theplayer;
- }
- if(entityliving1.mountEntID == -1) {
- continue;
- }
- EntityLiving entityliving3 = getEnt(entityliving1.mountEntID);
- if(entityliving3 == null) {
- continue;
- }
- //disabled remounting code for now
- /*if(entityliving3 != entityliving1 && entityliving1.mountEntID != entityliving1.uID) {
- System.out.println((new StringBuilder()).append("Stack found!: ").append(entityliving1.uID).append(" onto ").append(entityliving1.mountEntID).toString());
- entityliving1.mountEntity(entityliving3);
- } else {
- entityliving1.uID = getUniqueEntID();
- }*/
- }
- }
- public static void convert(EntityCreature entityliving, int i) {
- ItemStack itemstack = theplayer.inventory.getCurrentItem();
- entityliving.team = playerTeamInit;
- entityliving.enhanced = i;
- if(mod_AITools.isGuardian(entityliving)) {
- entityliving.noTick = true;
- }
- if(entityliving.enhanced == 1) {
- displayMessage((new StringBuilder()).append("ENHANCE!").append("").toString());
- if(petHealthInit > entityliving.health) {
- entityliving.health = petHealthInit;
- }
- entityliving.maxhealth = entityliving.health;
- if(entityliving instanceof EntityMob) {
- ((EntityMob)entityliving).attackStrength *= enhPetDamage;
- }
- } else {
- entityliving.health = entityliving.maxhealth;
- }
- entityliving.orders = 1;
- entityliving.fire = 0;
- entityliving.deathTime = 0;
- entityliving.setPathToEntity(null);
- if(entityliving instanceof EntityCreature) {
- ((EntityCreature)entityliving).playerToAttack = null;
- }
- if(itemstack != null) {
- itemstack.damageItem(10, mc.thePlayer);
- }
- }
- public static void foundEnt(EntityCreature entityliving, int i) {
- if(entityliving.team != playerTeamInit && selAIOrder != 7) {
- convert(entityliving, i);
- } else if(entityliving.team == playerTeamInit || selAIOrder == 7) {
- giveOrder(entityliving);
- }
- }
- public static boolean isMountable(Entity entity) {
- try {
- return (entity instanceof EntityBoat) ||
- (entity instanceof EntityMinecart) ||
- (Class.forName("EntityBiplane").isInstance(entity)) ||
- (Class.forName("EntityCamel").isInstance(entity)) ||
- (Class.forName("EntityFokker").isInstance(entity));
- } catch(Exception exception) {
- exception.printStackTrace();
- return false;
- }
- }
- public static void giveOrder(Entity entity) {
- EntityCreature entityliving = null;
- boolean flag = false;
- if(entity instanceof EntityCreature) {
- entityliving = (EntityCreature)entity;
- } else if(selAIOrder == 6 && isMountable(entity)) {
- flag = true;
- } else {
- return;
- }
- if(selAIOrder == 6) {
- if(orderState == 0) {
- if(!flag) {
- orderState++;
- orderedEnt = entityliving;
- displayMessage((new StringBuilder()).append("Select pet to stack on ").toString());
- }
- } else {
- orderedEnt.mountEntity(entity);
- if(!flag) {
- ((EntityCreature)orderedEnt).mountEntID = entityliving.uID;
- }
- orderState = 0;
- displayMessage((new StringBuilder()).append("Stacked!").toString());
- }
- return;
- }
- if(selAIOrder == 7) {
- //System.out.println("help!");
- callForHelp(theplayer, entityliving);
- displayMessage((new StringBuilder()).append("Attacking target").toString());
- }
- if(entityliving.team == playerTeamInit || (entityliving instanceof EntityAnimal)) {
- String s = "";
- String s1 = "";
- if(selAIOrder < 5) {
- entityliving.orders = selAIOrder;
- entityliving.guardX = -1;
- entityliving.guardY = -1;
- entityliving.guardZ = -1;
- }
- if(selAIOrder == 3) {
- s1 = "wander";
- if(entityliving instanceof EntityCreature) {
- ((EntityCreature)entityliving).playerToAttack = null;
- }
- } else if(selAIOrder == 1) {
- s1 = "follow";
- entityliving.guardEnt = theplayer;
- entityliving.guardEntID = -1;//theplayer.uID;
- } else if(selAIOrder == 2) {
- s1 = "stay";
- if(entityliving instanceof EntityCreature) {
- ((EntityCreature)entityliving).playerToAttack = null;
- }
- } else if(selAIOrder == 4) {
- s1 = "guard area";
- if(entityliving instanceof EntityCreature) {
- ((EntityCreature)entityliving).playerToAttack = null;
- }
- entityliving.guardX = (int)entityliving.posX;
- entityliving.guardY = (int)entityliving.posY;
- entityliving.guardZ = (int)entityliving.posZ;
- } else if(selAIOrder == 5) {
- if(orderState == 0) {
- orderState++;
- orderedEnt = entityliving;
- displayMessage((new StringBuilder()).append("Select ent to guard ").toString());
- } else {
- ((EntityCreature)orderedEnt).guardEnt = entityliving;
- ((EntityCreature)orderedEnt).guardEntID = entityliving.uID;
- ((EntityCreature)orderedEnt).orders = 1;
- orderState = 0;
- displayMessage((new StringBuilder()).append("GuardEnt Set").toString());
- }
- }
- if(selAIOrder < 5) {
- float f = entityliving.getDistanceToEntity(theplayer);
- displayMessage((new StringBuilder()).append("Ordered to ").append(s1).append(", Dist: ").append(f).toString());
- }
- }
- }
- public static void enhAttack(EntityCreature entityliving, Entity entity, float f) {
- try {
- if(entityliving instanceof EntitySkeleton) {
- skeleAttack(entityliving, entity, f);
- } else if(mod_AITools.isOrigMob(entityliving)) {
- mobAttack((EntityMob)entityliving, entity, f);
- } else if(entityliving instanceof EntityCreature) {
- ((EntityCreature)entityliving).attackEntity(entity, f);
- }
- } catch(Exception exception) { }
- }
- public static void mobAttack(EntityMob entitymobs, Entity entity, float f) {
- if((double)f < 2.5D && entity.boundingBox.maxY > entitymobs.boundingBox.minY && entity.boundingBox.minY < entitymobs.boundingBox.maxY) {
- entitymobs.attackTime = enhPetCooldown;
- if (entitymobs instanceof EntityZombie) {
- ((EntityCreature)entitymobs).swingArm = true;
- ((EntityCreature)entitymobs).swingTick = 0;
- }
- entity.attackEntityFrom(entitymobs, entitymobs.attackStrength);
- }
- }
- public static void skeleAttack(EntityCreature entityliving, Entity entity, float f) {
- byte byte0 = 1;
- EntityCreature entityliving1 = (EntityCreature)entity;
- float f1 = 10F;
- int i = 30;
- float f2 = 12F;
- if(entityliving.team == playerTeamInit) {
- f1 = petSkeleRange;
- i = petSkeleCooldown;
- f2 = petSkeleAccuracy;
- byte0 = 2;
- }
- if(f < f1 && entityliving.team != entityliving1.team) {
- double d = entity.posX - entityliving.posX;
- double d1 = entity.posZ - entityliving.posZ;
- if(entityliving.attackTime == 0) {
- EntityPetArrow entityarrow = null;
- for(int j = 0; j < byte0; j++) {
- if(entityarrow == null) {
- entityarrow = new EntityPetArrow(entityliving.worldObj, entityliving);
- }
- //entityarrow.posY += 0.3999999761581421D;
- double d2 = entity.posY - 0.20000000298023221D - entityarrow.posY;
- float f3 = MathHelper.sqrt_double(d * d + d1 * d1) * 0.5F;
- entityliving.worldObj.entityJoinedWorld(entityarrow);
- entityarrow.setArrowHeading(d, d2 + (double)f3, d1, 0.6F, f2);
- //entityarrow.setPosition(entityarrow.posX, entityarrow.posY, entityarrow.posZ);
- }
- entityliving.worldObj.playSoundAtEntity(entityliving, "random.bow", 1.0F, 1.0F / (entityliving.rand.nextFloat() * 0.4F + 0.8F));
- entityliving.attackTime = i;
- }
- entityliving.rotationYaw = (float)((Math.atan2(d1, d) * 180D) / 3.1415927410125728D) - 90F;
- ((EntityCreature)entityliving).hasAttacked = true;
- }
- }
- public static boolean entHit(EntityLiving entityliving, int i, EntityLiving entityliving1) {
- //System.out.println("dfgfdg - " + entityliving + " - " + entityliving1);
- if(entityliving != null) {
- if(entityliving instanceof EntityPlayer) {
- ItemStack itemstack = theplayer.inventory.getCurrentItem();
- if(itemstack != null) {
- Item item = itemstack.getItem();
- if(getTeam(entityliving1) != playerTeamInit) {
- if(item instanceof DominationRod) {
- convert((EntityCreature)entityliving1, ((DominationRod)item).type);
- if(selAIOrder == 6) {
- theplayer.mountEntity(entityliving1);
- }
- return false;
- }
- } else {
- if(item instanceof DominationRod) {
- if(selAIOrder == 6) {
- theplayer.mountEntity(entityliving1);
- }
- return false;
- }
- try {
- Field field = (ItemFood.class).getDeclaredField("a");
- field.setAccessible(true);
- int j = (int)(field.getFloat(item) * (petHealFactor * (float)((EntityCreature)entityliving1).enhanced));
- if(j > 0) {
- int k = entityliving1.health;
- heal((EntityCreature)entityliving1, j);
- if(k != entityliving1.health) {
- itemstack.stackSize--;
- }
- return false;
- }
- } catch(Exception exception) {
- if(!(exception instanceof SecurityException)) {
- if(!(exception instanceof NoSuchFieldException));
- }
- }
- }
- } else {
- return true;
- }
- } else if(getTeam(entityliving) == playerTeamInit && getTeam(entityliving1) == playerTeamInit) {
- return false;
- }
- }
- return true;
- }
- public static void heal(EntityCreature entityliving, int i) {
- if(entityliving.health <= 0) {
- return;
- }
- entityliving.health += i;
- if(entityliving.health > entityliving.maxhealth) {
- entityliving.health = entityliving.maxhealth;
- }
- entityliving.heartsLife = entityliving.heartsHalvesLife / 2;
- }
- public static EntityCreature getEnt(long l) {
- int i = worldRef.loadedEntityList.size();
- Object obj = null;
- for(int j = 0; j < i; j++) {
- Entity entity = (Entity)worldRef.loadedEntityList.get(j);
- if(!(entity instanceof EntityCreature)) {
- continue;
- }
- EntityCreature entityliving = (EntityCreature)entity;
- if((long)entityliving.uID == l) {
- return entityliving;
- }
- }
- return null;
- }
- public static int getUniqueEntID() {
- boolean flag = true;
- int i = worldRef.loadedEntityList.size();
- int j = 0;
- for(boolean flag1 = true; flag1;) {
- flag1 = false;
- for(int k = 0; k < i; k++) {
- Entity entity = (Entity)worldRef.loadedEntityList.get(k);
- if(!(entity instanceof EntityCreature)) {
- continue;
- }
- EntityCreature entityliving = (EntityCreature)entity;
- if(entityliving.uID != j) {
- continue;
- }
- flag1 = true;
- break;
- }
- if(!flag1 || j >= i) {
- flag1 = false;
- j--;
- }
- j++;
- }
- return j;
- }
- public static void callForHelp(Entity entity, Entity entity1) {
- if(/*!(entity instanceof EntityCreature) || */!(entity1 instanceof EntityCreature)) {
- return;
- }
- if((entity1 instanceof EntityPlayer) || mod_AITools.sameTeam(entity, entity1)) {
- return;
- }
- Object obj = null;
- List list = entity.worldObj.getEntitiesWithinAABBExcludingEntity(entity, entity.boundingBox.expand(60D, 30D, 60D));
- if(list != null) {
- for(int i = 0; i < list.size(); i++) {
- Entity entity2 = (Entity)list.get(i);
- if((entity2 instanceof EntityCreature) && mod_AITools.getTeam(entity2) == playerTeamInit) {
- ((EntityCreature)entity2).attackingEnt = entity1;
- }
- }
- }
- }
- public static void setEntVel(EntityLiving entityliving, float f, float f1, float f2) {
- entityliving.moveStrafing = f;
- entityliving.moveForward = f1;
- entityliving.randomYawVelocity = f2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment