use of buildcraft.api.transport.pluggable.PluggableDefinition in project BuildCraft by BuildCraft.
the class ItemPluggableLens method onPlace.
@Override
public PipePluggable onPlace(@Nonnull ItemStack stack, IPipeHolder holder, EnumFacing side, EntityPlayer player, EnumHand hand) {
IPipe pipe = holder.getPipe();
if (pipe == null || !(pipe.getFlow() instanceof IFlowItems)) {
return null;
}
LensData data = getData(stack);
SoundUtil.playBlockPlace(holder.getPipeWorld(), holder.getPipePos(), Blocks.STONE.getDefaultState());
PluggableDefinition def = BCTransportPlugs.lens;
return new PluggableLens(def, holder, side, data.colour, data.isFilter);
}
use of buildcraft.api.transport.pluggable.PluggableDefinition in project BuildCraft by BuildCraft.
the class ItemPluggableGate method onPlace.
@Override
public PipePluggable onPlace(@Nonnull ItemStack stack, IPipeHolder holder, EnumFacing side, EntityPlayer player, EnumHand hand) {
GateVariant variant = getVariant(stack);
SoundUtil.playBlockPlace(holder.getPipeWorld(), holder.getPipePos(), variant.material.block.getDefaultState());
PluggableDefinition def = BCTransportPlugs.gate;
return new PluggableGate(def, holder, side, variant);
}
use of buildcraft.api.transport.pluggable.PluggableDefinition in project BuildCraft by BuildCraft.
the class PluggableHolder method readCreateInternal.
private void readCreateInternal(PacketBuffer buffer) throws InvalidInputDataException {
ResourceLocation identifier = new ResourceLocation(buffer.readString(256));
PluggableDefinition def = PipeApi.pluggableRegistry.getDefinition(identifier);
if (def == null) {
throw new IllegalStateException("Unknown remote pluggable \"" + identifier + "\"");
}
pluggable = def.loadFromBuffer(holder, side, buffer);
holder.eventBus.registerHandler(pluggable);
}
use of buildcraft.api.transport.pluggable.PluggableDefinition in project BuildCraft by BuildCraft.
the class PluggableHolder method readFromNbt.
public void readFromNbt(NBTTagCompound nbt) {
if (nbt.hasNoTags()) {
pluggable = null;
return;
}
String id = nbt.getString("id");
NBTTagCompound data = nbt.getCompoundTag("data");
ResourceLocation identifier = new ResourceLocation(id);
PluggableDefinition def = PipeApi.pluggableRegistry.getDefinition(identifier);
if (def == null) {
BCLog.logger.warn("Unknown pluggable id '" + id + "'");
throw new Error("Def was null!");
} else {
pluggable = def.readFromNbt(holder, side, data);
holder.eventBus.registerHandler(pluggable);
lastGeneralExisted = true;
}
}
Aggregations