use of buildcraft.api.transport.pipe_bc8.EnumContentsJourneyPart in project BuildCraft by BuildCraft.
the class TravellingItem_BC8 method tick.
@BCPipeEventHandler
public void tick(IPipeEvent_BC8.Tick tick) {
if (item.getProperties().getValue(PipeAPI_BC8.ITEM_PAUSED)) {
// Just so we render them properly, and so we need to stop this from ticking in the near future
tickStarted++;
tickFinished++;
return;
}
if (tick instanceof IPipeEvent_BC8.Tick.Client)
return;
EnumContentsJourneyPart direction = item.getJourneyPart();
if (direction == EnumContentsJourneyPart.JUST_ENTERED) {
// Setup ourselves NOW, but tick the rest later
double normalizedSpeed = item.getSpeed() * PipeTransportItem_BC8.SPEED_NORMALIZER;
IPipeEventContents_BC8.ChangeSpeed changeSpeed = null;
pipe.fireEvent(changeSpeed);
// normalizedSpeed = changeSpeed.getNormalizedSpeed();
item.setSpeed(normalizedSpeed / PipeTransportItem_BC8.SPEED_NORMALIZER);
double distance = 0.25;
IConnection_BC8 connection = pipe.getConnections().get(item.getDirection().getOpposite());
if (connection != null)
distance += connection.getLength();
// generate our new timings (when we will next tick)
genTimings(pipe.getWorld().getTotalWorldTime(), distance);
// Update the client with our new timings
pipe.sendClientUpdate(this);
// Tick next tick not this tick
return;
}
if (tick.getCurrentTick() < tickFinished)
return;
if (direction == EnumContentsJourneyPart.TO_CENTER) {
// We need to find out where we are going, and the new speed of ourselves
} else {
/* We must be going to the end of the pipe, so we need to insert ourselves into the next pipe, or into an
* inventory (if one exists) */
}
}
use of buildcraft.api.transport.pipe_bc8.EnumContentsJourneyPart in project BuildCraft by BuildCraft.
the class PipeContentsEditableItem method readFromNBT.
@Override
public IPipeContentsEditableItem readFromNBT(NBTBase nbt) {
NBTTagCompound tag = (NBTTagCompound) nbt;
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("stack"));
EnumContentsJourneyPart journeyPart = NBTUtilBC.readEnum(tag.getTag("journeyPart"), EnumContentsJourneyPart.class);
EnumFacing direction = NBTUtilBC.readEnum(tag.getTag("direction"), EnumFacing.class);
double speed = tag.getDouble("speed");
IPipePropertyProviderEditable provider = propertyProvider.readFromNBT(tag.getTag("properties"));
return new PipeContentsEditableItem(provider, stack, journeyPart, direction, speed);
}
Aggregations