mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-02-24 15:00:48 +00:00
drone improvements part 1
fixed the dumb idiot logic that got it stuck all the time
This commit is contained in:
parent
bdbe821d9d
commit
543dd059af
@ -29,7 +29,7 @@ public abstract class EntityDroneBase extends Entity {
|
|||||||
|
|
||||||
public void setTarget(double x, double y, double z) {
|
public void setTarget(double x, double y, double z) {
|
||||||
this.targetX = x;
|
this.targetX = x;
|
||||||
this.targetY = y;
|
this.targetY = y + 1;
|
||||||
this.targetZ = z;
|
this.targetZ = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@ -61,8 +62,14 @@ public class EntityRequestDrone extends EntityDroneBase {
|
|||||||
} else if(next instanceof AStack && heldItem == null) {
|
} else if(next instanceof AStack && heldItem == null) {
|
||||||
|
|
||||||
AStack aStack = (AStack) next;
|
AStack aStack = (AStack) next;
|
||||||
TileEntity tile = worldObj.getTileEntity((int) Math.floor(posX), (int) Math.floor(posY - 1), (int) Math.floor(posZ));
|
//to make DAMN sure this fuckin idiot doesnt miss the dock
|
||||||
|
Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||||
|
Vec3 nextPos = Vec3.createVectorHelper(this.posX, this.posY - 4, this.posZ);
|
||||||
|
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos);
|
||||||
|
|
||||||
|
if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||||
|
|
||||||
|
TileEntity tile = worldObj.getTileEntity(mop.blockX, mop.blockY, mop.blockZ);
|
||||||
if (tile instanceof TileEntityDroneProvider) {
|
if (tile instanceof TileEntityDroneProvider) {
|
||||||
TileEntityDroneProvider provider = (TileEntityDroneProvider) tile;
|
TileEntityDroneProvider provider = (TileEntityDroneProvider) tile;
|
||||||
|
|
||||||
@ -79,10 +86,16 @@ public class EntityRequestDrone extends EntityDroneBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
nextActionTimer = 5;
|
nextActionTimer = 5;
|
||||||
} else if(next == DroneProgram.UNLOAD && this.heldItem != null) {
|
} else if(next == DroneProgram.UNLOAD && this.heldItem != null) {
|
||||||
|
Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||||
|
Vec3 nextPos = Vec3.createVectorHelper(this.posX, this.posY - 4, this.posZ);
|
||||||
|
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos);
|
||||||
|
|
||||||
TileEntity tile = worldObj.getTileEntity((int) Math.floor(posX), (int) Math.floor(posY - 1), (int) Math.floor(posZ));
|
if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||||
|
|
||||||
|
TileEntity tile = worldObj.getTileEntity(mop.blockX, mop.blockY, mop.blockZ);
|
||||||
if (tile instanceof TileEntityDroneRequester) {
|
if (tile instanceof TileEntityDroneRequester) {
|
||||||
TileEntityDroneRequester requester = (TileEntityDroneRequester) tile;
|
TileEntityDroneRequester requester = (TileEntityDroneRequester) tile;
|
||||||
|
|
||||||
@ -112,10 +125,16 @@ public class EntityRequestDrone extends EntityDroneBase {
|
|||||||
|
|
||||||
requester.markDirty();
|
requester.markDirty();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
nextActionTimer = 5;
|
nextActionTimer = 5;
|
||||||
} else if(next == DroneProgram.DOCK) {
|
} else if(next == DroneProgram.DOCK) {
|
||||||
|
Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||||
|
Vec3 nextPos = Vec3.createVectorHelper(this.posX, this.posY - 4, this.posZ);
|
||||||
|
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos);
|
||||||
|
|
||||||
TileEntity tile = worldObj.getTileEntity((int) Math.floor(posX), (int) Math.floor(posY - 1), (int) Math.floor(posZ));
|
if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||||
|
|
||||||
|
TileEntity tile = worldObj.getTileEntity(mop.blockX, mop.blockY, mop.blockZ);
|
||||||
if (tile instanceof TileEntityDroneDock) {
|
if (tile instanceof TileEntityDroneDock) {
|
||||||
TileEntityDroneDock dock = (TileEntityDroneDock) tile;
|
TileEntityDroneDock dock = (TileEntityDroneDock) tile;
|
||||||
|
|
||||||
@ -128,11 +147,12 @@ public class EntityRequestDrone extends EntityDroneBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!this.isDead) {
|
if (!this.isDead) {
|
||||||
this.setDead();
|
this.setDead();
|
||||||
this.entityDropItem(new ItemStack(ModItems.drone, 1, EnumDroneType.REQUEST.ordinal()), 1F);
|
this.entityDropItem(new ItemStack(ModItems.drone, 1, EnumDroneType.REQUEST.ordinal()), 1F);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user