Transport drone visualization + fixed low angles for drones

This commit is contained in:
70000hp 2024-06-08 18:55:05 -04:00
parent dce3bf8937
commit d67bbe9c53
5 changed files with 36 additions and 7 deletions

View File

@ -29,7 +29,7 @@ public abstract class EntityDroneBase extends Entity {
public void setTarget(double x, double y, double z) {
this.targetX = x;
this.targetY = y + 1;
this.targetY = y;
this.targetZ = z;
}
@ -112,7 +112,9 @@ public abstract class EntityDroneBase extends Entity {
this.motionZ = dist.zCoord * speed;
}
}
if(isCollidedHorizontally){
motionY += 1;
}
this.moveEntity(motionX, motionY, motionZ);
}
}

View File

@ -31,6 +31,14 @@ public class EntityRequestDrone extends EntityDroneBase {
UNLOAD, DOCK
}
@Override
public void setTarget(double x, double y, double z) {
this.targetX = x;
this.targetY = y + 1;
this.targetZ = z;
}
public EntityRequestDrone(World world) {
super(world);
}

View File

@ -1963,7 +1963,9 @@ public class ClientProxy extends ServerProxy {
held == Item.getItemFromBlock(ModBlocks.drone_crate_provider) ||
held == Item.getItemFromBlock(ModBlocks.drone_crate_requester) ||
held == Item.getItemFromBlock(ModBlocks.drone_dock) ||
held == Item.getItemFromBlock(ModBlocks.drone_waypoint_request)) {
held == Item.getItemFromBlock(ModBlocks.drone_waypoint_request) ||
held == Item.getItemFromBlock(ModBlocks.drone_waypoint) ||
held == ModItems.drone_linker) {
double mX = data.getDouble("mX");
double mY = data.getDouble("mY");
double mZ = data.getDouble("mZ");

View File

@ -12,6 +12,7 @@ import com.hbm.inventory.gui.GUIDroneCrate;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.ParticleUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import api.hbm.fluid.IFluidStandardTransceiver;
@ -51,7 +52,7 @@ public class TileEntityDroneCrate extends TileEntityMachineBase implements IGUIP
public void updateEntity() {
if(!worldObj.isRemote) {
BlockPos pos = getCoord();
this.tank.setType(18, slots);
if(sendingMode && !itemType && worldObj.getTotalWorldTime() % 20 == 0) {
@ -75,7 +76,13 @@ public class TileEntityDroneCrate extends TileEntityMachineBase implements IGUIP
if(!sendingMode && !itemType) unloadFluid(drone);
}
}
ParticleUtil.spawnDroneLine(worldObj,
pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
(nextX - pos.getX()), (nextY - pos.getY()), (nextZ - pos.getZ()), 0x00ffff);
}
NBTTagCompound data = new NBTTagCompound();
data.setIntArray("pos", new int[] {nextX, nextY, nextZ});
@ -218,6 +225,10 @@ public class TileEntityDroneCrate extends TileEntityMachineBase implements IGUIP
this.itemType = nbt.getBoolean("type");
tank.readFromNBT(nbt, "t");
}
public BlockPos getCoord() {
return new BlockPos(xCoord, yCoord + 1, zCoord);
}
@Override
public void writeToNBT(NBTTagCompound nbt) {

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.hbm.entity.item.EntityDeliveryDrone;
import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.util.ParticleUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import net.minecraft.nbt.NBTTagCompound;
@ -22,11 +23,9 @@ public class TileEntityDroneWaypoint extends TileEntity implements INBTPacketRec
@Override
public void updateEntity() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
if(!worldObj.isRemote) {
if(nextY != -1) {
List<EntityDeliveryDrone> drones = worldObj.getEntitiesWithinAABB(EntityDeliveryDrone.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).offset(dir.offsetX * height, dir.offsetY * height, dir.offsetZ * height));
for(EntityDeliveryDrone drone : drones) {
@ -41,13 +40,17 @@ public class TileEntityDroneWaypoint extends TileEntity implements INBTPacketRec
data.setIntArray("pos", new int[] {nextX, nextY, nextZ});
INBTPacketReceiver.networkPack(this, data, 15);
} else {
BlockPos pos = getCoord(dir);
if(nextY != -1 && worldObj.getTotalWorldTime() % 2 == 0) {
double x = xCoord + height * dir.offsetX + 0.5;
double y = yCoord + height * dir.offsetY + 0.5;
double z = zCoord + height * dir.offsetZ + 0.5;
worldObj.spawnParticle("reddust", x, y, z, 0, 0, 0);
ParticleUtil.spawnDroneLine(worldObj,
pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
(nextX - pos.getX()), (nextY - pos.getY()), (nextZ - pos.getZ()), 0x0000ff);
}
}
}
@ -98,4 +101,7 @@ public class TileEntityDroneWaypoint extends TileEntity implements INBTPacketRec
nbt.setInteger("height", height);
nbt.setIntArray("pos", new int[] {nextX, nextY, nextZ});
}
public BlockPos getCoord(ForgeDirection dir) {
return new BlockPos(xCoord + height * dir.offsetX + 0.5, yCoord + height * dir.offsetY + 0.5, zCoord + height * dir.offsetZ + 0.5);
}
}