mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 12:19:46 +00:00
Some work on the Heisei Dream, 50% done, now to hack into AI.
This commit is contained in:
1 parent
d936d1878c
commit
e6002a30fd
2 files changed
+40
No files matched your search
@@ -11,10 +11,47 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import vazkii.botania.common.block.subtile.SubTileFunctional;
|
||||
|
||||
public class SubTileHeiseiDream extends SubTileFunctional {
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
final int range = 5;
|
||||
final int cost = 100;
|
||||
|
||||
List<IMob> mobs = supertile.worldObj.getEntitiesWithinAABB(IMob.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range));
|
||||
if(mobs.size() > 1 && mana >= cost)
|
||||
for(IMob mob : mobs) {
|
||||
if(mob instanceof EntityLiving) {
|
||||
EntityLiving entity = (EntityLiving) mob;
|
||||
EntityLivingBase target = entity.getAttackTarget();
|
||||
if(target == null || !(target instanceof IMob)) {
|
||||
IMob newTarget;
|
||||
do newTarget = mobs.get(supertile.worldObj.rand.nextInt(mobs.size()));
|
||||
while(newTarget == mob);
|
||||
|
||||
if(newTarget instanceof EntityLivingBase) {
|
||||
entity.setAttackTarget((EntityLivingBase) newTarget);
|
||||
System.out.println("target set " + newTarget);
|
||||
mana -= cost;
|
||||
PacketDispatcher.sendPacketToAllInDimension(supertile.getDescriptionPacket(), supertile.worldObj.provider.dimensionId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0xFF219D;
|
||||
|
||||
@@ -16,4 +16,7 @@ public final class LibObfuscation {
|
||||
// EffectRenderer
|
||||
public static final String[] PARTICLE_TEXTURES = new String[] { "particleTextures", "b", "field_110737_b" };
|
||||
|
||||
// EntityAINearestAttackableTarget
|
||||
public static final String[] TARGET_CLASS = new String[] { "targetClass", "field_75307_b", "a" };
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user