removed deleted files

This commit is contained in:
SpaceToad 2014-05-08 00:28:27 +02:00
parent 0605b1d3f8
commit 17b8a19eb1
4 changed files with 0 additions and 246 deletions

View file

@ -1,59 +0,0 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots;
import net.minecraft.nbt.NBTTagCompound;
public abstract class AIBase {
protected float destX, destY, destZ;
protected double dirX, dirY, dirZ;
public abstract void update (EntityRobot robot);
public void setDestination(EntityRobot robot, float x, float y, float z) {
destX = x;
destY = y;
destZ = z;
dirX = destX - robot.posX;
dirY = destY - robot.posY;
dirZ = destZ - robot.posZ;
double magnitude = Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ);
dirX /= magnitude;
dirY /= magnitude;
dirZ /= magnitude;
robot.motionX = dirX / 10F;
robot.motionY = dirY / 10F;
robot.motionZ = dirZ / 10F;
}
public void writeToNBT(NBTTagCompound nbt) {
nbt.setFloat("destX", destX);
nbt.setFloat("destY", destY);
nbt.setFloat("destZ", destZ);
nbt.setDouble("dirX", dirX);
nbt.setDouble("dirY", dirY);
nbt.setDouble("dirZ", dirZ);
}
public void readFromNBT(NBTTagCompound nbt) {
destX = nbt.getFloat("destX");
destY = nbt.getFloat("destY");
destZ = nbt.getFloat("destZ");
dirX = nbt.getDouble("dirX");
dirY = nbt.getDouble("dirY");
dirZ = nbt.getDouble("dirZ");
}
}

View file

@ -1,20 +0,0 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots;
public class AIDocked extends AIBase {
@Override
public void update(EntityRobot robot) {
robot.motionX = 0;
robot.motionY = 0;
robot.motionZ = 0;
}
}

View file

@ -1,87 +0,0 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
public class AIMoveAround extends AIBase {
protected float aroundX, aroundY, aroundZ;
double prevDistance = Double.MAX_VALUE;
public AIMoveAround () {
}
public AIMoveAround (EntityRobot robot, float x, float y, float z) {
aroundX = x;
aroundY = y;
aroundZ = z;
randomDestination(robot);
}
@Override
public void update(EntityRobot robot) {
if (robot.worldObj.isRemote) {
return;
}
double distance = robot.getDistance(destX, destY, destZ);
if (distance >= prevDistance) {
randomDestination(robot);
prevDistance = Double.MAX_VALUE;
} else {
prevDistance = robot.getDistance(destX, destY, destZ);
}
}
public void randomDestination(EntityRobot robot) {
for (int i = 0; i < 5; ++i) {
float testX = aroundX + robot.worldObj.rand.nextFloat() * 10F - 5F;
float testY = aroundY + robot.worldObj.rand.nextFloat() * 5F;
float testZ = aroundZ + robot.worldObj.rand.nextFloat() * 10F - 5F;
Block block = robot.worldObj.getBlock((int) testX, (int) testY,
(int) testZ);
// We set a destination. If it's wrong, we try a new one.
// Eventually, we'll accept even a wrong one if none can be easily
// found.
setDestination(robot, testX, testY, testZ);
if (block == Blocks.air) {
return;
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setFloat("aroundX", aroundX);
nbt.setFloat("aroundY", aroundY);
nbt.setFloat("aroundZ", aroundZ);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
aroundX = nbt.getFloat("aroundX");
aroundY = nbt.getFloat("aroundY");
aroundZ = nbt.getFloat("aroundZ");
}
}

View file

@ -1,80 +0,0 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots;
import net.minecraft.nbt.NBTTagCompound;
public class AIReturnToDock extends AIBase {
double prevDistance = Double.MAX_VALUE;
int phase = 0;
@Override
public void update(EntityRobot robot) {
if (robot.worldObj.isRemote) {
return;
}
if (phase == 0) {
float x = robot.dockingStation.x + 0.5F + robot.dockingStation.side.offsetX * 1.5F;
float y = robot.dockingStation.y + 0.5F + robot.dockingStation.side.offsetY * 1.5F;
float z = robot.dockingStation.z + 0.5F + robot.dockingStation.side.offsetZ * 1.5F;
setDestination(robot, x, y, z);
phase = 1;
} else if (phase == 1) {
double distance = robot.getDistance(destX, destY, destZ);
if (distance >= prevDistance) {
prevDistance = Double.MAX_VALUE;
float x = robot.dockingStation.x + 0.5F + robot.dockingStation.side.offsetX * 0.5F;
float y = robot.dockingStation.y + 0.5F + robot.dockingStation.side.offsetY * 0.5F;
float z = robot.dockingStation.z + 0.5F + robot.dockingStation.side.offsetZ * 0.5F;
setDestination(robot, x, y, z);
phase = 2;
} else {
prevDistance = distance;
}
} else if (phase == 2) {
double distance = robot.getDistance(destX, destY, destZ);
if (distance >= prevDistance) {
float x = robot.dockingStation.x + 0.5F + robot.dockingStation.side.offsetX * 0.5F;
float y = robot.dockingStation.y + 0.5F + robot.dockingStation.side.offsetY * 0.5F;
float z = robot.dockingStation.z + 0.5F + robot.dockingStation.side.offsetZ * 0.5F;
robot.motionX = 0;
robot.motionY = 0;
robot.motionZ = 0;
robot.setPosition(x, y, z);
robot.currentAI = new AIDocked();
} else {
prevDistance = distance;
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("phase", phase);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
phase = nbt.getInteger("phase");
}
}